Skip to content

Commit

Permalink
Updating based on 20dba07e
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Feb 23, 2024
1 parent b3cd3f6 commit 33da288
Show file tree
Hide file tree
Showing 105 changed files with 7,845 additions and 0 deletions.
73 changes: 73 additions & 0 deletions resource-manager/redhatopenshift/2023-11-22/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package v2023_11_22

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/machinepools"
"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/openshiftclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/openshiftversions"
"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/secrets"
"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/syncidentityproviders"
"github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/syncsets"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
MachinePools *machinepools.MachinePoolsClient
OpenShiftClusters *openshiftclusters.OpenShiftClustersClient
OpenShiftVersions *openshiftversions.OpenShiftVersionsClient
Secrets *secrets.SecretsClient
SyncIdentityProviders *syncidentityproviders.SyncIdentityProvidersClient
SyncSets *syncsets.SyncSetsClient
}

func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
machinePoolsClient, err := machinepools.NewMachinePoolsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MachinePools client: %+v", err)
}
configureFunc(machinePoolsClient.Client)

openShiftClustersClient, err := openshiftclusters.NewOpenShiftClustersClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building OpenShiftClusters client: %+v", err)
}
configureFunc(openShiftClustersClient.Client)

openShiftVersionsClient, err := openshiftversions.NewOpenShiftVersionsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building OpenShiftVersions client: %+v", err)
}
configureFunc(openShiftVersionsClient.Client)

secretsClient, err := secrets.NewSecretsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Secrets client: %+v", err)
}
configureFunc(secretsClient.Client)

syncIdentityProvidersClient, err := syncidentityproviders.NewSyncIdentityProvidersClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building SyncIdentityProviders client: %+v", err)
}
configureFunc(syncIdentityProvidersClient.Client)

syncSetsClient, err := syncsets.NewSyncSetsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building SyncSets client: %+v", err)
}
configureFunc(syncSetsClient.Client)

return &Client{
MachinePools: machinePoolsClient,
OpenShiftClusters: openShiftClustersClient,
OpenShiftVersions: openShiftVersionsClient,
Secrets: secretsClient,
SyncIdentityProviders: syncIdentityProvidersClient,
SyncSets: syncSetsClient,
}, nil
}
111 changes: 111 additions & 0 deletions resource-manager/redhatopenshift/2023-11-22/machinepools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/redhatopenshift/2023-11-22/machinepools` Documentation

The `machinepools` SDK allows for interaction with the Azure Resource Manager Service `redhatopenshift` (API Version `2023-11-22`).

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/redhatopenshift/2023-11-22/machinepools"
```


### Client Initialization

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


### Example Usage: `MachinePoolsClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := machinepools.NewMachinePoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "openShiftClusterValue", "machinePoolValue")

payload := machinepools.MachinePool{
// ...
}


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: `MachinePoolsClient.Delete`

```go
ctx := context.TODO()
id := machinepools.NewMachinePoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "openShiftClusterValue", "machinePoolValue")

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


### Example Usage: `MachinePoolsClient.Get`

```go
ctx := context.TODO()
id := machinepools.NewMachinePoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "openShiftClusterValue", "machinePoolValue")

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

```go
ctx := context.TODO()
id := machinepools.NewOpenShiftClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "openShiftClusterValue")

// alternatively `client.List(ctx, id)` can be used to do batched pagination
items, err := client.ListComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```


### Example Usage: `MachinePoolsClient.Update`

```go
ctx := context.TODO()
id := machinepools.NewMachinePoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "openShiftClusterValue", "machinePoolValue")

payload := machinepools.MachinePoolUpdate{
// ...
}


read, err := client.Update(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 resource-manager/redhatopenshift/2023-11-22/machinepools/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package machinepools

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

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

return &MachinePoolsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package machinepools

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

// MachinePoolId is a struct representing the Resource ID for a Machine Pool
type MachinePoolId struct {
SubscriptionId string
ResourceGroupName string
OpenShiftClusterName string
MachinePoolName string
}

// NewMachinePoolID returns a new MachinePoolId struct
func NewMachinePoolID(subscriptionId string, resourceGroupName string, openShiftClusterName string, machinePoolName string) MachinePoolId {
return MachinePoolId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
OpenShiftClusterName: openShiftClusterName,
MachinePoolName: machinePoolName,
}
}

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

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

return &id, nil
}

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

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

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

return nil
}

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

return
}

// ID returns the formatted Machine Pool ID
func (id MachinePoolId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RedHatOpenShift/openShiftClusters/%s/machinePool/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.OpenShiftClusterName, id.MachinePoolName)
}

// Segments returns a slice of Resource ID Segments which comprise this Machine Pool ID
func (id MachinePoolId) 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("staticMicrosoftRedHatOpenShift", "Microsoft.RedHatOpenShift", "Microsoft.RedHatOpenShift"),
resourceids.StaticSegment("staticOpenShiftClusters", "openShiftClusters", "openShiftClusters"),
resourceids.UserSpecifiedSegment("openShiftClusterName", "openShiftClusterValue"),
resourceids.StaticSegment("staticMachinePool", "machinePool", "machinePool"),
resourceids.UserSpecifiedSegment("machinePoolName", "machinePoolValue"),
}
}

// String returns a human-readable description of this Machine Pool ID
func (id MachinePoolId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Open Shift Cluster Name: %q", id.OpenShiftClusterName),
fmt.Sprintf("Machine Pool Name: %q", id.MachinePoolName),
}
return fmt.Sprintf("Machine Pool (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit 33da288

Please sign in to comment.