-
Notifications
You must be signed in to change notification settings - Fork 50
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
Oct 17, 2024
1 parent
65c18a6
commit 02a11de
Showing
42 changed files
with
3,184 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
resource-manager/codesigning/2024-09-30-preview/certificateprofiles/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,103 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles` Documentation | ||
|
||
The `certificateprofiles` SDK allows for interaction with Azure Resource Manager `codesigning` (API Version `2024-09-30-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/codesigning/2024-09-30-preview/certificateprofiles" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := certificateprofiles.NewCertificateProfilesClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `CertificateProfilesClient.Create` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := certificateprofiles.NewCertificateProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName", "certificateProfileName") | ||
|
||
payload := certificateprofiles.CertificateProfile{ | ||
// ... | ||
} | ||
|
||
|
||
if err := client.CreateThenPoll(ctx, id, payload); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `CertificateProfilesClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := certificateprofiles.NewCertificateProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName", "certificateProfileName") | ||
|
||
if err := client.DeleteThenPoll(ctx, id); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `CertificateProfilesClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := certificateprofiles.NewCertificateProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName", "certificateProfileName") | ||
|
||
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: `CertificateProfilesClient.ListByCodeSigningAccount` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := certificateprofiles.NewCodeSigningAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName") | ||
|
||
// alternatively `client.ListByCodeSigningAccount(ctx, id)` can be used to do batched pagination | ||
items, err := client.ListByCodeSigningAccountComplete(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `CertificateProfilesClient.RevokeCertificate` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := certificateprofiles.NewCertificateProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName", "certificateProfileName") | ||
|
||
payload := certificateprofiles.RevokeCertificate{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.RevokeCertificate(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` |
26 changes: 26 additions & 0 deletions
26
resource-manager/codesigning/2024-09-30-preview/certificateprofiles/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 certificateprofiles | ||
|
||
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 CertificateProfilesClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewCertificateProfilesClientWithBaseURI(sdkApi sdkEnv.Api) (*CertificateProfilesClient, error) { | ||
client, err := resourcemanager.NewClient(sdkApi, "certificateprofiles", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating CertificateProfilesClient: %+v", err) | ||
} | ||
|
||
return &CertificateProfilesClient{ | ||
Client: client, | ||
}, nil | ||
} |
245 changes: 245 additions & 0 deletions
245
resource-manager/codesigning/2024-09-30-preview/certificateprofiles/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,245 @@ | ||
package certificateprofiles | ||
|
||
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 CertificateProfileStatus string | ||
|
||
const ( | ||
CertificateProfileStatusActive CertificateProfileStatus = "Active" | ||
CertificateProfileStatusDisabled CertificateProfileStatus = "Disabled" | ||
CertificateProfileStatusSuspended CertificateProfileStatus = "Suspended" | ||
) | ||
|
||
func PossibleValuesForCertificateProfileStatus() []string { | ||
return []string{ | ||
string(CertificateProfileStatusActive), | ||
string(CertificateProfileStatusDisabled), | ||
string(CertificateProfileStatusSuspended), | ||
} | ||
} | ||
|
||
func (s *CertificateProfileStatus) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseCertificateProfileStatus(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseCertificateProfileStatus(input string) (*CertificateProfileStatus, error) { | ||
vals := map[string]CertificateProfileStatus{ | ||
"active": CertificateProfileStatusActive, | ||
"disabled": CertificateProfileStatusDisabled, | ||
"suspended": CertificateProfileStatusSuspended, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := CertificateProfileStatus(input) | ||
return &out, nil | ||
} | ||
|
||
type CertificateStatus string | ||
|
||
const ( | ||
CertificateStatusActive CertificateStatus = "Active" | ||
CertificateStatusExpired CertificateStatus = "Expired" | ||
CertificateStatusRevoked CertificateStatus = "Revoked" | ||
) | ||
|
||
func PossibleValuesForCertificateStatus() []string { | ||
return []string{ | ||
string(CertificateStatusActive), | ||
string(CertificateStatusExpired), | ||
string(CertificateStatusRevoked), | ||
} | ||
} | ||
|
||
func (s *CertificateStatus) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseCertificateStatus(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseCertificateStatus(input string) (*CertificateStatus, error) { | ||
vals := map[string]CertificateStatus{ | ||
"active": CertificateStatusActive, | ||
"expired": CertificateStatusExpired, | ||
"revoked": CertificateStatusRevoked, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := CertificateStatus(input) | ||
return &out, nil | ||
} | ||
|
||
type ProfileType string | ||
|
||
const ( | ||
ProfileTypePrivateTrust ProfileType = "PrivateTrust" | ||
ProfileTypePrivateTrustCIPolicy ProfileType = "PrivateTrustCIPolicy" | ||
ProfileTypePublicTrust ProfileType = "PublicTrust" | ||
ProfileTypePublicTrustTest ProfileType = "PublicTrustTest" | ||
ProfileTypeVBSEnclave ProfileType = "VBSEnclave" | ||
) | ||
|
||
func PossibleValuesForProfileType() []string { | ||
return []string{ | ||
string(ProfileTypePrivateTrust), | ||
string(ProfileTypePrivateTrustCIPolicy), | ||
string(ProfileTypePublicTrust), | ||
string(ProfileTypePublicTrustTest), | ||
string(ProfileTypeVBSEnclave), | ||
} | ||
} | ||
|
||
func (s *ProfileType) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseProfileType(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseProfileType(input string) (*ProfileType, error) { | ||
vals := map[string]ProfileType{ | ||
"privatetrust": ProfileTypePrivateTrust, | ||
"privatetrustcipolicy": ProfileTypePrivateTrustCIPolicy, | ||
"publictrust": ProfileTypePublicTrust, | ||
"publictrusttest": ProfileTypePublicTrustTest, | ||
"vbsenclave": ProfileTypeVBSEnclave, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := ProfileType(input) | ||
return &out, nil | ||
} | ||
|
||
type ProvisioningState string | ||
|
||
const ( | ||
ProvisioningStateAccepted ProvisioningState = "Accepted" | ||
ProvisioningStateCanceled ProvisioningState = "Canceled" | ||
ProvisioningStateDeleting ProvisioningState = "Deleting" | ||
ProvisioningStateFailed ProvisioningState = "Failed" | ||
ProvisioningStateSucceeded ProvisioningState = "Succeeded" | ||
ProvisioningStateUpdating ProvisioningState = "Updating" | ||
) | ||
|
||
func PossibleValuesForProvisioningState() []string { | ||
return []string{ | ||
string(ProvisioningStateAccepted), | ||
string(ProvisioningStateCanceled), | ||
string(ProvisioningStateDeleting), | ||
string(ProvisioningStateFailed), | ||
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, | ||
"deleting": ProvisioningStateDeleting, | ||
"failed": ProvisioningStateFailed, | ||
"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 | ||
} | ||
|
||
type RevocationStatus string | ||
|
||
const ( | ||
RevocationStatusFailed RevocationStatus = "Failed" | ||
RevocationStatusInProgress RevocationStatus = "InProgress" | ||
RevocationStatusSucceeded RevocationStatus = "Succeeded" | ||
) | ||
|
||
func PossibleValuesForRevocationStatus() []string { | ||
return []string{ | ||
string(RevocationStatusFailed), | ||
string(RevocationStatusInProgress), | ||
string(RevocationStatusSucceeded), | ||
} | ||
} | ||
|
||
func (s *RevocationStatus) UnmarshalJSON(bytes []byte) error { | ||
var decoded string | ||
if err := json.Unmarshal(bytes, &decoded); err != nil { | ||
return fmt.Errorf("unmarshaling: %+v", err) | ||
} | ||
out, err := parseRevocationStatus(decoded) | ||
if err != nil { | ||
return fmt.Errorf("parsing %q: %+v", decoded, err) | ||
} | ||
*s = *out | ||
return nil | ||
} | ||
|
||
func parseRevocationStatus(input string) (*RevocationStatus, error) { | ||
vals := map[string]RevocationStatus{ | ||
"failed": RevocationStatusFailed, | ||
"inprogress": RevocationStatusInProgress, | ||
"succeeded": RevocationStatusSucceeded, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := RevocationStatus(input) | ||
return &out, nil | ||
} |
Oops, something went wrong.