Skip to content

Commit

Permalink
Merge pull request #892 from hashicorp/auto-pr/13165ff8
Browse files Browse the repository at this point in the history
Auto PR: Regenerating the Go SDK (b863610)
  • Loading branch information
tombuildsstuff authored Feb 21, 2024
2 parents a3ce733 + b863610 commit c2959a5
Show file tree
Hide file tree
Showing 78 changed files with 4,934 additions and 0 deletions.
55 changes: 55 additions & 0 deletions resource-manager/nginx/2024-01-01-preview/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package v2024_01_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-01-01-preview/nginxcertificate"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-01-01-preview/nginxconfiguration"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-01-01-preview/nginxconfigurationanalysis"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-01-01-preview/nginxdeployment"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

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

func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
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{
NginxCertificate: nginxCertificateClient,
NginxConfiguration: nginxConfigurationClient,
NginxConfigurationAnalysis: nginxConfigurationAnalysisClient,
NginxDeployment: nginxDeploymentClient,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

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

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


### Client Initialization

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


### Example Usage: `NginxCertificateClient.CertificatesCreateOrUpdate`

```go
ctx := context.TODO()
id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue")

payload := nginxcertificate.NginxCertificate{
// ...
}


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


### Example Usage: `NginxCertificateClient.CertificatesDelete`

```go
ctx := context.TODO()
id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue")

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


### Example Usage: `NginxCertificateClient.CertificatesGet`

```go
ctx := context.TODO()
id := nginxcertificate.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nginxDeploymentValue", "certificateValue")

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


### Example Usage: `NginxCertificateClient.CertificatesList`

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

// alternatively `client.CertificatesList(ctx, id)` can be used to do batched pagination
items, err := client.CertificatesListComplete(ctx, id)
if err != nil {
// handle the error
}
for _, item := range items {
// do something
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package nginxcertificate

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

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

return &NginxCertificateClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package nginxcertificate

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 (
ProvisioningStateAccepted ProvisioningState = "Accepted"
ProvisioningStateCanceled ProvisioningState = "Canceled"
ProvisioningStateCreating ProvisioningState = "Creating"
ProvisioningStateDeleted ProvisioningState = "Deleted"
ProvisioningStateDeleting ProvisioningState = "Deleting"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateNotSpecified ProvisioningState = "NotSpecified"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
ProvisioningStateUpdating ProvisioningState = "Updating"
)

func PossibleValuesForProvisioningState() []string {
return []string{
string(ProvisioningStateAccepted),
string(ProvisioningStateCanceled),
string(ProvisioningStateCreating),
string(ProvisioningStateDeleted),
string(ProvisioningStateDeleting),
string(ProvisioningStateFailed),
string(ProvisioningStateNotSpecified),
string(ProvisioningStateSucceeded),
string(ProvisioningStateUpdating),
}
}

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{
"accepted": ProvisioningStateAccepted,
"canceled": ProvisioningStateCanceled,
"creating": ProvisioningStateCreating,
"deleted": ProvisioningStateDeleted,
"deleting": ProvisioningStateDeleting,
"failed": ProvisioningStateFailed,
"notspecified": ProvisioningStateNotSpecified,
"succeeded": ProvisioningStateSucceeded,
"updating": ProvisioningStateUpdating,
}
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,134 @@
package nginxcertificate

import (
"fmt"
"strings"

"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.

var _ resourceids.ResourceId = &CertificateId{}

// CertificateId is a struct representing the Resource ID for a Certificate
type CertificateId struct {
SubscriptionId string
ResourceGroupName string
NginxDeploymentName string
CertificateName string
}

// NewCertificateID returns a new CertificateId struct
func NewCertificateID(subscriptionId string, resourceGroupName string, nginxDeploymentName string, certificateName string) CertificateId {
return CertificateId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
NginxDeploymentName: nginxDeploymentName,
CertificateName: certificateName,
}
}

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

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

return &id, nil
}

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

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

return &id, nil
}

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

return nil
}

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

return
}

// ID returns the formatted Certificate ID
func (id CertificateId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Nginx.NginxPlus/nginxDeployments/%s/certificates/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NginxDeploymentName, id.CertificateName)
}

// Segments returns a slice of Resource ID Segments which comprise this Certificate ID
func (id CertificateId) 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", "nginxDeploymentValue"),
resourceids.StaticSegment("staticCertificates", "certificates", "certificates"),
resourceids.UserSpecifiedSegment("certificateName", "certificateValue"),
}
}

// String returns a human-readable description of this Certificate ID
func (id CertificateId) 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("Certificate Name: %q", id.CertificateName),
}
return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n"))
}
Loading

0 comments on commit c2959a5

Please sign in to comment.