Skip to content

Commit

Permalink
Merge pull request #985 from hashicorp/auto-pr/a0808d0a
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (dafff52)
  • Loading branch information
tombuildsstuff authored May 7, 2024
2 parents d314754 + dafff52 commit 852ee2a
Show file tree
Hide file tree
Showing 637 changed files with 40,246 additions and 0 deletions.
117 changes: 117 additions & 0 deletions resource-manager/databricks/2024-05-01/accessconnector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/accessconnector` Documentation

The `accessconnector` SDK allows for interaction with the Azure Resource Manager Service `databricks` (API Version `2024-05-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-helpers/resourcemanager/commonids"
import "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2024-05-01/accessconnector"
```


### Client Initialization

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


### Example Usage: `AccessConnectorClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue")

payload := accessconnector.AccessConnector{
// ...
}


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


### Example Usage: `AccessConnectorClient.Delete`

```go
ctx := context.TODO()
id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue")

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


### Example Usage: `AccessConnectorClient.Get`

```go
ctx := context.TODO()
id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue")

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: `AccessConnectorClient.ListByResourceGroup`

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

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


### Example Usage: `AccessConnectorClient.ListBySubscription`

```go
ctx := context.TODO()
id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012")

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


### Example Usage: `AccessConnectorClient.Update`

```go
ctx := context.TODO()
id := accessconnector.NewAccessConnectorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accessConnectorValue")

payload := accessconnector.AccessConnectorUpdate{
// ...
}


if err := client.UpdateThenPoll(ctx, id, payload); err != nil {
// handle the error
}
```
26 changes: 26 additions & 0 deletions resource-manager/databricks/2024-05-01/accessconnector/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package accessconnector

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

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

return &AccessConnectorClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package accessconnector

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 (
ProvisioningStateDeleted ProvisioningState = "Deleted"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
)

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

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{
"deleted": ProvisioningStateDeleted,
"failed": ProvisioningStateFailed,
"succeeded": ProvisioningStateSucceeded,
}
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,130 @@
package accessconnector

import (
"fmt"
"strings"

"github.com/hashicorp/go-azure-helpers/resourcemanager/recaser"
"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.

func init() {
recaser.RegisterResourceId(&AccessConnectorId{})
}

var _ resourceids.ResourceId = &AccessConnectorId{}

// AccessConnectorId is a struct representing the Resource ID for a Access Connector
type AccessConnectorId struct {
SubscriptionId string
ResourceGroupName string
AccessConnectorName string
}

// NewAccessConnectorID returns a new AccessConnectorId struct
func NewAccessConnectorID(subscriptionId string, resourceGroupName string, accessConnectorName string) AccessConnectorId {
return AccessConnectorId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
AccessConnectorName: accessConnectorName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

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

return nil
}

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

return
}

// ID returns the formatted Access Connector ID
func (id AccessConnectorId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/accessConnectors/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccessConnectorName)
}

// Segments returns a slice of Resource ID Segments which comprise this Access Connector ID
func (id AccessConnectorId) 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("staticMicrosoftDatabricks", "Microsoft.Databricks", "Microsoft.Databricks"),
resourceids.StaticSegment("staticAccessConnectors", "accessConnectors", "accessConnectors"),
resourceids.UserSpecifiedSegment("accessConnectorName", "accessConnectorValue"),
}
}

// String returns a human-readable description of this Access Connector ID
func (id AccessConnectorId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Access Connector Name: %q", id.AccessConnectorName),
}
return fmt.Sprintf("Access Connector (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit 852ee2a

Please sign in to comment.