Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating the Go SDK (2abe9acd27b3742548d581a00c58d863df839175) #1007

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
135 changes: 135 additions & 0 deletions resource-manager/apicenter/2024-03-01/apidefinitions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/apicenter/2024-03-01/apidefinitions` Documentation

The `apidefinitions` SDK allows for interaction with the Azure Resource Manager Service `apicenter` (API Version `2024-03-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/apicenter/2024-03-01/apidefinitions"
```


### Client Initialization

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


### Example Usage: `ApiDefinitionsClient.CreateOrUpdate`

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

payload := apidefinitions.ApiDefinition{
// ...
}


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

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

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: `ApiDefinitionsClient.ExportSpecification`

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

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


### Example Usage: `ApiDefinitionsClient.Get`

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

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: `ApiDefinitionsClient.Head`

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

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


### Example Usage: `ApiDefinitionsClient.ImportSpecification`

```go
ctx := context.TODO()
id := apidefinitions.NewDefinitionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue", "definitionValue")

payload := apidefinitions.ApiSpecImportRequest{
// ...
}


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


### Example Usage: `ApiDefinitionsClient.List`

```go
ctx := context.TODO()
id := apidefinitions.NewVersionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "workspaceValue", "apiValue", "versionValue")

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

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

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

return &ApiDefinitionsClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package apidefinitions

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

const (
ApiSpecExportResultFormatInline ApiSpecExportResultFormat = "inline"
ApiSpecExportResultFormatLink ApiSpecExportResultFormat = "link"
)

func PossibleValuesForApiSpecExportResultFormat() []string {
return []string{
string(ApiSpecExportResultFormatInline),
string(ApiSpecExportResultFormatLink),
}
}

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

func parseApiSpecExportResultFormat(input string) (*ApiSpecExportResultFormat, error) {
vals := map[string]ApiSpecExportResultFormat{
"inline": ApiSpecExportResultFormatInline,
"link": ApiSpecExportResultFormatLink,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := ApiSpecExportResultFormat(input)
return &out, nil
}

type ApiSpecImportSourceFormat string

const (
ApiSpecImportSourceFormatInline ApiSpecImportSourceFormat = "inline"
ApiSpecImportSourceFormatLink ApiSpecImportSourceFormat = "link"
)

func PossibleValuesForApiSpecImportSourceFormat() []string {
return []string{
string(ApiSpecImportSourceFormatInline),
string(ApiSpecImportSourceFormatLink),
}
}

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

func parseApiSpecImportSourceFormat(input string) (*ApiSpecImportSourceFormat, error) {
vals := map[string]ApiSpecImportSourceFormat{
"inline": ApiSpecImportSourceFormatInline,
"link": ApiSpecImportSourceFormatLink,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := ApiSpecImportSourceFormat(input)
return &out, nil
}
Loading
Loading