From 941b1071f30b3dcac8d49f5b970f85ab6792af10 Mon Sep 17 00:00:00 2001 From: Felipe Rezende Date: Thu, 12 Dec 2024 06:53:29 -0300 Subject: [PATCH] New Resource: `azurerm_cognitive_rai_blocklist` (#28043) * feature: azure openai rai blocklist feature: rai blocklists resource registred * test: unit testing * doc: rai blocklist documentation * chore: changed the resource name * doc: updated the doc * fix: requested adjustments and acceptence test formated using terrafmt tool --- internal/services/cognitive/client/client.go | 18 +- ...ognitive_account_rai_blocklist_resource.go | 224 ++++++++++++++++++ ...ive_account_rai_blocklist_resource_test.go | 176 ++++++++++++++ internal/services/cognitive/registration.go | 1 + .../2024-10-01/raiblocklists/README.md | 186 +++++++++++++++ .../2024-10-01/raiblocklists/client.go | 26 ++ .../2024-10-01/raiblocklists/id_account.go | 130 ++++++++++ .../raiblocklists/id_raiblocklist.go | 139 +++++++++++ .../raiblocklists/id_raiblocklistitem.go | 148 ++++++++++++ .../raiblocklists/method_createorupdate.go | 58 +++++ .../2024-10-01/raiblocklists/method_delete.go | 70 ++++++ .../2024-10-01/raiblocklists/method_get.go | 53 +++++ .../2024-10-01/raiblocklists/method_list.go | 105 ++++++++ .../method_raiblocklistitemsbatchadd.go | 58 +++++ .../method_raiblocklistitemsbatchdelete.go | 51 ++++ .../method_raiblocklistitemscreateorupdate.go | 58 +++++ .../method_raiblocklistitemsdelete.go | 70 ++++++ .../method_raiblocklistitemsget.go | 53 +++++ .../method_raiblocklistitemslist.go | 105 ++++++++ .../raiblocklists/model_raiblocklist.go | 18 ++ .../raiblocklists/model_raiblocklistitem.go | 18 ++ .../model_raiblocklistitembulkrequest.go | 9 + .../model_raiblocklistitemproperties.go | 9 + .../model_raiblocklistproperties.go | 8 + .../2024-10-01/raiblocklists/predicates.go | 60 +++++ .../2024-10-01/raiblocklists/version.go | 10 + vendor/modules.txt | 1 + ...nitive_account_rai_blocklist.html.markdown | 69 ++++++ 28 files changed, 1927 insertions(+), 4 deletions(-) create mode 100644 internal/services/cognitive/cognitive_account_rai_blocklist_resource.go create mode 100644 internal/services/cognitive/cognitive_account_rai_blocklist_resource_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_account.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklistitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchadd.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchdelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemscreateorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsdelete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemslist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitembulkrequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitemproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/version.go create mode 100644 website/docs/r/cognitive_account_rai_blocklist.html.markdown diff --git a/internal/services/cognitive/client/client.go b/internal/services/cognitive/client/client.go index e9692f5de8ff..1c3b1b1458df 100644 --- a/internal/services/cognitive/client/client.go +++ b/internal/services/cognitive/client/client.go @@ -8,12 +8,14 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/cognitiveservicesaccounts" "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/deployments" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountsClient *cognitiveservicesaccounts.CognitiveServicesAccountsClient - DeploymentsClient *deployments.DeploymentsClient + AccountsClient *cognitiveservicesaccounts.CognitiveServicesAccountsClient + DeploymentsClient *deployments.DeploymentsClient + RaiBlocklistsClient *raiblocklists.RaiBlocklistsClient } func NewClient(o *common.ClientOptions) (*Client, error) { @@ -28,8 +30,16 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return nil, fmt.Errorf("building Deployments client: %+v", err) } o.Configure(deploymentsClient.Client, o.Authorizers.ResourceManager) + + raiBlobklistsClient, err := raiblocklists.NewRaiBlocklistsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Rai Blocklists client: %+v", err) + } + o.Configure(raiBlobklistsClient.Client, o.Authorizers.ResourceManager) + return &Client{ - AccountsClient: accountsClient, - DeploymentsClient: deploymentsClient, + AccountsClient: accountsClient, + DeploymentsClient: deploymentsClient, + RaiBlocklistsClient: raiBlobklistsClient, }, nil } diff --git a/internal/services/cognitive/cognitive_account_rai_blocklist_resource.go b/internal/services/cognitive/cognitive_account_rai_blocklist_resource.go new file mode 100644 index 000000000000..062b57a404ae --- /dev/null +++ b/internal/services/cognitive/cognitive_account_rai_blocklist_resource.go @@ -0,0 +1,224 @@ +package cognitive + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "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 cognitiveRaiBlocklistModel struct { + Name string `tfschema:"name"` + CognitiveAccountId string `tfschema:"cognitive_account_id"` + Description string `tfschema:"description"` +} + +type CognitiveRaiBlocklistResource struct{} + +var _ sdk.Resource = CognitiveRaiBlocklistResource{} + +func (c CognitiveRaiBlocklistResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "cognitive_account_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: raiblocklists.ValidateAccountID, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + } +} + +func (c CognitiveRaiBlocklistResource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{} +} + +func (c CognitiveRaiBlocklistResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Cognitive.RaiBlocklistsClient + + var model cognitiveRaiBlocklistModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + accountId, err := raiblocklists.ParseAccountID(model.CognitiveAccountId) + if err != nil { + return err + } + + locks.ByID(accountId.ID()) + defer locks.UnlockByID(accountId.ID()) + + id := raiblocklists.NewRaiBlocklistID(accountId.SubscriptionId, accountId.ResourceGroupName, accountId.AccountName, model.Name) + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(c.ResourceType(), id) + } + + payload := &raiblocklists.RaiBlocklist{ + Properties: &raiblocklists.RaiBlocklistProperties{}, + } + + if model.Description != "" { + payload.Properties.Description = &model.Description + } + + if _, err := client.CreateOrUpdate(ctx, id, *payload); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (c CognitiveRaiBlocklistResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Cognitive.RaiBlocklistsClient + + var model cognitiveRaiBlocklistModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + accountId, err := raiblocklists.ParseAccountID(model.CognitiveAccountId) + if err != nil { + return err + } + + locks.ByID(accountId.ID()) + defer locks.UnlockByID(accountId.ID()) + + id, err := raiblocklists.ParseRaiBlocklistID(metadata.ResourceData.Id()) + if err != nil { + return err + } + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", id) + } + + payload := existing.Model + + if metadata.ResourceData.HasChange("description") { + payload.Properties.Description = pointer.To(model.Description) + } + + if _, err := client.CreateOrUpdate(ctx, *id, *payload); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (c CognitiveRaiBlocklistResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Cognitive.RaiBlocklistsClient + + id, err := raiblocklists.ParseRaiBlocklistID(metadata.ResourceData.Id()) + if err != nil { + return err + } + accountId := raiblocklists.NewAccountID(id.SubscriptionId, id.ResourceGroupName, id.AccountName) + + locks.ByID(accountId.ID()) + defer locks.UnlockByID(accountId.ID()) + + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func (c CognitiveRaiBlocklistResource) IDValidationFunc() func(interface{}, string) ([]string, []error) { + return raiblocklists.ValidateRaiBlocklistID +} + +func (c CognitiveRaiBlocklistResource) ModelObject() interface{} { + return &cognitiveRaiBlocklistModel{} +} + +func (c CognitiveRaiBlocklistResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Cognitive.RaiBlocklistsClient + + id, err := raiblocklists.ParseRaiBlocklistID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + state := cognitiveRaiBlocklistModel{ + Name: id.RaiBlocklistName, + CognitiveAccountId: raiblocklists.NewAccountID(id.SubscriptionId, id.ResourceGroupName, id.AccountName).ID(), + } + + if model := existing.Model; model != nil { + if props := model.Properties; props != nil { + state.Description = pointer.From(props.Description) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (c CognitiveRaiBlocklistResource) ResourceType() string { + return "azurerm_cognitive_account_rai_blocklist" +} diff --git a/internal/services/cognitive/cognitive_account_rai_blocklist_resource_test.go b/internal/services/cognitive/cognitive_account_rai_blocklist_resource_test.go new file mode 100644 index 000000000000..d9f52a1ee669 --- /dev/null +++ b/internal/services/cognitive/cognitive_account_rai_blocklist_resource_test.go @@ -0,0 +1,176 @@ +package cognitive_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists" + "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/tf/pluginsdk" +) + +type CognitiveRaiBlocklistTestResource struct{} + +func TestAccCognitiveRaiBlocklistSequential(t *testing.T) { + acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ + "raiBlocklist": { + "basic": TestAccCognitiveRaiBlocklist_basic, + "requiresImport": TestAccCognitiveRaiBlocklist_requiresImport, + "complete": TestAccCognitiveRaiBlocklist_complete, + "update": TestAccCognitiveRaiBlocklist_update, + }, + }) +} + +func TestAccCognitiveRaiBlocklist_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cognitive_account_rai_blocklist", "test") + r := CognitiveRaiBlocklistTestResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccCognitiveRaiBlocklist_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cognitive_account_rai_blocklist", "test") + r := CognitiveRaiBlocklistTestResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccCognitiveRaiBlocklist_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cognitive_account_rai_blocklist", "test") + r := CognitiveRaiBlocklistTestResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccCognitiveRaiBlocklist_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_cognitive_account_rai_blocklist", "test") + r := CognitiveRaiBlocklistTestResource{} + + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (c CognitiveRaiBlocklistTestResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := raiblocklists.ParseRaiBlocklistID(state.ID) + if err != nil { + return nil, err + } + + existing, err := clients.Cognitive.RaiBlocklistsClient.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + return pointer.To(existing.Model != nil), nil +} + +func (c CognitiveRaiBlocklistTestResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctest-rg-%d" + location = "%s" +} + +resource "azurerm_cognitive_account" "test" { + name = "acctest-ca-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + kind = "OpenAI" + sku_name = "S0" +} + `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} + +func (c CognitiveRaiBlocklistTestResource) basic(data acceptance.TestData) string { + template := c.template(data) + return fmt.Sprintf(` + %s +resource "azurerm_cognitive_account_rai_blocklist" "test" { + name = "acctest-crb-%d" + cognitive_account_id = azurerm_cognitive_account.test.id + description = "Acceptance test data new azurerm resource" +} + `, template, data.RandomInteger) +} + +func (c CognitiveRaiBlocklistTestResource) requiresImport(data acceptance.TestData) string { + config := c.basic(data) + return fmt.Sprintf(` + %s +resource "azurerm_cognitive_account_rai_blocklist" "import" { + name = azurerm_cognitive_account_rai_blocklist.test.name + cognitive_account_id = azurerm_cognitive_account.test.id + description = "Acceptance test data new azurerm resource" +} + `, config) +} + +func (c CognitiveRaiBlocklistTestResource) complete(data acceptance.TestData) string { + template := c.template(data) + return fmt.Sprintf(` + %s +resource "azurerm_cognitive_account_rai_blocklist" "test" { + name = "acctest-crb-%d" + cognitive_account_id = azurerm_cognitive_account.test.id + description = "Acceptance test data new azurerm resource" +} + `, template, data.RandomInteger) +} + +func (c CognitiveRaiBlocklistTestResource) update(data acceptance.TestData) string { + template := c.template(data) + return fmt.Sprintf(` + %s +resource "azurerm_cognitive_account_rai_blocklist" "test" { + name = "acctest-crb-%d" + cognitive_account_id = azurerm_cognitive_account.test.id + description = "Acceptance test data new azurerm resource updated" +} + `, template, data.RandomInteger) +} diff --git a/internal/services/cognitive/registration.go b/internal/services/cognitive/registration.go index 5c3cd5d03c5a..7cb998a3fb02 100644 --- a/internal/services/cognitive/registration.go +++ b/internal/services/cognitive/registration.go @@ -56,5 +56,6 @@ func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ AzureAIServicesResource{}, CognitiveDeploymentResource{}, + CognitiveRaiBlocklistResource{}, } } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/README.md new file mode 100644 index 000000000000..d0fc2d949ba4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/README.md @@ -0,0 +1,186 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists` Documentation + +The `raiblocklists` SDK allows for interaction with Azure Resource Manager `cognitive` (API Version `2024-10-01`). + +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/cognitive/2024-10-01/raiblocklists" +``` + + +### Client Initialization + +```go +client := raiblocklists.NewRaiBlocklistsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RaiBlocklistsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") + +payload := raiblocklists.RaiBlocklist{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RaiBlocklistsClient.Delete` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RaiBlocklistsClient.Get` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") + +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: `RaiBlocklistsClient.List` + +```go +ctx := context.TODO() +id := raiblocklists.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsBatchAdd` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") +var payload []RaiBlocklistItemBulkRequest + +read, err := client.RaiBlocklistItemsBatchAdd(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsBatchDelete` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") +var payload interface{} + +read, err := client.RaiBlocklistItemsBatchDelete(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsCreateOrUpdate` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName", "raiBlocklistItemName") + +payload := raiblocklists.RaiBlocklistItem{ + // ... +} + + +read, err := client.RaiBlocklistItemsCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsDelete` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName", "raiBlocklistItemName") + +if err := client.RaiBlocklistItemsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsGet` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName", "raiBlocklistItemName") + +read, err := client.RaiBlocklistItemsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RaiBlocklistsClient.RaiBlocklistItemsList` + +```go +ctx := context.TODO() +id := raiblocklists.NewRaiBlocklistID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "raiBlocklistName") + +// alternatively `client.RaiBlocklistItemsList(ctx, id)` can be used to do batched pagination +items, err := client.RaiBlocklistItemsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/client.go new file mode 100644 index 000000000000..8721ad1960a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/client.go @@ -0,0 +1,26 @@ +package raiblocklists + +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 RaiBlocklistsClient struct { + Client *resourcemanager.Client +} + +func NewRaiBlocklistsClientWithBaseURI(sdkApi sdkEnv.Api) (*RaiBlocklistsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "raiblocklists", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RaiBlocklistsClient: %+v", err) + } + + return &RaiBlocklistsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_account.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_account.go new file mode 100644 index 000000000000..eadf6b999b86 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_account.go @@ -0,0 +1,130 @@ +package raiblocklists + +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(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklist.go new file mode 100644 index 000000000000..70ef2a3f25fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklist.go @@ -0,0 +1,139 @@ +package raiblocklists + +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(&RaiBlocklistId{}) +} + +var _ resourceids.ResourceId = &RaiBlocklistId{} + +// RaiBlocklistId is a struct representing the Resource ID for a Rai Blocklist +type RaiBlocklistId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + RaiBlocklistName string +} + +// NewRaiBlocklistID returns a new RaiBlocklistId struct +func NewRaiBlocklistID(subscriptionId string, resourceGroupName string, accountName string, raiBlocklistName string) RaiBlocklistId { + return RaiBlocklistId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + RaiBlocklistName: raiBlocklistName, + } +} + +// ParseRaiBlocklistID parses 'input' into a RaiBlocklistId +func ParseRaiBlocklistID(input string) (*RaiBlocklistId, error) { + parser := resourceids.NewParserFromResourceIdType(&RaiBlocklistId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RaiBlocklistId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRaiBlocklistIDInsensitively parses 'input' case-insensitively into a RaiBlocklistId +// note: this method should only be used for API response data and not user input +func ParseRaiBlocklistIDInsensitively(input string) (*RaiBlocklistId, error) { + parser := resourceids.NewParserFromResourceIdType(&RaiBlocklistId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RaiBlocklistId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RaiBlocklistId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + if id.RaiBlocklistName, ok = input.Parsed["raiBlocklistName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "raiBlocklistName", input) + } + + return nil +} + +// ValidateRaiBlocklistID checks that 'input' can be parsed as a Rai Blocklist ID +func ValidateRaiBlocklistID(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 := ParseRaiBlocklistID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rai Blocklist ID +func (id RaiBlocklistId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s/raiBlocklists/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.RaiBlocklistName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rai Blocklist ID +func (id RaiBlocklistId) 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("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + resourceids.StaticSegment("staticRaiBlocklists", "raiBlocklists", "raiBlocklists"), + resourceids.UserSpecifiedSegment("raiBlocklistName", "raiBlocklistName"), + } +} + +// String returns a human-readable description of this Rai Blocklist ID +func (id RaiBlocklistId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Rai Blocklist Name: %q", id.RaiBlocklistName), + } + return fmt.Sprintf("Rai Blocklist (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklistitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklistitem.go new file mode 100644 index 000000000000..642b218519cc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/id_raiblocklistitem.go @@ -0,0 +1,148 @@ +package raiblocklists + +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(&RaiBlocklistItemId{}) +} + +var _ resourceids.ResourceId = &RaiBlocklistItemId{} + +// RaiBlocklistItemId is a struct representing the Resource ID for a Rai Blocklist Item +type RaiBlocklistItemId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + RaiBlocklistName string + RaiBlocklistItemName string +} + +// NewRaiBlocklistItemID returns a new RaiBlocklistItemId struct +func NewRaiBlocklistItemID(subscriptionId string, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string) RaiBlocklistItemId { + return RaiBlocklistItemId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + RaiBlocklistName: raiBlocklistName, + RaiBlocklistItemName: raiBlocklistItemName, + } +} + +// ParseRaiBlocklistItemID parses 'input' into a RaiBlocklistItemId +func ParseRaiBlocklistItemID(input string) (*RaiBlocklistItemId, error) { + parser := resourceids.NewParserFromResourceIdType(&RaiBlocklistItemId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RaiBlocklistItemId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRaiBlocklistItemIDInsensitively parses 'input' case-insensitively into a RaiBlocklistItemId +// note: this method should only be used for API response data and not user input +func ParseRaiBlocklistItemIDInsensitively(input string) (*RaiBlocklistItemId, error) { + parser := resourceids.NewParserFromResourceIdType(&RaiBlocklistItemId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RaiBlocklistItemId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RaiBlocklistItemId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + if id.RaiBlocklistName, ok = input.Parsed["raiBlocklistName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "raiBlocklistName", input) + } + + if id.RaiBlocklistItemName, ok = input.Parsed["raiBlocklistItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "raiBlocklistItemName", input) + } + + return nil +} + +// ValidateRaiBlocklistItemID checks that 'input' can be parsed as a Rai Blocklist Item ID +func ValidateRaiBlocklistItemID(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 := ParseRaiBlocklistItemID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rai Blocklist Item ID +func (id RaiBlocklistItemId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s/raiBlocklists/%s/raiBlocklistItems/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.RaiBlocklistName, id.RaiBlocklistItemName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rai Blocklist Item ID +func (id RaiBlocklistItemId) 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("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + resourceids.StaticSegment("staticRaiBlocklists", "raiBlocklists", "raiBlocklists"), + resourceids.UserSpecifiedSegment("raiBlocklistName", "raiBlocklistName"), + resourceids.StaticSegment("staticRaiBlocklistItems", "raiBlocklistItems", "raiBlocklistItems"), + resourceids.UserSpecifiedSegment("raiBlocklistItemName", "raiBlocklistItemName"), + } +} + +// String returns a human-readable description of this Rai Blocklist Item ID +func (id RaiBlocklistItemId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Rai Blocklist Name: %q", id.RaiBlocklistName), + fmt.Sprintf("Rai Blocklist Item Name: %q", id.RaiBlocklistItemName), + } + return fmt.Sprintf("Rai Blocklist Item (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_createorupdate.go new file mode 100644 index 000000000000..a6b788f2ab6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_createorupdate.go @@ -0,0 +1,58 @@ +package raiblocklists + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RaiBlocklist +} + +// CreateOrUpdate ... +func (c RaiBlocklistsClient) CreateOrUpdate(ctx context.Context, id RaiBlocklistId, input RaiBlocklist) (result CreateOrUpdateOperationResponse, 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 + } + + var model RaiBlocklist + 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/cognitive/2024-10-01/raiblocklists/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_delete.go new file mode 100644 index 000000000000..621e422780ff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_delete.go @@ -0,0 +1,70 @@ +package raiblocklists + +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 RaiBlocklistsClient) Delete(ctx context.Context, id RaiBlocklistId) (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 RaiBlocklistsClient) DeleteThenPoll(ctx context.Context, id RaiBlocklistId) 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/cognitive/2024-10-01/raiblocklists/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_get.go new file mode 100644 index 000000000000..277a3c8997eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_get.go @@ -0,0 +1,53 @@ +package raiblocklists + +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 *RaiBlocklist +} + +// Get ... +func (c RaiBlocklistsClient) Get(ctx context.Context, id RaiBlocklistId) (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 RaiBlocklist + 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/cognitive/2024-10-01/raiblocklists/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_list.go new file mode 100644 index 000000000000..ea9724913f5d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_list.go @@ -0,0 +1,105 @@ +package raiblocklists + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RaiBlocklist +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RaiBlocklist +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c RaiBlocklistsClient) List(ctx context.Context, id AccountId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/raiBlocklists", 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 *[]RaiBlocklist `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c RaiBlocklistsClient) ListComplete(ctx context.Context, id AccountId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RaiBlocklistOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RaiBlocklistsClient) ListCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate RaiBlocklistOperationPredicate) (result ListCompleteResult, err error) { + items := make([]RaiBlocklist, 0) + + resp, err := c.List(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 = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchadd.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchadd.go new file mode 100644 index 000000000000..1a7e886a20f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchadd.go @@ -0,0 +1,58 @@ +package raiblocklists + +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 RaiBlocklistItemsBatchAddOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RaiBlocklist +} + +// RaiBlocklistItemsBatchAdd ... +func (c RaiBlocklistsClient) RaiBlocklistItemsBatchAdd(ctx context.Context, id RaiBlocklistId, input []RaiBlocklistItemBulkRequest) (result RaiBlocklistItemsBatchAddOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/addRaiBlocklistItems", 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 RaiBlocklist + 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/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchdelete.go new file mode 100644 index 000000000000..b8313577f4c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsbatchdelete.go @@ -0,0 +1,51 @@ +package raiblocklists + +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 RaiBlocklistItemsBatchDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RaiBlocklistItemsBatchDelete ... +func (c RaiBlocklistsClient) RaiBlocklistItemsBatchDelete(ctx context.Context, id RaiBlocklistId, input interface{}) (result RaiBlocklistItemsBatchDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/deleteRaiBlocklistItems", 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/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemscreateorupdate.go new file mode 100644 index 000000000000..5caeb001e7c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemscreateorupdate.go @@ -0,0 +1,58 @@ +package raiblocklists + +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 RaiBlocklistItemsCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RaiBlocklistItem +} + +// RaiBlocklistItemsCreateOrUpdate ... +func (c RaiBlocklistsClient) RaiBlocklistItemsCreateOrUpdate(ctx context.Context, id RaiBlocklistItemId, input RaiBlocklistItem) (result RaiBlocklistItemsCreateOrUpdateOperationResponse, 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 + } + + var model RaiBlocklistItem + 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/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsdelete.go new file mode 100644 index 000000000000..b832a825b546 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsdelete.go @@ -0,0 +1,70 @@ +package raiblocklists + +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 RaiBlocklistItemsDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RaiBlocklistItemsDelete ... +func (c RaiBlocklistsClient) RaiBlocklistItemsDelete(ctx context.Context, id RaiBlocklistItemId) (result RaiBlocklistItemsDeleteOperationResponse, 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 +} + +// RaiBlocklistItemsDeleteThenPoll performs RaiBlocklistItemsDelete then polls until it's completed +func (c RaiBlocklistsClient) RaiBlocklistItemsDeleteThenPoll(ctx context.Context, id RaiBlocklistItemId) error { + result, err := c.RaiBlocklistItemsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing RaiBlocklistItemsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RaiBlocklistItemsDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsget.go new file mode 100644 index 000000000000..390fcc14f820 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemsget.go @@ -0,0 +1,53 @@ +package raiblocklists + +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 RaiBlocklistItemsGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RaiBlocklistItem +} + +// RaiBlocklistItemsGet ... +func (c RaiBlocklistsClient) RaiBlocklistItemsGet(ctx context.Context, id RaiBlocklistItemId) (result RaiBlocklistItemsGetOperationResponse, 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 RaiBlocklistItem + 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/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemslist.go new file mode 100644 index 000000000000..15c228ce07a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/method_raiblocklistitemslist.go @@ -0,0 +1,105 @@ +package raiblocklists + +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 RaiBlocklistItemsListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RaiBlocklistItem +} + +type RaiBlocklistItemsListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RaiBlocklistItem +} + +type RaiBlocklistItemsListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *RaiBlocklistItemsListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// RaiBlocklistItemsList ... +func (c RaiBlocklistsClient) RaiBlocklistItemsList(ctx context.Context, id RaiBlocklistId) (result RaiBlocklistItemsListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &RaiBlocklistItemsListCustomPager{}, + Path: fmt.Sprintf("%s/raiBlocklistItems", 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 *[]RaiBlocklistItem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// RaiBlocklistItemsListComplete retrieves all the results into a single object +func (c RaiBlocklistsClient) RaiBlocklistItemsListComplete(ctx context.Context, id RaiBlocklistId) (RaiBlocklistItemsListCompleteResult, error) { + return c.RaiBlocklistItemsListCompleteMatchingPredicate(ctx, id, RaiBlocklistItemOperationPredicate{}) +} + +// RaiBlocklistItemsListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RaiBlocklistsClient) RaiBlocklistItemsListCompleteMatchingPredicate(ctx context.Context, id RaiBlocklistId, predicate RaiBlocklistItemOperationPredicate) (result RaiBlocklistItemsListCompleteResult, err error) { + items := make([]RaiBlocklistItem, 0) + + resp, err := c.RaiBlocklistItemsList(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 = RaiBlocklistItemsListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklist.go new file mode 100644 index 000000000000..8be491a1b59b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklist.go @@ -0,0 +1,18 @@ +package raiblocklists + +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 RaiBlocklist struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RaiBlocklistProperties `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/cognitive/2024-10-01/raiblocklists/model_raiblocklistitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitem.go new file mode 100644 index 000000000000..98bd2267f965 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitem.go @@ -0,0 +1,18 @@ +package raiblocklists + +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 RaiBlocklistItem struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RaiBlocklistItemProperties `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/cognitive/2024-10-01/raiblocklists/model_raiblocklistitembulkrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitembulkrequest.go new file mode 100644 index 000000000000..7f7ac1e1e3c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitembulkrequest.go @@ -0,0 +1,9 @@ +package raiblocklists + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RaiBlocklistItemBulkRequest struct { + Name *string `json:"name,omitempty"` + Properties *RaiBlocklistItemProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitemproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitemproperties.go new file mode 100644 index 000000000000..f6b4e7ca37a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistitemproperties.go @@ -0,0 +1,9 @@ +package raiblocklists + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RaiBlocklistItemProperties struct { + IsRegex *bool `json:"isRegex,omitempty"` + Pattern *string `json:"pattern,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistproperties.go new file mode 100644 index 000000000000..816f9b75e266 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/model_raiblocklistproperties.go @@ -0,0 +1,8 @@ +package raiblocklists + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RaiBlocklistProperties struct { + Description *string `json:"description,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/predicates.go new file mode 100644 index 000000000000..a317e1c7318b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/predicates.go @@ -0,0 +1,60 @@ +package raiblocklists + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RaiBlocklistOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p RaiBlocklistOperationPredicate) Matches(input RaiBlocklist) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + 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 +} + +type RaiBlocklistItemOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p RaiBlocklistItemOperationPredicate) Matches(input RaiBlocklistItem) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + 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/cognitive/2024-10-01/raiblocklists/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/version.go new file mode 100644 index 000000000000..cc4c248b7f4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists/version.go @@ -0,0 +1,10 @@ +package raiblocklists + +// 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-10-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/raiblocklists/2024-10-01" +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 66fd72e9367e..434e92d526e9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -320,6 +320,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-previe github.com/hashicorp/go-azure-sdk/resource-manager/codesigning/2024-09-30-preview/codesigningaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/cognitiveservicesaccounts github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/deployments +github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2024-10-01/raiblocklists github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/communicationservices github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/domains github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/emailservices diff --git a/website/docs/r/cognitive_account_rai_blocklist.html.markdown b/website/docs/r/cognitive_account_rai_blocklist.html.markdown new file mode 100644 index 000000000000..0b55a8c5bdae --- /dev/null +++ b/website/docs/r/cognitive_account_rai_blocklist.html.markdown @@ -0,0 +1,69 @@ +--- +subcategory: "Cognitive Services" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_cognitive_account_rai_blocklist" +description: |- + Manages a Cognitive Account Rai Blocklist. +--- + +# azurerm_cognitive_account_rai_blocklist + +Manages a Cognitive Account Rai Blocklist. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "Brazil South" +} + +resource "azurerm_cognitive_account" "example" { + name = "example-ca" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + kind = "OpenAI" + sku_name = "S0" +} + +resource "azurerm_cognitive_account_rai_blocklist" "example" { + name = "example-crb" + cognitive_account_id = azurerm_cognitive_account.example.id + description = "Azure OpenAI Rai Blocklist" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Cognitive Account Rai Blocklist. Changing this forces a new Cognitive Account Rai Blocklist to be created. + +* `cognitive_account_id` - (Required) The ID of the Cognitive Services Account. Changing this forces a new Cognitive Account Rai Blocklist to be created. + +--- + +* `description` - (Optional) A short description for the Cognitive Account Rai Blocklist. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the Cognitive Account Rai Blocklist. + +## 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 Cognitive Account Rai Blocklist. +* `read` - (Defaults to 5 minutes) Used when retrieving the Cognitive Account Rai Blocklist. +* `update` - (Defaults to 30 minutes) Used when updating the Cognitive Account Rai Blocklist. +* `delete` - (Defaults to 30 minutes) Used when deleting the Cognitive Account Rai Blocklist. + +## Import + +Cognitive Account Rai Blocklist can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_cognitive_rai_blocklist.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.CognitiveServices/accounts/account1/raiBlocklists/raiblocklist1 +``` \ No newline at end of file