Skip to content

Commit

Permalink
Updating based on 6067c8098
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Oct 23, 2024
1 parent 4712040 commit 520ef06
Show file tree
Hide file tree
Showing 105 changed files with 6,562 additions and 0 deletions.
64 changes: 64 additions & 0 deletions resource-manager/nginx/2024-09-01-preview/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package v2024_09_01_preview

// 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/nginx/2024-09-01-preview/nginxapikey"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxcertificate"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxconfiguration"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxconfigurationanalysis"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxdeployment"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

type Client struct {
NginxApiKey *nginxapikey.NginxApiKeyClient
NginxCertificate *nginxcertificate.NginxCertificateClient
NginxConfiguration *nginxconfiguration.NginxConfigurationClient
NginxConfigurationAnalysis *nginxconfigurationanalysis.NginxConfigurationAnalysisClient
NginxDeployment *nginxdeployment.NginxDeploymentClient
}

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

nginxCertificateClient, err := nginxcertificate.NewNginxCertificateClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NginxCertificate client: %+v", err)
}
configureFunc(nginxCertificateClient.Client)

nginxConfigurationAnalysisClient, err := nginxconfigurationanalysis.NewNginxConfigurationAnalysisClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NginxConfigurationAnalysis client: %+v", err)
}
configureFunc(nginxConfigurationAnalysisClient.Client)

nginxConfigurationClient, err := nginxconfiguration.NewNginxConfigurationClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NginxConfiguration client: %+v", err)
}
configureFunc(nginxConfigurationClient.Client)

nginxDeploymentClient, err := nginxdeployment.NewNginxDeploymentClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building NginxDeployment client: %+v", err)
}
configureFunc(nginxDeploymentClient.Client)

return &Client{
NginxApiKey: nginxApiKeyClient,
NginxCertificate: nginxCertificateClient,
NginxConfiguration: nginxConfigurationClient,
NginxConfigurationAnalysis: nginxConfigurationAnalysisClient,
NginxDeployment: nginxDeploymentClient,
}, nil
}
90 changes: 90 additions & 0 deletions resource-manager/nginx/2024-09-01-preview/nginxapikey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxapikey` Documentation

The `nginxapikey` SDK allows for interaction with Azure Resource Manager `nginx` (API Version `2024-09-01-preview`).

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/nginx/2024-09-01-preview/nginxapikey"
```


### Client Initialization

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


### Example Usage: `NginxApiKeyClient.ApiKeysCreateOrUpdate`

```go
ctx := context.TODO()
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")

payload := nginxapikey.NginxDeploymentApiKeyRequest{
// ...
}


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


### Example Usage: `NginxApiKeyClient.ApiKeysDelete`

```go
ctx := context.TODO()
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")

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


### Example Usage: `NginxApiKeyClient.ApiKeysGet`

```go
ctx := context.TODO()
id := nginxapikey.NewApiKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentName", "apiKeyName")

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


### Example Usage: `NginxApiKeyClient.ApiKeysList`

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

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

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

func NewNginxApiKeyClientWithBaseURI(sdkApi sdkEnv.Api) (*NginxApiKeyClient, error) {
client, err := resourcemanager.NewClient(sdkApi, "nginxapikey", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating NginxApiKeyClient: %+v", err)
}

return &NginxApiKeyClient{
Client: client,
}, nil
}
139 changes: 139 additions & 0 deletions resource-manager/nginx/2024-09-01-preview/nginxapikey/id_apikey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package nginxapikey

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(&ApiKeyId{})
}

var _ resourceids.ResourceId = &ApiKeyId{}

// ApiKeyId is a struct representing the Resource ID for a Api Key
type ApiKeyId struct {
SubscriptionId string
ResourceGroupName string
NginxDeploymentName string
ApiKeyName string
}

// NewApiKeyID returns a new ApiKeyId struct
func NewApiKeyID(subscriptionId string, resourceGroupName string, nginxDeploymentName string, apiKeyName string) ApiKeyId {
return ApiKeyId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
NginxDeploymentName: nginxDeploymentName,
ApiKeyName: apiKeyName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

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

return nil
}

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

return
}

// ID returns the formatted Api Key ID
func (id ApiKeyId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s/apiKeys/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName, id.ApiKeyName)
}

// Segments returns a slice of Resource ID Segments which comprise this Api Key ID
func (id ApiKeyId) 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("staticNginxNginxPlus", "Nginx.NginxPlus", "Nginx.NginxPlus"),
resourceids.StaticSegment("staticNginxDeployments", "nginxDeployments", "nginxDeployments"),
resourceids.UserSpecifiedSegment("nginxDeploymentName", "nginxDeploymentName"),
resourceids.StaticSegment("staticApiKeys", "apiKeys", "apiKeys"),
resourceids.UserSpecifiedSegment("apiKeyName", "apiKeyName"),
}
}

// String returns a human-readable description of this Api Key ID
func (id ApiKeyId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Nginx Deployment Name: %q", id.NginxDeploymentName),
fmt.Sprintf("Api Key Name: %q", id.ApiKeyName),
}
return fmt.Sprintf("Api Key (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit 520ef06

Please sign in to comment.