-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hc-github-team-tf-azure
committed
Feb 21, 2024
1 parent
36aed60
commit b9187bf
Showing
477 changed files
with
28,993 additions
and
0 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork` Documentation | ||
|
||
The `attacheddatanetwork` SDK allows for interaction with the Azure Resource Manager Service `mobilenetwork` (API Version `2024-02-01`). | ||
|
||
This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). | ||
|
||
### Import Path | ||
|
||
```go | ||
import "github.com/hashicorp/go-azure-sdk/resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := attacheddatanetwork.NewAttachedDataNetworkClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `AttachedDataNetworkClient.CreateOrUpdate` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := attacheddatanetwork.NewAttachedDataNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "packetCoreControlPlaneValue", "packetCoreDataPlaneValue", "attachedDataNetworkValue") | ||
|
||
payload := attacheddatanetwork.AttachedDataNetwork{ | ||
// ... | ||
} | ||
|
||
|
||
if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `AttachedDataNetworkClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := attacheddatanetwork.NewAttachedDataNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "packetCoreControlPlaneValue", "packetCoreDataPlaneValue", "attachedDataNetworkValue") | ||
|
||
if err := client.DeleteThenPoll(ctx, id); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `AttachedDataNetworkClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := attacheddatanetwork.NewAttachedDataNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "packetCoreControlPlaneValue", "packetCoreDataPlaneValue", "attachedDataNetworkValue") | ||
|
||
read, err := client.Get(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `AttachedDataNetworkClient.UpdateTags` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := attacheddatanetwork.NewAttachedDataNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "packetCoreControlPlaneValue", "packetCoreDataPlaneValue", "attachedDataNetworkValue") | ||
|
||
payload := attacheddatanetwork.TagsObject{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.UpdateTags(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork/client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package attacheddatanetwork | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type AttachedDataNetworkClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewAttachedDataNetworkClientWithBaseURI(sdkApi sdkEnv.Api) (*AttachedDataNetworkClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "attacheddatanetwork", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating AttachedDataNetworkClient: %+v", err) | ||
} | ||
|
||
return &AttachedDataNetworkClient{ | ||
Client: client, | ||
}, nil | ||
} |
107 changes: 107 additions & 0 deletions
107
resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork/constants.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package attacheddatanetwork | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type NaptEnabled string | ||
|
||
const ( | ||
NaptEnabledDisabled NaptEnabled = "Disabled" | ||
NaptEnabledEnabled NaptEnabled = "Enabled" | ||
) | ||
|
||
func PossibleValuesForNaptEnabled() []string { | ||
return []string{ | ||
string(NaptEnabledDisabled), | ||
string(NaptEnabledEnabled), | ||
} | ||
} | ||
|
||
func (s *NaptEnabled) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseNaptEnabled(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseNaptEnabled(input string) (*NaptEnabled, error) { | ||
vals := map[string]NaptEnabled{ | ||
"disabled": NaptEnabledDisabled, | ||
"enabled": NaptEnabledEnabled, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := NaptEnabled(input) | ||
return &out, nil | ||
} | ||
|
||
type ProvisioningState string | ||
|
||
const ( | ||
ProvisioningStateAccepted ProvisioningState = "Accepted" | ||
ProvisioningStateCanceled ProvisioningState = "Canceled" | ||
ProvisioningStateDeleted ProvisioningState = "Deleted" | ||
ProvisioningStateDeleting ProvisioningState = "Deleting" | ||
ProvisioningStateFailed ProvisioningState = "Failed" | ||
ProvisioningStateSucceeded ProvisioningState = "Succeeded" | ||
ProvisioningStateUnknown ProvisioningState = "Unknown" | ||
) | ||
|
||
func PossibleValuesForProvisioningState() []string { | ||
return []string{ | ||
string(ProvisioningStateAccepted), | ||
string(ProvisioningStateCanceled), | ||
string(ProvisioningStateDeleted), | ||
string(ProvisioningStateDeleting), | ||
string(ProvisioningStateFailed), | ||
string(ProvisioningStateSucceeded), | ||
string(ProvisioningStateUnknown), | ||
} | ||
} | ||
|
||
func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseProvisioningState(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseProvisioningState(input string) (*ProvisioningState, error) { | ||
vals := map[string]ProvisioningState{ | ||
"accepted": ProvisioningStateAccepted, | ||
"canceled": ProvisioningStateCanceled, | ||
"deleted": ProvisioningStateDeleted, | ||
"deleting": ProvisioningStateDeleting, | ||
"failed": ProvisioningStateFailed, | ||
"succeeded": ProvisioningStateSucceeded, | ||
"unknown": ProvisioningStateUnknown, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := ProvisioningState(input) | ||
return &out, nil | ||
} |
143 changes: 143 additions & 0 deletions
143
resource-manager/mobilenetwork/2024-02-01/attacheddatanetwork/id_attacheddatanetwork.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package attacheddatanetwork | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
var _ resourceids.ResourceId = &AttachedDataNetworkId{} | ||
|
||
// AttachedDataNetworkId is a struct representing the Resource ID for a Attached Data Network | ||
type AttachedDataNetworkId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
PacketCoreControlPlaneName string | ||
PacketCoreDataPlaneName string | ||
AttachedDataNetworkName string | ||
} | ||
|
||
// NewAttachedDataNetworkID returns a new AttachedDataNetworkId struct | ||
func NewAttachedDataNetworkID(subscriptionId string, resourceGroupName string, packetCoreControlPlaneName string, packetCoreDataPlaneName string, attachedDataNetworkName string) AttachedDataNetworkId { | ||
return AttachedDataNetworkId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
PacketCoreControlPlaneName: packetCoreControlPlaneName, | ||
PacketCoreDataPlaneName: packetCoreDataPlaneName, | ||
AttachedDataNetworkName: attachedDataNetworkName, | ||
} | ||
} | ||
|
||
// ParseAttachedDataNetworkID parses 'input' into a AttachedDataNetworkId | ||
func ParseAttachedDataNetworkID(input string) (*AttachedDataNetworkId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&AttachedDataNetworkId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := AttachedDataNetworkId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseAttachedDataNetworkIDInsensitively parses 'input' case-insensitively into a AttachedDataNetworkId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseAttachedDataNetworkIDInsensitively(input string) (*AttachedDataNetworkId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&AttachedDataNetworkId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := AttachedDataNetworkId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
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 = input.Parsed["resourceGroupName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) | ||
} | ||
|
||
if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) | ||
} | ||
|
||
if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) | ||
} | ||
|
||
if id.AttachedDataNetworkName, ok = input.Parsed["attachedDataNetworkName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateAttachedDataNetworkID checks that 'input' can be parsed as a Attached Data Network ID | ||
func ValidateAttachedDataNetworkID(input interface{}, key string) (warnings []string, errors []error) { | ||
v, ok := input.(string) | ||
if !ok { | ||
errors = append(errors, fmt.Errorf("expected %q to be a string", key)) | ||
return | ||
} | ||
|
||
if _, err := ParseAttachedDataNetworkID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Attached Data Network ID | ||
func (id AttachedDataNetworkId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MobileNetwork/packetCoreControlPlanes/%s/packetCoreDataPlanes/%s/attachedDataNetworks/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PacketCoreControlPlaneName, id.PacketCoreDataPlaneName, id.AttachedDataNetworkName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Attached Data Network ID | ||
func (id AttachedDataNetworkId) Segments() []resourceids.Segment { | ||
return []resourceids.Segment{ | ||
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), | ||
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), | ||
resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), | ||
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), | ||
resourceids.StaticSegment("staticProviders", "providers", "providers"), | ||
resourceids.ResourceProviderSegment("staticMicrosoftMobileNetwork", "Microsoft.MobileNetwork", "Microsoft.MobileNetwork"), | ||
resourceids.StaticSegment("staticPacketCoreControlPlanes", "packetCoreControlPlanes", "packetCoreControlPlanes"), | ||
resourceids.UserSpecifiedSegment("packetCoreControlPlaneName", "packetCoreControlPlaneValue"), | ||
resourceids.StaticSegment("staticPacketCoreDataPlanes", "packetCoreDataPlanes", "packetCoreDataPlanes"), | ||
resourceids.UserSpecifiedSegment("packetCoreDataPlaneName", "packetCoreDataPlaneValue"), | ||
resourceids.StaticSegment("staticAttachedDataNetworks", "attachedDataNetworks", "attachedDataNetworks"), | ||
resourceids.UserSpecifiedSegment("attachedDataNetworkName", "attachedDataNetworkValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Attached Data Network ID | ||
func (id AttachedDataNetworkId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Packet Core Control Plane Name: %q", id.PacketCoreControlPlaneName), | ||
fmt.Sprintf("Packet Core Data Plane Name: %q", id.PacketCoreDataPlaneName), | ||
fmt.Sprintf("Attached Data Network Name: %q", id.AttachedDataNetworkName), | ||
} | ||
return fmt.Sprintf("Attached Data Network (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.