-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hc-github-team-tf-azure
committed
Mar 19, 2024
1 parent
4f82792
commit 84974d5
Showing
632 changed files
with
49,774 additions
and
0 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
resource-manager/eventgrid/2023-12-15-preview/cacertificates/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/eventgrid/2023-12-15-preview/cacertificates` Documentation | ||
|
||
The `cacertificates` SDK allows for interaction with the Azure Resource Manager Service `eventgrid` (API Version `2023-12-15-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/eventgrid/2023-12-15-preview/cacertificates" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := cacertificates.NewCaCertificatesClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `CaCertificatesClient.CreateOrUpdate` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := cacertificates.NewCaCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "caCertificateValue") | ||
|
||
payload := cacertificates.CaCertificate{ | ||
// ... | ||
} | ||
|
||
|
||
if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `CaCertificatesClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := cacertificates.NewCaCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "caCertificateValue") | ||
|
||
if err := client.DeleteThenPoll(ctx, id); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `CaCertificatesClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := cacertificates.NewCaCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "caCertificateValue") | ||
|
||
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: `CaCertificatesClient.ListByNamespace` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := cacertificates.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") | ||
|
||
// alternatively `client.ListByNamespace(ctx, id, cacertificates.DefaultListByNamespaceOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListByNamespaceComplete(ctx, id, cacertificates.DefaultListByNamespaceOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
resource-manager/eventgrid/2023-12-15-preview/cacertificates/client.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cacertificates | ||
|
||
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 CaCertificatesClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewCaCertificatesClientWithBaseURI(sdkApi sdkEnv.Api) (*CaCertificatesClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "cacertificates", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating CaCertificatesClient: %+v", err) | ||
} | ||
|
||
return &CaCertificatesClient{ | ||
Client: client, | ||
}, nil | ||
} |
66 changes: 66 additions & 0 deletions
66
resource-manager/eventgrid/2023-12-15-preview/cacertificates/constants.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package cacertificates | ||
|
||
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 CaCertificateProvisioningState string | ||
|
||
const ( | ||
CaCertificateProvisioningStateCanceled CaCertificateProvisioningState = "Canceled" | ||
CaCertificateProvisioningStateCreating CaCertificateProvisioningState = "Creating" | ||
CaCertificateProvisioningStateDeleted CaCertificateProvisioningState = "Deleted" | ||
CaCertificateProvisioningStateDeleting CaCertificateProvisioningState = "Deleting" | ||
CaCertificateProvisioningStateFailed CaCertificateProvisioningState = "Failed" | ||
CaCertificateProvisioningStateSucceeded CaCertificateProvisioningState = "Succeeded" | ||
CaCertificateProvisioningStateUpdating CaCertificateProvisioningState = "Updating" | ||
) | ||
|
||
func PossibleValuesForCaCertificateProvisioningState() []string { | ||
return []string{ | ||
string(CaCertificateProvisioningStateCanceled), | ||
string(CaCertificateProvisioningStateCreating), | ||
string(CaCertificateProvisioningStateDeleted), | ||
string(CaCertificateProvisioningStateDeleting), | ||
string(CaCertificateProvisioningStateFailed), | ||
string(CaCertificateProvisioningStateSucceeded), | ||
string(CaCertificateProvisioningStateUpdating), | ||
} | ||
} | ||
|
||
func (s *CaCertificateProvisioningState) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseCaCertificateProvisioningState(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseCaCertificateProvisioningState(input string) (*CaCertificateProvisioningState, error) { | ||
vals := map[string]CaCertificateProvisioningState{ | ||
"canceled": CaCertificateProvisioningStateCanceled, | ||
"creating": CaCertificateProvisioningStateCreating, | ||
"deleted": CaCertificateProvisioningStateDeleted, | ||
"deleting": CaCertificateProvisioningStateDeleting, | ||
"failed": CaCertificateProvisioningStateFailed, | ||
"succeeded": CaCertificateProvisioningStateSucceeded, | ||
"updating": CaCertificateProvisioningStateUpdating, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := CaCertificateProvisioningState(input) | ||
return &out, nil | ||
} |
134 changes: 134 additions & 0 deletions
134
resource-manager/eventgrid/2023-12-15-preview/cacertificates/id_cacertificate.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package cacertificates | ||
|
||
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 = &CaCertificateId{} | ||
|
||
// CaCertificateId is a struct representing the Resource ID for a Ca Certificate | ||
type CaCertificateId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
NamespaceName string | ||
CaCertificateName string | ||
} | ||
|
||
// NewCaCertificateID returns a new CaCertificateId struct | ||
func NewCaCertificateID(subscriptionId string, resourceGroupName string, namespaceName string, caCertificateName string) CaCertificateId { | ||
return CaCertificateId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
NamespaceName: namespaceName, | ||
CaCertificateName: caCertificateName, | ||
} | ||
} | ||
|
||
// ParseCaCertificateID parses 'input' into a CaCertificateId | ||
func ParseCaCertificateID(input string) (*CaCertificateId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&CaCertificateId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := CaCertificateId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseCaCertificateIDInsensitively parses 'input' case-insensitively into a CaCertificateId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseCaCertificateIDInsensitively(input string) (*CaCertificateId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&CaCertificateId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := CaCertificateId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *CaCertificateId) 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.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) | ||
} | ||
|
||
if id.CaCertificateName, ok = input.Parsed["caCertificateName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "caCertificateName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateCaCertificateID checks that 'input' can be parsed as a Ca Certificate ID | ||
func ValidateCaCertificateID(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 := ParseCaCertificateID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Ca Certificate ID | ||
func (id CaCertificateId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventGrid/namespaces/%s/caCertificates/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.CaCertificateName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Ca Certificate ID | ||
func (id CaCertificateId) 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("staticMicrosoftEventGrid", "Microsoft.EventGrid", "Microsoft.EventGrid"), | ||
resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), | ||
resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), | ||
resourceids.StaticSegment("staticCaCertificates", "caCertificates", "caCertificates"), | ||
resourceids.UserSpecifiedSegment("caCertificateName", "caCertificateValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Ca Certificate ID | ||
func (id CaCertificateId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Namespace Name: %q", id.NamespaceName), | ||
fmt.Sprintf("Ca Certificate Name: %q", id.CaCertificateName), | ||
} | ||
return fmt.Sprintf("Ca Certificate (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.