Skip to content

Commit b5d437b

Browse files
authored
Merge pull request #1107 from hashicorp/auto-pr/6067c8098
Auto PR: Regenerating the Go SDK (520ef06)
2 parents 4712040 + 520ef06 commit b5d437b

File tree

105 files changed

+6562
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+6562
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package v2024_09_01_preview
2+
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxapikey"
10+
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxcertificate"
11+
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxconfiguration"
12+
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxconfigurationanalysis"
13+
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxdeployment"
14+
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
15+
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
16+
)
17+
18+
type Client struct {
19+
NginxApiKey *nginxapikey.NginxApiKeyClient
20+
NginxCertificate *nginxcertificate.NginxCertificateClient
21+
NginxConfiguration *nginxconfiguration.NginxConfigurationClient
22+
NginxConfigurationAnalysis *nginxconfigurationanalysis.NginxConfigurationAnalysisClient
23+
NginxDeployment *nginxdeployment.NginxDeploymentClient
24+
}
25+
26+
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
27+
nginxApiKeyClient, err := nginxapikey.NewNginxApiKeyClientWithBaseURI(sdkApi)
28+
if err != nil {
29+
return nil, fmt.Errorf("building NginxApiKey client: %+v", err)
30+
}
31+
configureFunc(nginxApiKeyClient.Client)
32+
33+
nginxCertificateClient, err := nginxcertificate.NewNginxCertificateClientWithBaseURI(sdkApi)
34+
if err != nil {
35+
return nil, fmt.Errorf("building NginxCertificate client: %+v", err)
36+
}
37+
configureFunc(nginxCertificateClient.Client)
38+
39+
nginxConfigurationAnalysisClient, err := nginxconfigurationanalysis.NewNginxConfigurationAnalysisClientWithBaseURI(sdkApi)
40+
if err != nil {
41+
return nil, fmt.Errorf("building NginxConfigurationAnalysis client: %+v", err)
42+
}
43+
configureFunc(nginxConfigurationAnalysisClient.Client)
44+
45+
nginxConfigurationClient, err := nginxconfiguration.NewNginxConfigurationClientWithBaseURI(sdkApi)
46+
if err != nil {
47+
return nil, fmt.Errorf("building NginxConfiguration client: %+v", err)
48+
}
49+
configureFunc(nginxConfigurationClient.Client)
50+
51+
nginxDeploymentClient, err := nginxdeployment.NewNginxDeploymentClientWithBaseURI(sdkApi)
52+
if err != nil {
53+
return nil, fmt.Errorf("building NginxDeployment client: %+v", err)
54+
}
55+
configureFunc(nginxDeploymentClient.Client)
56+
57+
return &Client{
58+
NginxApiKey: nginxApiKeyClient,
59+
NginxCertificate: nginxCertificateClient,
60+
NginxConfiguration: nginxConfigurationClient,
61+
NginxConfigurationAnalysis: nginxConfigurationAnalysisClient,
62+
NginxDeployment: nginxDeploymentClient,
63+
}, nil
64+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
## `github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxapikey` Documentation
3+
4+
The `nginxapikey` SDK allows for interaction with Azure Resource Manager `nginx` (API Version `2024-09-01-preview`).
5+
6+
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).
7+
8+
### Import Path
9+
10+
```go
11+
import "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxapikey"
12+
```
13+
14+
15+
### Client Initialization
16+
17+
```go
18+
client := nginxapikey.NewNginxApiKeyClientWithBaseURI("https://management.azure.com")
19+
client.Client.Authorizer = authorizer
20+
```
21+
22+
23+
### Example Usage: `NginxApiKeyClient.ApiKeysCreateOrUpdate`
24+
25+
```go
26+
ctx := context.TODO()
27+
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")
28+
29+
payload := nginxapikey.NginxDeploymentApiKeyRequest{
30+
// ...
31+
}
32+
33+
34+
read, err := client.ApiKeysCreateOrUpdate(ctx, id, payload)
35+
if err != nil {
36+
// handle the error
37+
}
38+
if model := read.Model; model != nil {
39+
// do something with the model/response object
40+
}
41+
```
42+
43+
44+
### Example Usage: `NginxApiKeyClient.ApiKeysDelete`
45+
46+
```go
47+
ctx := context.TODO()
48+
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")
49+
50+
read, err := client.ApiKeysDelete(ctx, id)
51+
if err != nil {
52+
// handle the error
53+
}
54+
if model := read.Model; model != nil {
55+
// do something with the model/response object
56+
}
57+
```
58+
59+
60+
### Example Usage: `NginxApiKeyClient.ApiKeysGet`
61+
62+
```go
63+
ctx := context.TODO()
64+
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")
65+
66+
read, err := client.ApiKeysGet(ctx, id)
67+
if err != nil {
68+
// handle the error
69+
}
70+
if model := read.Model; model != nil {
71+
// do something with the model/response object
72+
}
73+
```
74+
75+
76+
### Example Usage: `NginxApiKeyClient.ApiKeysList`
77+
78+
```go
79+
ctx := context.TODO()
80+
id := nginxapikey.NewNginxDeploymentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName")
81+
82+
// alternatively `client.ApiKeysList(ctx, id)` can be used to do batched pagination
83+
items, err := client.ApiKeysListComplete(ctx, id)
84+
if err != nil {
85+
// handle the error
86+
}
87+
for _, item := range items {
88+
// do something
89+
}
90+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package nginxapikey
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
7+
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
8+
)
9+
10+
// Copyright (c) Microsoft Corporation. All rights reserved.
11+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
12+
13+
type NginxApiKeyClient struct {
14+
Client *resourcemanager.Client
15+
}
16+
17+
func NewNginxApiKeyClientWithBaseURI(sdkApi sdkEnv.Api) (*NginxApiKeyClient, error) {
18+
client, err := resourcemanager.NewClient(sdkApi, "nginxapikey", defaultApiVersion)
19+
if err != nil {
20+
return nil, fmt.Errorf("instantiating NginxApiKeyClient: %+v", err)
21+
}
22+
23+
return &NginxApiKeyClient{
24+
Client: client,
25+
}, nil
26+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package nginxapikey
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/hashicorp/go-azure-helpers/resourcemanager/recaser"
8+
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
9+
)
10+
11+
// Copyright (c) Microsoft Corporation. All rights reserved.
12+
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
13+
14+
func init() {
15+
recaser.RegisterResourceId(&ApiKeyId{})
16+
}
17+
18+
var _ resourceids.ResourceId = &ApiKeyId{}
19+
20+
// ApiKeyId is a struct representing the Resource ID for a Api Key
21+
type ApiKeyId struct {
22+
SubscriptionId string
23+
ResourceGroupName string
24+
NginxDeploymentName string
25+
ApiKeyName string
26+
}
27+
28+
// NewApiKeyID returns a new ApiKeyId struct
29+
func NewApiKeyID(subscriptionId string, resourceGroupName string, nginxDeploymentName string, apiKeyName string) ApiKeyId {
30+
return ApiKeyId{
31+
SubscriptionId: subscriptionId,
32+
ResourceGroupName: resourceGroupName,
33+
NginxDeploymentName: nginxDeploymentName,
34+
ApiKeyName: apiKeyName,
35+
}
36+
}
37+
38+
// ParseApiKeyID parses 'input' into a ApiKeyId
39+
func ParseApiKeyID(input string) (*ApiKeyId, error) {
40+
parser := resourceids.NewParserFromResourceIdType(&ApiKeyId{})
41+
parsed, err := parser.Parse(input, false)
42+
if err != nil {
43+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
44+
}
45+
46+
id := ApiKeyId{}
47+
if err = id.FromParseResult(*parsed); err != nil {
48+
return nil, err
49+
}
50+
51+
return &id, nil
52+
}
53+
54+
// ParseApiKeyIDInsensitively parses 'input' case-insensitively into a ApiKeyId
55+
// note: this method should only be used for API response data and not user input
56+
func ParseApiKeyIDInsensitively(input string) (*ApiKeyId, error) {
57+
parser := resourceids.NewParserFromResourceIdType(&ApiKeyId{})
58+
parsed, err := parser.Parse(input, true)
59+
if err != nil {
60+
return nil, fmt.Errorf("parsing %q: %+v", input, err)
61+
}
62+
63+
id := ApiKeyId{}
64+
if err = id.FromParseResult(*parsed); err != nil {
65+
return nil, err
66+
}
67+
68+
return &id, nil
69+
}
70+
71+
func (id *ApiKeyId) FromParseResult(input resourceids.ParseResult) error {
72+
var ok bool
73+
74+
if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok {
75+
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input)
76+
}
77+
78+
if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok {
79+
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input)
80+
}
81+
82+
if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok {
83+
return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input)
84+
}
85+
86+
if id.ApiKeyName, ok = input.Parsed["apiKeyName"]; !ok {
87+
return resourceids.NewSegmentNotSpecifiedError(id, "apiKeyName", input)
88+
}
89+
90+
return nil
91+
}
92+
93+
// ValidateApiKeyID checks that 'input' can be parsed as a Api Key ID
94+
func ValidateApiKeyID(input interface{}, key string) (warnings []string, errors []error) {
95+
v, ok := input.(string)
96+
if !ok {
97+
errors = append(errors, fmt.Errorf("expected %q to be a string", key))
98+
return
99+
}
100+
101+
if _, err := ParseApiKeyID(v); err != nil {
102+
errors = append(errors, err)
103+
}
104+
105+
return
106+
}
107+
108+
// ID returns the formatted Api Key ID
109+
func (id ApiKeyId) ID() string {
110+
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s/apiKeys/%s"
111+
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName, id.ApiKeyName)
112+
}
113+
114+
// Segments returns a slice of Resource ID Segments which comprise this Api Key ID
115+
func (id ApiKeyId) Segments() []resourceids.Segment {
116+
return []resourceids.Segment{
117+
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"),
118+
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"),
119+
resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"),
120+
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"),
121+
resourceids.StaticSegment("staticProviders", "providers", "providers"),
122+
resourceids.ResourceProviderSegment("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"),
123+
resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"),
124+
resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentName"),
125+
resourceids.StaticSegment("staticApiKeys", "apiKeys", "apiKeys"),
126+
resourceids.UserSpecifiedSegment("apiKeyName", "apiKeyName"),
127+
}
128+
}
129+
130+
// String returns a human-readable description of this Api Key ID
131+
func (id ApiKeyId) String() string {
132+
components := []string{
133+
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
134+
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
135+
fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName),
136+
fmt.Sprintf("Api Key Name: %q", id.ApiKeyName),
137+
}
138+
return fmt.Sprintf("Api Key (%s)", strings.Join(components, "\n"))
139+
}

0 commit comments

Comments
 (0)