Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto PR: Regenerating the Go SDK (02a11de0203a9af20fbc2fc3640bf80f284cfe97) #1103

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
```
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
}
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
}
Loading
Loading