Skip to content

Commit

Permalink
resourcemanager/commonids: updating to use the new error types
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed May 9, 2023
1 parent 628f94b commit 3b36455
Show file tree
Hide file tree
Showing 31 changed files with 239 additions and 239 deletions.
16 changes: 8 additions & 8 deletions resourcemanager/commonids/automation_compilation_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func ParseAutomationCompilationJobID(input string) (*AutomationCompilationJobId,
id := AutomationCompilationJobId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok {
return nil, fmt.Errorf("the segment 'automationAccountName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed)
}

if id.CompilationJobId, ok = parsed.Parsed["compilationJobId"]; !ok {
return nil, fmt.Errorf("the segment 'compilationJobId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "compilationJobId", *parsed)
}

return &id, nil
Expand All @@ -73,19 +73,19 @@ func ParseAutomationCompilationJobIDInsensitively(input string) (*AutomationComp
id := AutomationCompilationJobId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok {
return nil, fmt.Errorf("the segment 'automationAccountName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed)
}

if id.CompilationJobId, ok = parsed.Parsed["compilationJobId"]; !ok {
return nil, fmt.Errorf("the segment 'compilationJobId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "compilationJobId", *parsed)
}

return &id, nil
Expand Down
26 changes: 13 additions & 13 deletions resourcemanager/commonids/cloud_services_ip_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,27 @@ func ParseCloudServicesIPConfigurationID(input string) (*CloudServicesIPConfigur
id := CloudServicesIPConfigurationId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed)
}

if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok {
return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed)
}

if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok {
return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed)
}

if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok {
return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipConfigurationName", *parsed)
}

return &id, nil
Expand All @@ -78,34 +78,34 @@ func ParseCloudServicesIPConfigurationIDInsensitively(input string) (*CloudServi
parser := resourceids.NewParserFromResourceIdType(CloudServicesIPConfigurationId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
return nil, err
}

var ok bool
id := CloudServicesIPConfigurationId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed)
}

if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok {
return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed)
}

if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok {
return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed)
}

if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok {
return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipConfigurationName", *parsed)
}

return &id, nil
Expand Down
28 changes: 14 additions & 14 deletions resourcemanager/commonids/cloud_services_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ func ParseCloudServicesPublicIPAddressID(input string) (*CloudServicesPublicIPAd
id := CloudServicesPublicIPAddressId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed)
}

if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok {
return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed)
}

if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok {
return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed)
}

if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok {
return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipConfigurationName", *parsed)
}

if id.PublicIPAddressName, ok = parsed.Parsed["publicIPAddressName"]; !ok {
return nil, fmt.Errorf("the segment 'publicIPAddressName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPAddressName", *parsed)
}

return &id, nil
Expand All @@ -91,31 +91,31 @@ func ParseCloudServicesPublicIPAddressIDInsensitively(input string) (*CloudServi
id := CloudServicesPublicIPAddressId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed)
}

if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok {
return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed)
}

if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok {
return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed)
}

if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok {
return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipConfigurationName", *parsed)
}

if id.PublicIPAddressName, ok = parsed.Parsed["publicIPAddressName"]; !ok {
return nil, fmt.Errorf("the segment 'publicIPAddressName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPAddressName", *parsed)
}

return &id, nil
Expand Down
16 changes: 8 additions & 8 deletions resourcemanager/commonids/express_route_circuit_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func ParseExpressRouteCircuitPeeringID(input string) (*ExpressRouteCircuitPeerin
id := ExpressRouteCircuitPeeringId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CircuitName, ok = parsed.Parsed["circuitName"]; !ok {
return nil, fmt.Errorf("the segment 'circuitName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "circuitName", *parsed)
}

if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok {
return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed)
}

return &id, nil
Expand All @@ -73,19 +73,19 @@ func ParseExpressRouteCircuitPeeringIDInsensitively(input string) (*ExpressRoute
id := ExpressRouteCircuitPeeringId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.CircuitName, ok = parsed.Parsed["circuitName"]; !ok {
return nil, fmt.Errorf("the segment 'circuitName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "circuitName", *parsed)
}

if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok {
return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed)
}

return &id, nil
Expand Down
16 changes: 8 additions & 8 deletions resourcemanager/commonids/hyperv_site_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func ParseHyperVSiteJobID(input string) (*HyperVSiteJobId, error) {
id := HyperVSiteJobId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.JobName, ok = parsed.Parsed["jobName"]; !ok {
return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed)
}

return &id, nil
Expand All @@ -73,19 +73,19 @@ func ParseHyperVSiteJobIDInsensitively(input string) (*HyperVSiteJobId, error) {
id := HyperVSiteJobId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.JobName, ok = parsed.Parsed["jobName"]; !ok {
return nil, fmt.Errorf("the segment 'jobName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed)
}

return &id, nil
Expand Down
16 changes: 8 additions & 8 deletions resourcemanager/commonids/hyperv_site_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func ParseHyperVSiteMachineID(input string) (*HyperVSiteMachineId, error) {
id := HyperVSiteMachineId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.MachineName, ok = parsed.Parsed["machineName"]; !ok {
return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed)
}

return &id, nil
Expand All @@ -73,19 +73,19 @@ func ParseHyperVSiteMachineIDInsensitively(input string) (*HyperVSiteMachineId,
id := HyperVSiteMachineId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.MachineName, ok = parsed.Parsed["machineName"]; !ok {
return nil, fmt.Errorf("the segment 'machineName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed)
}

return &id, nil
Expand Down
16 changes: 8 additions & 8 deletions resourcemanager/commonids/hyperv_site_runasaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func ParseHyperVSiteRunAsAccountID(input string) (*HyperVSiteRunAsAccountId, err
id := HyperVSiteRunAsAccountId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok {
return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "runAsAccountName", *parsed)
}

return &id, nil
Expand All @@ -73,19 +73,19 @@ func ParseHyperVSiteRunAsAccountIDInsensitively(input string) (*HyperVSiteRunAsA
id := HyperVSiteRunAsAccountId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed)
}

if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok {
return nil, fmt.Errorf("the segment 'hyperVSiteName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed)
}

if id.RunAsAccountName, ok = parsed.Parsed["runAsAccountName"]; !ok {
return nil, fmt.Errorf("the segment 'runAsAccountName' was not found in the resource id %q", input)
return nil, resourceids.NewSegmentNotSpecifiedError(id, "runAsAccountName", *parsed)
}

return &id, nil
Expand Down
Loading

0 comments on commit 3b36455

Please sign in to comment.