Skip to content

Commit

Permalink
Merge pull request #806 from hashicorp/auto-pr/88f296ec7
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (e7deff4)
  • Loading branch information
tombuildsstuff authored Jan 12, 2024
2 parents f88e895 + e7deff4 commit acfa856
Show file tree
Hide file tree
Showing 338 changed files with 11,718 additions and 11,892 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package attacheddatabaseconfigurations

import "github.com/Azure/go-autorest/autorest"
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 AttachedDatabaseConfigurationsClient struct {
Client autorest.Client
baseUri string
Client *resourcemanager.Client
}

func NewAttachedDatabaseConfigurationsClientWithBaseURI(endpoint string) AttachedDatabaseConfigurationsClient {
return AttachedDatabaseConfigurationsClient{
Client: autorest.NewClientWithUserAgent(userAgent()),
baseUri: endpoint,
func NewAttachedDatabaseConfigurationsClientWithBaseURI(sdkApi sdkEnv.Api) (*AttachedDatabaseConfigurationsClient, error) {
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "attacheddatabaseconfigurations", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating AttachedDatabaseConfigurationsClient: %+v", err)
}

return &AttachedDatabaseConfigurationsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package attacheddatabaseconfigurations

import "strings"
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.
Expand All @@ -17,6 +21,19 @@ func PossibleValuesForAttachedDatabaseType() []string {
}
}

func (s *AttachedDatabaseType) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseAttachedDatabaseType(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseAttachedDatabaseType(input string) (*AttachedDatabaseType, error) {
vals := map[string]AttachedDatabaseType{
"microsoft.kusto/clusters/attacheddatabaseconfigurations": AttachedDatabaseTypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations,
Expand Down Expand Up @@ -46,6 +63,19 @@ func PossibleValuesForDefaultPrincipalsModificationKind() []string {
}
}

func (s *DefaultPrincipalsModificationKind) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseDefaultPrincipalsModificationKind(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseDefaultPrincipalsModificationKind(input string) (*DefaultPrincipalsModificationKind, error) {
vals := map[string]DefaultPrincipalsModificationKind{
"none": DefaultPrincipalsModificationKindNone,
Expand Down Expand Up @@ -85,6 +115,19 @@ func PossibleValuesForProvisioningState() []string {
}
}

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{
"canceled": ProvisioningStateCanceled,
Expand Down Expand Up @@ -118,6 +161,19 @@ func PossibleValuesForReason() []string {
}
}

func (s *Reason) UnmarshalJSON(bytes []byte) error {
var decoded string
if err := json.Unmarshal(bytes, &decoded); err != nil {
return fmt.Errorf("unmarshaling: %+v", err)
}
out, err := parseReason(decoded)
if err != nil {
return fmt.Errorf("parsing %q: %+v", decoded, err)
}
*s = *out
return nil
}

func parseReason(input string) (*Reason, error) {
vals := map[string]Reason{
"alreadyexists": ReasonAlreadyExists,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package attacheddatabaseconfigurations

import (
"context"
"fmt"
"net/http"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

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

type CheckNameAvailabilityOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model *CheckNameResult
}

// CheckNameAvailability ...
func (c AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, id commonids.KustoClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodPost,
Path: fmt.Sprintf("%s/attachedDatabaseConfigurationCheckNameAvailability", id.ID()),
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

if err = req.Marshal(input); err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

if err = resp.Unmarshal(&result.Model); err != nil {
return
}

return
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package attacheddatabaseconfigurations

import (
"context"
"fmt"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/client/pollers"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

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

type CreateOrUpdateOperationResponse struct {
Poller pollers.Poller
HttpResponse *http.Response
OData *odata.OData
}

// CreateOrUpdate ...
func (c AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (result CreateOrUpdateOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusAccepted,
http.StatusCreated,
http.StatusOK,
},
HttpMethod: http.MethodPut,
Path: id.ID(),
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

if err = req.Marshal(input); err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client)
if err != nil {
return
}

return
}

// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed
func (c AttachedDatabaseConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) error {
result, err := c.CreateOrUpdate(ctx, id, input)
if err != nil {
return fmt.Errorf("performing CreateOrUpdate: %+v", err)
}

if err := result.Poller.PollUntilDone(ctx); err != nil {
return fmt.Errorf("polling after CreateOrUpdate: %+v", err)
}

return nil
}
Loading

0 comments on commit acfa856

Please sign in to comment.