Skip to content

Commit

Permalink
Merge pull request hashicorp#961 from hashicorp/auto-pr/64934f13
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (dad5722)
  • Loading branch information
tombuildsstuff authored Apr 11, 2024
2 parents 6ec5255 + dad5722 commit 3159c90
Show file tree
Hide file tree
Showing 4,328 changed files with 222,424 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
86 changes: 86 additions & 0 deletions resource-manager/network/2023-11-01/adminrulecollections/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/adminrulecollections` Documentation

The `adminrulecollections` SDK allows for interaction with the Azure Resource Manager Service `network` (API Version `2023-11-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/network/2023-11-01/adminrulecollections"
```


### Client Initialization

```go
client := adminrulecollections.NewAdminRuleCollectionsClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
```


### Example Usage: `AdminRuleCollectionsClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := adminrulecollections.NewRuleCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkManagerValue", "securityAdminConfigurationValue", "ruleCollectionValue")

payload := adminrulecollections.AdminRuleCollection{
// ...
}


read, err := client.CreateOrUpdate(ctx, id, payload)
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `AdminRuleCollectionsClient.Delete`

```go
ctx := context.TODO()
id := adminrulecollections.NewRuleCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkManagerValue", "securityAdminConfigurationValue", "ruleCollectionValue")

if err := client.DeleteThenPoll(ctx, id, adminrulecollections.DefaultDeleteOperationOptions()); err != nil {
// handle the error
}
```


### Example Usage: `AdminRuleCollectionsClient.Get`

```go
ctx := context.TODO()
id := adminrulecollections.NewRuleCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkManagerValue", "securityAdminConfigurationValue", "ruleCollectionValue")

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: `AdminRuleCollectionsClient.List`

```go
ctx := context.TODO()
id := adminrulecollections.NewSecurityAdminConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "networkManagerValue", "securityAdminConfigurationValue")

// alternatively `client.List(ctx, id, adminrulecollections.DefaultListOperationOptions())` can be used to do batched pagination
items, err := client.ListComplete(ctx, id, adminrulecollections.DefaultListOperationOptions())
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```
26 changes: 26 additions & 0 deletions resource-manager/network/2023-11-01/adminrulecollections/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package adminrulecollections

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 AdminRuleCollectionsClient struct {
Client *resourcemanager.Client
}

func NewAdminRuleCollectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*AdminRuleCollectionsClient, error) {
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "adminrulecollections", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating AdminRuleCollectionsClient: %+v", err)
}

return &AdminRuleCollectionsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package adminrulecollections

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 ProvisioningState string

const (
ProvisioningStateDeleting ProvisioningState = "Deleting"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
ProvisioningStateUpdating ProvisioningState = "Updating"
)

func PossibleValuesForProvisioningState() []string {
return []string{
string(ProvisioningStateDeleting),
string(ProvisioningStateFailed),
string(ProvisioningStateSucceeded),
string(ProvisioningStateUpdating),
}
}

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{
"deleting": ProvisioningStateDeleting,
"failed": ProvisioningStateFailed,
"succeeded": ProvisioningStateSucceeded,
"updating": ProvisioningStateUpdating,
}
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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
package adminrulecollections

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 = &RuleCollectionId{}

// RuleCollectionId is a struct representing the Resource ID for a Rule Collection
type RuleCollectionId struct {
SubscriptionId string
ResourceGroupName string
NetworkManagerName string
SecurityAdminConfigurationName string
RuleCollectionName string
}

// NewRuleCollectionID returns a new RuleCollectionId struct
func NewRuleCollectionID(subscriptionId string, resourceGroupName string, networkManagerName string, securityAdminConfigurationName string, ruleCollectionName string) RuleCollectionId {
return RuleCollectionId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
NetworkManagerName: networkManagerName,
SecurityAdminConfigurationName: securityAdminConfigurationName,
RuleCollectionName: ruleCollectionName,
}
}

// ParseRuleCollectionID parses 'input' into a RuleCollectionId
func ParseRuleCollectionID(input string) (*RuleCollectionId, error) {
parser := resourceids.NewParserFromResourceIdType(&RuleCollectionId{})
parsed, err := parser.Parse(input, false)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := RuleCollectionId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

return &id, nil
}

// ParseRuleCollectionIDInsensitively parses 'input' case-insensitively into a RuleCollectionId
// note: this method should only be used for API response data and not user input
func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) {
parser := resourceids.NewParserFromResourceIdType(&RuleCollectionId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

id := RuleCollectionId{}
if err := id.FromParseResult(*parsed); err != nil {
return nil, err
}

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 = input.Parsed["resourceGroupName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input)
}

if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input)
}

if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input)
}

if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok {
return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input)
}

return nil
}

// ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID
func ValidateRuleCollectionID(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 := ParseRuleCollectionID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Rule Collection ID
func (id RuleCollectionId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkManagers/%s/securityAdminConfigurations/%s/ruleCollections/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetworkManagerName, id.SecurityAdminConfigurationName, id.RuleCollectionName)
}

// Segments returns a slice of Resource ID Segments which comprise this Rule Collection ID
func (id RuleCollectionId) 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("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"),
resourceids.StaticSegment("staticNetworkManagers", "networkManagers", "networkManagers"),
resourceids.UserSpecifiedSegment("networkManagerName", "networkManagerValue"),
resourceids.StaticSegment("staticSecurityAdminConfigurations", "securityAdminConfigurations", "securityAdminConfigurations"),
resourceids.UserSpecifiedSegment("securityAdminConfigurationName", "securityAdminConfigurationValue"),
resourceids.StaticSegment("staticRuleCollections", "ruleCollections", "ruleCollections"),
resourceids.UserSpecifiedSegment("ruleCollectionName", "ruleCollectionValue"),
}
}

// String returns a human-readable description of this Rule Collection ID
func (id RuleCollectionId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Network Manager Name: %q", id.NetworkManagerName),
fmt.Sprintf("Security Admin Configuration Name: %q", id.SecurityAdminConfigurationName),
fmt.Sprintf("Rule Collection Name: %q", id.RuleCollectionName),
}
return fmt.Sprintf("Rule Collection (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit 3159c90

Please sign in to comment.