diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index fd8d38ae89d5..595fe1905991 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -332,6 +332,9 @@ service/systemcentervirtualmachinemanager: service/traffic-manager: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_traffic_manager_((.|\n)*)###' +service/trustedsigning: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_trusted_signing_account((.|\n)*)###' + service/video-indexer: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_video_indexer_account((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index ed1d793fc197..e41a1c7e9ed0 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -555,6 +555,11 @@ service/traffic-manager: - any-glob-to-any-file: - internal/services/trafficmanager/**/* +service/trustedsigning: +- changed-files: + - any-glob-to-any-file: + - internal/services/codesigning/**/* + service/video-indexer: - changed-files: - any-glob-to-any-file: diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 948ed378b7d4..de2a29b83e6c 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -124,6 +124,7 @@ var services = mapOf( "synapse" to "Synapse", "systemcentervirtualmachinemanager" to "System Center Virtual Machine Manager", "trafficmanager" to "Traffic Manager", + "codesigning" to "Trusted Signing", "vmware" to "VMware", "videoindexer" to "VideoIndexer", "voiceservices" to "Voice Services", diff --git a/internal/clients/client.go b/internal/clients/client.go index f74485529fff..071e576b78cd 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -43,6 +43,7 @@ import ( blueprints "github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints/client" bot "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/client" cdn "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client" + codesigning "github.com/hashicorp/terraform-provider-azurerm/internal/services/codesigning/client" cognitiveServices "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client" communication "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client" compute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client" @@ -175,6 +176,7 @@ type Client struct { Blueprints *blueprints.Client Bot *bot.Client Cdn *cdn.Client + CodeSigning *codesigning.Client Cognitive *cognitiveServices.Client Communication *communication.Client Compute *compute.Client @@ -349,6 +351,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error return fmt.Errorf("building clients for Bot: %+v", err) } client.Cdn = cdn.NewClient(o) + if client.CodeSigning, err = codesigning.NewClient(o); err != nil { + return fmt.Errorf("building clients for Code Signing: %+v", err) + } if client.Cognitive, err = cognitiveServices.NewClient(o); err != nil { return fmt.Errorf("building clients for Cognitive: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index 719dd071ff89..29ac15969497 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -24,6 +24,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints" "github.com/hashicorp/terraform-provider-azurerm/internal/services/bot" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/codesigning" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive" "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute" @@ -149,6 +150,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { azurestackhci.Registration{}, batch.Registration{}, bot.Registration{}, + codesigning.Registration{}, cognitive.Registration{}, communication.Registration{}, compute.Registration{}, diff --git a/internal/services/codesigning/client/client.go b/internal/services/codesigning/client/client.go new file mode 100644 index 000000000000..a5288d8ee7ff --- /dev/null +++ b/internal/services/codesigning/client/client.go @@ -0,0 +1,27 @@ +package client + +import ( + "fmt" + + codesigning_v2024_09_30_preview "github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + Client codesigning_v2024_09_30_preview.Client +} + +func NewClient(o *common.ClientOptions) (*Client, error) { + V20240930previewClient, err := codesigning_v2024_09_30_preview.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building client for codesigning v20240930preview: %+v", err) + } + + return &Client{ + Client: *V20240930previewClient, + }, nil +} diff --git a/internal/services/codesigning/registration.go b/internal/services/codesigning/registration.go new file mode 100644 index 000000000000..cb815924eb16 --- /dev/null +++ b/internal/services/codesigning/registration.go @@ -0,0 +1,40 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package codesigning + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistration = Registration{} + +func (r Registration) AssociatedGitHubLabel() string { + return "service/trustedsigning" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Trusted Signing" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Trusted Signing", + } +} + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + TrustedSigningAccountResource{}, + } +} diff --git a/internal/services/codesigning/trusted_signing_account_resource.go b/internal/services/codesigning/trusted_signing_account_resource.go new file mode 100644 index 000000000000..bc44b3319890 --- /dev/null +++ b/internal/services/codesigning/trusted_signing_account_resource.go @@ -0,0 +1,222 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package codesigning + +import ( + "context" + "fmt" + "regexp" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +type TrustedSigningAccountModel struct { + Name string `tfschema:"name"` + Location string `tfschema:"location"` + ResourceGroupName string `tfschema:"resource_group_name"` + AccountUri string `tfschema:"account_uri"` + SkuName string `tfschema:"sku_name"` + Tags map[string]string `tfschema:"tags"` +} + +type TrustedSigningAccountResource struct{} + +var _ sdk.Resource = (*TrustedSigningAccountResource)(nil) + +func (m TrustedSigningAccountResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringLenBetween(3, 24), + validation.StringMatch( + regexp.MustCompile("^[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)*$"), + "An account's name must be between 3-24 alphanumeric characters. The name must begin with a letter, end with a letter or digit, and not contain consecutive hyphens.", + ), + ), + }, + + "location": commonschema.Location(), + + "resource_group_name": commonschema.ResourceGroupName(), + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice( + codesigningaccounts.PossibleValuesForSkuName(), + false), + }, + + "tags": commonschema.Tags(), + } +} + +func (m TrustedSigningAccountResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "account_uri": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (m TrustedSigningAccountResource) ModelObject() interface{} { + return &TrustedSigningAccountModel{} +} + +func (m TrustedSigningAccountResource) ResourceType() string { + return "azurerm_trusted_signing_account" +} + +func (m TrustedSigningAccountResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) error { + client := meta.Client.CodeSigning.Client.CodeSigningAccounts + + var model TrustedSigningAccountModel + if err := meta.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + subscriptionID := meta.Client.Account.SubscriptionId + id := codesigningaccounts.NewCodeSigningAccountID(subscriptionID, model.ResourceGroupName, model.Name) + existing, err := client.Get(ctx, id) + if !response.WasNotFound(existing.HttpResponse) { + if err != nil { + return fmt.Errorf("retrieving %s: %v", id, err) + } + return meta.ResourceRequiresImport(m.ResourceType(), id) + } + + req := codesigningaccounts.CodeSigningAccount{ + Name: &model.Name, + Location: location.Normalize(model.Location), + Tags: &model.Tags, + Properties: &codesigningaccounts.CodeSigningAccountProperties{ + Sku: &codesigningaccounts.AccountSku{ + Name: codesigningaccounts.SkuName(model.SkuName), + }, + }, + } + + err = client.CreateThenPoll(ctx, id, req) + if err != nil { + return fmt.Errorf("creating %s: %v", id, err) + } + + meta.SetID(id) + return nil + }, + } +} + +func (m TrustedSigningAccountResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) error { + client := meta.Client.CodeSigning.Client.CodeSigningAccounts + + id, err := codesigningaccounts.ParseCodeSigningAccountID(meta.ResourceData.Id()) + if err != nil { + return err + } + + result, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + output := TrustedSigningAccountModel{ + Name: id.CodeSigningAccountName, + ResourceGroupName: id.ResourceGroupName, + } + + if model := result.Model; model != nil { + output.Location = location.Normalize(model.Location) + output.Tags = pointer.From(model.Tags) + + if prop := model.Properties; prop != nil { + output.AccountUri = pointer.From(prop.AccountUri) + if sku := prop.Sku; sku != nil { + output.SkuName = string(sku.Name) + } + } + } + + return meta.Encode(&output) + }, + } +} + +func (m TrustedSigningAccountResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 10 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) (err error) { + client := meta.Client.CodeSigning.Client.CodeSigningAccounts + id, err := codesigningaccounts.ParseCodeSigningAccountID(meta.ResourceData.Id()) + if err != nil { + return err + } + var model TrustedSigningAccountModel + if err = meta.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + var patch codesigningaccounts.CodeSigningAccountPatch + if meta.ResourceData.HasChange("sku_name") { + patch.Properties = pointer.To(codesigningaccounts.CodeSigningAccountPatchProperties{ + Sku: pointer.To(codesigningaccounts.AccountSkuPatch{ + Name: pointer.To(codesigningaccounts.SkuName(model.SkuName)), + }), + }) + } + if meta.ResourceData.HasChange("tags") { + patch.Tags = pointer.To(model.Tags) + } + + if err = client.UpdateThenPoll(ctx, *id, patch); err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + + return nil + }, + } +} + +func (m TrustedSigningAccountResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 10 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) error { + client := meta.Client.CodeSigning.Client.CodeSigningAccounts + + id, err := codesigningaccounts.ParseCodeSigningAccountID(meta.ResourceData.Id()) + if err != nil { + return err + } + + meta.Logger.Infof("deleting %s", id) + + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %v", id, err) + } + return nil + }, + } +} + +func (m TrustedSigningAccountResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return codesigningaccounts.ValidateCodeSigningAccountID +} diff --git a/internal/services/codesigning/trusted_signing_account_resource_test.go b/internal/services/codesigning/trusted_signing_account_resource_test.go new file mode 100644 index 000000000000..d2cf7037dc63 --- /dev/null +++ b/internal/services/codesigning/trusted_signing_account_resource_test.go @@ -0,0 +1,130 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package codesigning_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/codesigning" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type TrustedSigningAccountResource struct{} + +func (a TrustedSigningAccountResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := codesigningaccounts.ParseCodeSigningAccountID(state.ID) + if err != nil { + return nil, err + } + resp, err := client.CodeSigning.Client.CodeSigningAccounts.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return pointer.To(resp.Model != nil), nil +} + +func TestAccTrustedSigningAccount_basic(t *testing.T) { + data := acceptance.BuildTestData(t, codesigning.TrustedSigningAccountResource{}.ResourceType(), "test") + r := TrustedSigningAccountResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccTrustedSigningAccount_update(t *testing.T) { + data := acceptance.BuildTestData(t, codesigning.TrustedSigningAccountResource{}.ResourceType(), "test") + r := TrustedSigningAccountResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccTrustedSigningAccount_complete(t *testing.T) { + data := acceptance.BuildTestData(t, codesigning.TrustedSigningAccountResource{}.ResourceType(), "test") + r := TrustedSigningAccountResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (a TrustedSigningAccountResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_trusted_signing_account" "test" { + name = "acctest-%[2]s" + location = "%[3]s" + resource_group_name = azurerm_resource_group.test.name + sku_name = "Basic" +} +`, a.template(data), data.RandomString, data.Locations.Primary) +} + +func (a TrustedSigningAccountResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_trusted_signing_account" "test" { + name = "acctest-%[2]s" + location = "%[3]s" + resource_group_name = azurerm_resource_group.test.name + sku_name = "Premium" + tags = { + key = "example" + } +} +`, a.template(data), data.RandomString, data.Locations.Primary) +} + +func (a TrustedSigningAccountResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/README.md new file mode 100644 index 000000000000..20a2cc90ad88 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/README.md @@ -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 +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/client.go new file mode 100644 index 000000000000..e559a6f92422 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/client.go @@ -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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/constants.go new file mode 100644 index 000000000000..e3191e196a96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/constants.go @@ -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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_certificateprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_certificateprofile.go new file mode 100644 index 000000000000..dbf303fd6f40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_certificateprofile.go @@ -0,0 +1,139 @@ +package certificateprofiles + +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(&CertificateProfileId{}) +} + +var _ resourceids.ResourceId = &CertificateProfileId{} + +// CertificateProfileId is a struct representing the Resource ID for a Certificate Profile +type CertificateProfileId struct { + SubscriptionId string + ResourceGroupName string + CodeSigningAccountName string + CertificateProfileName string +} + +// NewCertificateProfileID returns a new CertificateProfileId struct +func NewCertificateProfileID(subscriptionId string, resourceGroupName string, codeSigningAccountName string, certificateProfileName string) CertificateProfileId { + return CertificateProfileId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CodeSigningAccountName: codeSigningAccountName, + CertificateProfileName: certificateProfileName, + } +} + +// ParseCertificateProfileID parses 'input' into a CertificateProfileId +func ParseCertificateProfileID(input string) (*CertificateProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateProfileId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCertificateProfileIDInsensitively parses 'input' case-insensitively into a CertificateProfileId +// note: this method should only be used for API response data and not user input +func ParseCertificateProfileIDInsensitively(input string) (*CertificateProfileId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateProfileId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateProfileId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateProfileId) 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.CodeSigningAccountName, ok = input.Parsed["codeSigningAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeSigningAccountName", input) + } + + if id.CertificateProfileName, ok = input.Parsed["certificateProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateProfileName", input) + } + + return nil +} + +// ValidateCertificateProfileID checks that 'input' can be parsed as a Certificate Profile ID +func ValidateCertificateProfileID(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 := ParseCertificateProfileID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate Profile ID +func (id CertificateProfileId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CodeSigning/codeSigningAccounts/%s/certificateProfiles/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CodeSigningAccountName, id.CertificateProfileName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate Profile ID +func (id CertificateProfileId) 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("staticMicrosoftCodeSigning", "Microsoft.CodeSigning", "Microsoft.CodeSigning"), + resourceids.StaticSegment("staticCodeSigningAccounts", "codeSigningAccounts", "codeSigningAccounts"), + resourceids.UserSpecifiedSegment("codeSigningAccountName", "codeSigningAccountName"), + resourceids.StaticSegment("staticCertificateProfiles", "certificateProfiles", "certificateProfiles"), + resourceids.UserSpecifiedSegment("certificateProfileName", "certificateProfileName"), + } +} + +// String returns a human-readable description of this Certificate Profile ID +func (id CertificateProfileId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Code Signing Account Name: %q", id.CodeSigningAccountName), + fmt.Sprintf("Certificate Profile Name: %q", id.CertificateProfileName), + } + return fmt.Sprintf("Certificate Profile (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_codesigningaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_codesigningaccount.go new file mode 100644 index 000000000000..e62cccb18c10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/id_codesigningaccount.go @@ -0,0 +1,130 @@ +package certificateprofiles + +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(&CodeSigningAccountId{}) +} + +var _ resourceids.ResourceId = &CodeSigningAccountId{} + +// CodeSigningAccountId is a struct representing the Resource ID for a Code Signing Account +type CodeSigningAccountId struct { + SubscriptionId string + ResourceGroupName string + CodeSigningAccountName string +} + +// NewCodeSigningAccountID returns a new CodeSigningAccountId struct +func NewCodeSigningAccountID(subscriptionId string, resourceGroupName string, codeSigningAccountName string) CodeSigningAccountId { + return CodeSigningAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CodeSigningAccountName: codeSigningAccountName, + } +} + +// ParseCodeSigningAccountID parses 'input' into a CodeSigningAccountId +func ParseCodeSigningAccountID(input string) (*CodeSigningAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&CodeSigningAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CodeSigningAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCodeSigningAccountIDInsensitively parses 'input' case-insensitively into a CodeSigningAccountId +// note: this method should only be used for API response data and not user input +func ParseCodeSigningAccountIDInsensitively(input string) (*CodeSigningAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&CodeSigningAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CodeSigningAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeSigningAccountId) 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.CodeSigningAccountName, ok = input.Parsed["codeSigningAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeSigningAccountName", input) + } + + return nil +} + +// ValidateCodeSigningAccountID checks that 'input' can be parsed as a Code Signing Account ID +func ValidateCodeSigningAccountID(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 := ParseCodeSigningAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Code Signing Account ID +func (id CodeSigningAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CodeSigning/codeSigningAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CodeSigningAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Code Signing Account ID +func (id CodeSigningAccountId) 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("staticMicrosoftCodeSigning", "Microsoft.CodeSigning", "Microsoft.CodeSigning"), + resourceids.StaticSegment("staticCodeSigningAccounts", "codeSigningAccounts", "codeSigningAccounts"), + resourceids.UserSpecifiedSegment("codeSigningAccountName", "codeSigningAccountName"), + } +} + +// String returns a human-readable description of this Code Signing Account ID +func (id CodeSigningAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Code Signing Account Name: %q", id.CodeSigningAccountName), + } + return fmt.Sprintf("Code Signing Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_create.go new file mode 100644 index 000000000000..2cca3685e90c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_create.go @@ -0,0 +1,75 @@ +package certificateprofiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CertificateProfile +} + +// Create ... +func (c CertificateProfilesClient) Create(ctx context.Context, id CertificateProfileId, input CertificateProfile) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c CertificateProfilesClient) CreateThenPoll(ctx context.Context, id CertificateProfileId, input CertificateProfile) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_delete.go new file mode 100644 index 000000000000..058788bfe34c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_delete.go @@ -0,0 +1,70 @@ +package certificateprofiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CertificateProfilesClient) Delete(ctx context.Context, id CertificateProfileId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CertificateProfilesClient) DeleteThenPoll(ctx context.Context, id CertificateProfileId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_get.go new file mode 100644 index 000000000000..3f45ab39998f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_get.go @@ -0,0 +1,53 @@ +package certificateprofiles + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CertificateProfile +} + +// Get ... +func (c CertificateProfilesClient) Get(ctx context.Context, id CertificateProfileId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CertificateProfile + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_listbycodesigningaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_listbycodesigningaccount.go new file mode 100644 index 000000000000..7c89789a7983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_listbycodesigningaccount.go @@ -0,0 +1,105 @@ +package certificateprofiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByCodeSigningAccountOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CertificateProfile +} + +type ListByCodeSigningAccountCompleteResult struct { + LatestHttpResponse *http.Response + Items []CertificateProfile +} + +type ListByCodeSigningAccountCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCodeSigningAccountCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCodeSigningAccount ... +func (c CertificateProfilesClient) ListByCodeSigningAccount(ctx context.Context, id CodeSigningAccountId) (result ListByCodeSigningAccountOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCodeSigningAccountCustomPager{}, + Path: fmt.Sprintf("%s/certificateProfiles", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CertificateProfile `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByCodeSigningAccountComplete retrieves all the results into a single object +func (c CertificateProfilesClient) ListByCodeSigningAccountComplete(ctx context.Context, id CodeSigningAccountId) (ListByCodeSigningAccountCompleteResult, error) { + return c.ListByCodeSigningAccountCompleteMatchingPredicate(ctx, id, CertificateProfileOperationPredicate{}) +} + +// ListByCodeSigningAccountCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CertificateProfilesClient) ListByCodeSigningAccountCompleteMatchingPredicate(ctx context.Context, id CodeSigningAccountId, predicate CertificateProfileOperationPredicate) (result ListByCodeSigningAccountCompleteResult, err error) { + items := make([]CertificateProfile, 0) + + resp, err := c.ListByCodeSigningAccount(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByCodeSigningAccountCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_revokecertificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_revokecertificate.go new file mode 100644 index 000000000000..b24ef796a1d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/method_revokecertificate.go @@ -0,0 +1,51 @@ +package certificateprofiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RevokeCertificateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RevokeCertificate ... +func (c CertificateProfilesClient) RevokeCertificate(ctx context.Context, id CertificateProfileId, input RevokeCertificate) (result RevokeCertificateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/revokeCertificate", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificate.go new file mode 100644 index 000000000000..ab301ee146e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificate.go @@ -0,0 +1,15 @@ +package certificateprofiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Certificate struct { + CreatedDate *string `json:"createdDate,omitempty"` + EnhancedKeyUsage *string `json:"enhancedKeyUsage,omitempty"` + ExpiryDate *string `json:"expiryDate,omitempty"` + Revocation *Revocation `json:"revocation,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` + Status *CertificateStatus `json:"status,omitempty"` + SubjectName *string `json:"subjectName,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofile.go new file mode 100644 index 000000000000..2e47218eb895 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofile.go @@ -0,0 +1,16 @@ +package certificateprofiles + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProfile struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CertificateProfileProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofileproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofileproperties.go new file mode 100644 index 000000000000..06390d807eba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_certificateprofileproperties.go @@ -0,0 +1,17 @@ +package certificateprofiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProfileProperties struct { + Certificates *[]Certificate `json:"certificates,omitempty"` + IdentityValidationId string `json:"identityValidationId"` + IncludeCity *bool `json:"includeCity,omitempty"` + IncludeCountry *bool `json:"includeCountry,omitempty"` + IncludePostalCode *bool `json:"includePostalCode,omitempty"` + IncludeState *bool `json:"includeState,omitempty"` + IncludeStreetAddress *bool `json:"includeStreetAddress,omitempty"` + ProfileType ProfileType `json:"profileType"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Status *CertificateProfileStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revocation.go new file mode 100644 index 000000000000..1cd45d74417a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revocation.go @@ -0,0 +1,43 @@ +package certificateprofiles + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Revocation struct { + EffectiveAt *string `json:"effectiveAt,omitempty"` + FailureReason *string `json:"failureReason,omitempty"` + Reason *string `json:"reason,omitempty"` + Remarks *string `json:"remarks,omitempty"` + RequestedAt *string `json:"requestedAt,omitempty"` + Status *RevocationStatus `json:"status,omitempty"` +} + +func (o *Revocation) GetEffectiveAtAsTime() (*time.Time, error) { + if o.EffectiveAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EffectiveAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *Revocation) SetEffectiveAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EffectiveAt = &formatted +} + +func (o *Revocation) GetRequestedAtAsTime() (*time.Time, error) { + if o.RequestedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RequestedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *Revocation) SetRequestedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RequestedAt = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revokecertificate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revokecertificate.go new file mode 100644 index 000000000000..b8bea125a782 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/model_revokecertificate.go @@ -0,0 +1,27 @@ +package certificateprofiles + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RevokeCertificate struct { + EffectiveAt string `json:"effectiveAt"` + Reason string `json:"reason"` + Remarks *string `json:"remarks,omitempty"` + SerialNumber string `json:"serialNumber"` + Thumbprint string `json:"thumbprint"` +} + +func (o *RevokeCertificate) GetEffectiveAtAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.EffectiveAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *RevokeCertificate) SetEffectiveAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EffectiveAt = formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/predicates.go new file mode 100644 index 000000000000..3044be14db45 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/predicates.go @@ -0,0 +1,27 @@ +package certificateprofiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateProfileOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CertificateProfileOperationPredicate) Matches(input CertificateProfile) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/version.go new file mode 100644 index 000000000000..2f1d629a008b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles/version.go @@ -0,0 +1,10 @@ +package certificateprofiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-09-30-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/certificateprofiles/2024-09-30-preview" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/client.go new file mode 100644 index 000000000000..868e723d9797 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/client.go @@ -0,0 +1,37 @@ +package v2024_09_30_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/codesigning/2024-09-30-preview/certificateprofiles" + "github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + CertificateProfiles *certificateprofiles.CertificateProfilesClient + CodeSigningAccounts *codesigningaccounts.CodeSigningAccountsClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + certificateProfilesClient, err := certificateprofiles.NewCertificateProfilesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CertificateProfiles client: %+v", err) + } + configureFunc(certificateProfilesClient.Client) + + codeSigningAccountsClient, err := codesigningaccounts.NewCodeSigningAccountsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CodeSigningAccounts client: %+v", err) + } + configureFunc(codeSigningAccountsClient.Client) + + return &Client{ + CertificateProfiles: certificateProfilesClient, + CodeSigningAccounts: codeSigningAccountsClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/README.md new file mode 100644 index 000000000000..914bd4802c38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/README.md @@ -0,0 +1,138 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts` Documentation + +The `codesigningaccounts` 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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts" +``` + + +### Client Initialization + +```go +client := codesigningaccounts.NewCodeSigningAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CodeSigningAccountsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := codesigningaccounts.CheckNameAvailability{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CodeSigningAccountsClient.Create` + +```go +ctx := context.TODO() +id := codesigningaccounts.NewCodeSigningAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName") + +payload := codesigningaccounts.CodeSigningAccount{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CodeSigningAccountsClient.Delete` + +```go +ctx := context.TODO() +id := codesigningaccounts.NewCodeSigningAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CodeSigningAccountsClient.Get` + +```go +ctx := context.TODO() +id := codesigningaccounts.NewCodeSigningAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName") + +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: `CodeSigningAccountsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CodeSigningAccountsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CodeSigningAccountsClient.Update` + +```go +ctx := context.TODO() +id := codesigningaccounts.NewCodeSigningAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "codeSigningAccountName") + +payload := codesigningaccounts.CodeSigningAccountPatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/client.go new file mode 100644 index 000000000000..dabcf27b25c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/client.go @@ -0,0 +1,26 @@ +package codesigningaccounts + +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 CodeSigningAccountsClient struct { + Client *resourcemanager.Client +} + +func NewCodeSigningAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*CodeSigningAccountsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "codesigningaccounts", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CodeSigningAccountsClient: %+v", err) + } + + return &CodeSigningAccountsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/constants.go new file mode 100644 index 000000000000..48cb12493f22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/constants.go @@ -0,0 +1,145 @@ +package codesigningaccounts + +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 NameUnavailabilityReason string + +const ( + NameUnavailabilityReasonAccountNameInvalid NameUnavailabilityReason = "AccountNameInvalid" + NameUnavailabilityReasonAlreadyExists NameUnavailabilityReason = "AlreadyExists" +) + +func PossibleValuesForNameUnavailabilityReason() []string { + return []string{ + string(NameUnavailabilityReasonAccountNameInvalid), + string(NameUnavailabilityReasonAlreadyExists), + } +} + +func (s *NameUnavailabilityReason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNameUnavailabilityReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNameUnavailabilityReason(input string) (*NameUnavailabilityReason, error) { + vals := map[string]NameUnavailabilityReason{ + "accountnameinvalid": NameUnavailabilityReasonAccountNameInvalid, + "alreadyexists": NameUnavailabilityReasonAlreadyExists, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NameUnavailabilityReason(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 SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNamePremium SkuName = "Premium" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNamePremium), + } +} + +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "premium": SkuNamePremium, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/id_codesigningaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/id_codesigningaccount.go new file mode 100644 index 000000000000..345dd35145c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/id_codesigningaccount.go @@ -0,0 +1,130 @@ +package codesigningaccounts + +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(&CodeSigningAccountId{}) +} + +var _ resourceids.ResourceId = &CodeSigningAccountId{} + +// CodeSigningAccountId is a struct representing the Resource ID for a Code Signing Account +type CodeSigningAccountId struct { + SubscriptionId string + ResourceGroupName string + CodeSigningAccountName string +} + +// NewCodeSigningAccountID returns a new CodeSigningAccountId struct +func NewCodeSigningAccountID(subscriptionId string, resourceGroupName string, codeSigningAccountName string) CodeSigningAccountId { + return CodeSigningAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CodeSigningAccountName: codeSigningAccountName, + } +} + +// ParseCodeSigningAccountID parses 'input' into a CodeSigningAccountId +func ParseCodeSigningAccountID(input string) (*CodeSigningAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&CodeSigningAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CodeSigningAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCodeSigningAccountIDInsensitively parses 'input' case-insensitively into a CodeSigningAccountId +// note: this method should only be used for API response data and not user input +func ParseCodeSigningAccountIDInsensitively(input string) (*CodeSigningAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&CodeSigningAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CodeSigningAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeSigningAccountId) 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.CodeSigningAccountName, ok = input.Parsed["codeSigningAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeSigningAccountName", input) + } + + return nil +} + +// ValidateCodeSigningAccountID checks that 'input' can be parsed as a Code Signing Account ID +func ValidateCodeSigningAccountID(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 := ParseCodeSigningAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Code Signing Account ID +func (id CodeSigningAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CodeSigning/codeSigningAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CodeSigningAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Code Signing Account ID +func (id CodeSigningAccountId) 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("staticMicrosoftCodeSigning", "Microsoft.CodeSigning", "Microsoft.CodeSigning"), + resourceids.StaticSegment("staticCodeSigningAccounts", "codeSigningAccounts", "codeSigningAccounts"), + resourceids.UserSpecifiedSegment("codeSigningAccountName", "codeSigningAccountName"), + } +} + +// String returns a human-readable description of this Code Signing Account ID +func (id CodeSigningAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Code Signing Account Name: %q", id.CodeSigningAccountName), + } + return fmt.Sprintf("Code Signing Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_checknameavailability.go new file mode 100644 index 000000000000..2a800d7f6115 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_checknameavailability.go @@ -0,0 +1,59 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c CodeSigningAccountsClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailability) (result CheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.CodeSigning/checkNameAvailability", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CheckNameAvailabilityResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_create.go new file mode 100644 index 000000000000..7d665533d73e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_create.go @@ -0,0 +1,75 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CodeSigningAccount +} + +// Create ... +func (c CodeSigningAccountsClient) Create(ctx context.Context, id CodeSigningAccountId, input CodeSigningAccount) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c CodeSigningAccountsClient) CreateThenPoll(ctx context.Context, id CodeSigningAccountId, input CodeSigningAccount) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_delete.go new file mode 100644 index 000000000000..88c742301081 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_delete.go @@ -0,0 +1,70 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CodeSigningAccountsClient) Delete(ctx context.Context, id CodeSigningAccountId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CodeSigningAccountsClient) DeleteThenPoll(ctx context.Context, id CodeSigningAccountId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_get.go new file mode 100644 index 000000000000..f56a3fc5585b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_get.go @@ -0,0 +1,53 @@ +package codesigningaccounts + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CodeSigningAccount +} + +// Get ... +func (c CodeSigningAccountsClient) Get(ctx context.Context, id CodeSigningAccountId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CodeSigningAccount + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbyresourcegroup.go new file mode 100644 index 000000000000..dcbd40870936 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CodeSigningAccount +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CodeSigningAccount +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c CodeSigningAccountsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.CodeSigning/codeSigningAccounts", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CodeSigningAccount `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c CodeSigningAccountsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CodeSigningAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CodeSigningAccountsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CodeSigningAccountOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CodeSigningAccount, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbysubscription.go new file mode 100644 index 000000000000..af7e03ceac42 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_listbysubscription.go @@ -0,0 +1,106 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CodeSigningAccount +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CodeSigningAccount +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c CodeSigningAccountsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.CodeSigning/codeSigningAccounts", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]CodeSigningAccount `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c CodeSigningAccountsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CodeSigningAccountOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CodeSigningAccountsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CodeSigningAccountOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CodeSigningAccount, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_update.go new file mode 100644 index 000000000000..d1a3d395e082 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/method_update.go @@ -0,0 +1,75 @@ +package codesigningaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CodeSigningAccount +} + +// Update ... +func (c CodeSigningAccountsClient) Update(ctx context.Context, id CodeSigningAccountId, input CodeSigningAccountPatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c CodeSigningAccountsClient) UpdateThenPoll(ctx context.Context, id CodeSigningAccountId, input CodeSigningAccountPatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountsku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountsku.go new file mode 100644 index 000000000000..301eca38210d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountsku.go @@ -0,0 +1,8 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountSku struct { + Name SkuName `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountskupatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountskupatch.go new file mode 100644 index 000000000000..0f09a8660b89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_accountskupatch.go @@ -0,0 +1,8 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountSkuPatch struct { + Name *SkuName `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailability.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailability.go new file mode 100644 index 000000000000..f01c090ec694 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailability.go @@ -0,0 +1,8 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailability struct { + Name string `json:"name"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailabilityresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailabilityresult.go new file mode 100644 index 000000000000..9fee693bf9ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *NameUnavailabilityReason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccount.go new file mode 100644 index 000000000000..e21b9375fb82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccount.go @@ -0,0 +1,18 @@ +package codesigningaccounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CodeSigningAccount struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CodeSigningAccountProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatch.go new file mode 100644 index 000000000000..704c7e415880 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatch.go @@ -0,0 +1,9 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CodeSigningAccountPatch struct { + Properties *CodeSigningAccountPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatchproperties.go new file mode 100644 index 000000000000..7ddd60275fe9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountpatchproperties.go @@ -0,0 +1,8 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CodeSigningAccountPatchProperties struct { + Sku *AccountSkuPatch `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountproperties.go new file mode 100644 index 000000000000..30d1d196fb96 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/model_codesigningaccountproperties.go @@ -0,0 +1,10 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CodeSigningAccountProperties struct { + AccountUri *string `json:"accountUri,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Sku *AccountSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/predicates.go new file mode 100644 index 000000000000..cea979dacf80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/predicates.go @@ -0,0 +1,32 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CodeSigningAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CodeSigningAccountOperationPredicate) Matches(input CodeSigningAccount) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/version.go new file mode 100644 index 000000000000..4f6d304868e9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts/version.go @@ -0,0 +1,10 @@ +package codesigningaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-09-30-preview" + +func userAgent() string { + return "hashicorp/go-azure-sdk/codesigningaccounts/2024-09-30-preview" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f7ccc55e6779..ccf5bf115b74 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -315,6 +315,9 @@ github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/capabi github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/experiments github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targets github.com/hashicorp/go-azure-sdk/resource-manager/chaosstudio/2023-11-01/targettypes +github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview +github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/certificateprofiles +github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2023-05-01/deployments github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/communicationservices diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 5ccaceebfae0..5f1d127f750d 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -105,6 +105,7 @@ Stream Analytics Synapse System Center Virtual Machine Manager Template +Trusted Signing Video Indexer Voice Services Web PubSub diff --git a/website/docs/r/trusted_signing_account.html.markdown b/website/docs/r/trusted_signing_account.html.markdown new file mode 100644 index 000000000000..3f86b25b90ae --- /dev/null +++ b/website/docs/r/trusted_signing_account.html.markdown @@ -0,0 +1,70 @@ +--- +subcategory: "Trusted Signing" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_trusted_signing_account" +description: |- + Manages a Trusted Signing Account. +--- + +# azurerm_trusted_signing_account + +Manages a Trusted Signing Account. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example" + location = "West Europe" +} + +resource "azurerm_trusted_signing_account" "example" { + resource_group_name = "example" + location = "West Europe" + sku { + name = "Basic" + } +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this Trusted Signing Account. Changing this forces a new Trusted Signing Account to be created. + +* `location` - (Required) The Azure Region where the Trusted Signing Account should exist. Changing this forces a new Trusted Signing Account to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the Trusted Signing Account should exist. Changing this forces a new Trusted Signing Account to be created. + +* `sku_name` - (Required) The sku name of this Trusted Signing Account. Possible values are `Basic` and `Premium`. + +--- + +* `tags` - (Optional) A mapping of tags which should be assigned to the Trusted Signing Account. + + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Trusted Signing Account. + +* `account_uri` - The URI of the Trusted Signing Account which is used during signing files. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Trusted Signing Account. +* `read` - (Defaults to 5 minutes) Used when retrieving the Trusted Signing Account. +* `update` - (Defaults to 10 minutes) Used when updating the Trusted Signing Account. +* `delete` - (Defaults to 10 minutes) Used when deleting the Trusted Signing Account. + +## Import + +Trusted Signing Accounts can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_trusted_signing_account.example /subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.CodeSigning/codeSigningAccounts/example-account +```