From 595cca28a330a4b2ec77e18a395b2acae9b09a1e Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Tue, 12 Feb 2019 22:23:51 -0700 Subject: [PATCH 1/7] Adding EventGrid Domain resource --- azurerm/config.go | 7 +- azurerm/provider.go | 1 + azurerm/resource_arm_eventgrid_domain.go | 380 ++ azurerm/resource_arm_eventgrid_domain_test.go | 212 + azurerm/resource_arm_eventgrid_topic.go | 2 +- .../eventgrid/mgmt/eventgrid/models.go | 301 ++ .../mgmt/2018-01-01/eventgrid/models.go | 1208 ------ .../2018-09-15-preview}/eventgrid/client.go | 2 +- .../2018-09-15-preview/eventgrid/domains.go | 665 +++ .../eventgrid/domaintopics.go | 197 + .../eventgrid/eventsubscriptions.go | 109 +- .../2018-09-15-preview/eventgrid/models.go | 3765 +++++++++++++++++ .../eventgrid/operations.go | 2 +- .../2018-09-15-preview}/eventgrid/topics.go | 18 +- .../eventgrid/topictypes.go | 6 +- .../2018-09-15-preview}/eventgrid/version.go | 2 +- vendor/modules.txt | 3 +- website/azurerm.erb | 4 + website/docs/r/eventgrid_domain.html.markdown | 88 + 19 files changed, 5731 insertions(+), 1241 deletions(-) create mode 100644 azurerm/resource_arm_eventgrid_domain.go create mode 100644 azurerm/resource_arm_eventgrid_domain_test.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/client.go (98%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/eventsubscriptions.go (92%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/operations.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/topics.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/topictypes.go (98%) rename vendor/github.com/Azure/azure-sdk-for-go/services/{eventgrid/mgmt/2018-01-01 => preview/eventgrid/mgmt/2018-09-15-preview}/eventgrid/version.go (98%) create mode 100644 website/docs/r/eventgrid_domain.html.markdown diff --git a/azurerm/config.go b/azurerm/config.go index 0664504fad9b..635961ddba6a 100644 --- a/azurerm/config.go +++ b/azurerm/config.go @@ -25,7 +25,6 @@ import ( "github.com/Azure/azure-sdk-for-go/services/datalake/store/2016-11-01/filesystem" storeAccount "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account" "github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl" - "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid" "github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub" "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-04-01/devices" @@ -40,6 +39,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization" "github.com/Azure/azure-sdk-for-go/services/preview/devspaces/mgmt/2018-06-01-preview/devspaces" "github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" + "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" "github.com/Azure/azure-sdk-for-go/services/preview/mariadb/mgmt/2018-06-01-preview/mariadb" "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" "github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi" @@ -112,6 +112,7 @@ type ArmClient struct { kubernetesClustersClient containerservice.ManagedClustersClient containerGroupsClient containerinstance.ContainerGroupsClient + eventGridDomainsClient eventgrid.DomainsClient eventGridTopicsClient eventgrid.TopicsClient eventHubClient eventhub.EventHubsClient eventHubConsumerGroupClient eventhub.ConsumerGroupsClient @@ -830,6 +831,10 @@ func (c *ArmClient) registerEventGridClients(endpoint, subscriptionId string, au egtc := eventgrid.NewTopicsClientWithBaseURI(endpoint, subscriptionId) c.configureClient(&egtc.Client, auth) c.eventGridTopicsClient = egtc + + egdc := eventgrid.NewDomainsClientWithBaseURI(endpoint, subscriptionId) + c.configureClient(&egdc.Client, auth) + c.eventGridDomainsClient = egdc } func (c *ArmClient) registerEventHubClients(endpoint, subscriptionId string, auth autorest.Authorizer) { diff --git a/azurerm/provider.go b/azurerm/provider.go index 5af4de2cbf80..1e2baad69772 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -215,6 +215,7 @@ func Provider() terraform.ResourceProvider { "azurerm_dns_srv_record": resourceArmDnsSrvRecord(), "azurerm_dns_txt_record": resourceArmDnsTxtRecord(), "azurerm_dns_zone": resourceArmDnsZone(), + "azurerm_eventgrid_domain": resourceArmEventGridDomain(), "azurerm_eventgrid_topic": resourceArmEventGridTopic(), "azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(), "azurerm_eventhub_consumer_group": resourceArmEventHubConsumerGroup(), diff --git a/azurerm/resource_arm_eventgrid_domain.go b/azurerm/resource_arm_eventgrid_domain.go new file mode 100644 index 000000000000..5a766ed011eb --- /dev/null +++ b/azurerm/resource_arm_eventgrid_domain.go @@ -0,0 +1,380 @@ +package azurerm + +import ( + "fmt" + "log" + + "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" + "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func resourceArmEventGridDomain() *schema.Resource { + return &schema.Resource{ + Create: resourceArmEventGridDomainCreateUpdate, + Read: resourceArmEventGridDomainRead, + Update: resourceArmEventGridDomainCreateUpdate, + Delete: resourceArmEventGridDomainDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "location": locationSchema(), + + "resource_group_name": resourceGroupNameSchema(), + + "tags": tagsSchema(), + + "input_schema": { + Type: schema.TypeString, + Optional: true, + Default: string(eventgrid.InputSchemaEventGridSchema), + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(eventgrid.InputSchemaCloudEventV01Schema), + string(eventgrid.InputSchemaCustomEventSchema), + string(eventgrid.InputSchemaEventGridSchema), + }, true), + }, + + "input_mapping_fields": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "topic": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "event_time": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "event_type": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "subject": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "data_version": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + }, + }, + }, + + "input_mapping_default_values": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + ForceNew: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "event_type": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "subject": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + "data_version": { + Type: schema.TypeString, + ForceNew: true, + Optional: true, + }, + }, + }, + }, + + "endpoint": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceArmEventGridDomainCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).eventGridDomainsClient + ctx := meta.(*ArmClient).StopContext + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + if requireResourcesToBeImported && d.IsNewResource() { + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("Error checking for presence of existing EventGrid Domain %q (Resource Group %q): %s", name, resourceGroup, err) + } + } + + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_eventgrid_domain", *existing.ID) + } + } + + location := azureRMNormalizeLocation(d.Get("location").(string)) + tags := d.Get("tags").(map[string]interface{}) + + domainProperties := &eventgrid.DomainProperties{ + InputSchemaMapping: expandAzureRmEventgridDomainInputMapping(d), + InputSchema: eventgrid.InputSchema(d.Get("input_schema").(string)), + } + + domain := eventgrid.Domain{ + Location: &location, + DomainProperties: domainProperties, + Tags: expandTags(tags), + } + + log.Printf("[INFO] preparing arguments for AzureRM EventGrid Domain creation with Properties: %+v", domain) + + future, err := client.CreateOrUpdate(ctx, resourceGroup, name, domain) + if err != nil { + return err + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return err + } + + read, err := client.Get(ctx, resourceGroup, name) + if err != nil { + return err + } + if read.ID == nil { + return fmt.Errorf("Cannot read EventGrid Domain %s (resource group %s) ID", name, resourceGroup) + } + + d.SetId(*read.ID) + + return resourceArmEventGridDomainRead(d, meta) +} + +func resourceArmEventGridDomainRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).eventGridDomainsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resourceGroup := id.ResourceGroup + name := id.Path["domains"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[WARN] EventGrid Domain '%s' was not found (resource group '%s')", name, resourceGroup) + d.SetId("") + return nil + } + + return fmt.Errorf("Error making Read request on EventGrid Domain '%s': %+v", name, err) + } + + d.Set("name", resp.Name) + d.Set("resource_group_name", resourceGroup) + if location := resp.Location; location != nil { + d.Set("location", azureRMNormalizeLocation(*location)) + } + + if props := resp.DomainProperties; props != nil { + d.Set("endpoint", props.Endpoint) + + d.Set("input_schema", string(props.InputSchema)) + + if err := d.Set("input_mapping_fields", flattenAzureRmEventgridDomainInputMapping(props.InputSchemaMapping)); err != nil { + return fmt.Errorf("Error setting `input_schema_mapping_fields`: %+v", err) + } + + if err := d.Set("input_mapping_default_values", flattenAzureRmEventgridDomainInputMappingDefaultValues(props.InputSchemaMapping)); err != nil { + return fmt.Errorf("Error setting `input_schema_mapping_fields`: %+v", err) + } + } + + flattenAndSetTags(d, resp.Tags) + + return nil +} + +func resourceArmEventGridDomainDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*ArmClient).eventGridDomainsClient + ctx := meta.(*ArmClient).StopContext + + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + resGroup := id.ResourceGroup + name := id.Path["domains"] + + future, err := client.Delete(ctx, resGroup, name) + if err != nil { + if response.WasNotFound(future.Response()) { + return nil + } + return fmt.Errorf("Error deleting Event Grid Domain %q: %+v", name, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if response.WasNotFound(future.Response()) { + return nil + } + return fmt.Errorf("Error deleting Event Grid Domain %q: %+v", name, err) + } + + return nil +} + +func expandAzureRmEventgridDomainInputMapping(d *schema.ResourceData) *eventgrid.JSONInputSchemaMapping { + imf, imfok := d.GetOk("input_mapping_fields") + + imdv, imdvok := d.GetOk("input_mapping_default_values") + + if !imfok && !imdvok { + return nil + } + + jismp := eventgrid.JSONInputSchemaMappingProperties{} + + if imfok { + mappings := imf.([]interface{}) + mapping := mappings[0].(map[string]interface{}) + + if id := mapping["id"].(string); id != "" { + jismp.ID = &eventgrid.JSONField{SourceField: &id} + } + + if eventTime := mapping["event_time"].(string); eventTime != "" { + jismp.EventTime = &eventgrid.JSONField{SourceField: &eventTime} + } + + if topic := mapping["topic"].(string); topic != "" { + jismp.Topic = &eventgrid.JSONField{SourceField: &topic} + } + + if dataVersion := mapping["data_version"].(string); dataVersion != "" { + jismp.DataVersion = &eventgrid.JSONFieldWithDefault{SourceField: &dataVersion} + } + + if subject := mapping["subject"].(string); subject != "" { + jismp.Subject = &eventgrid.JSONFieldWithDefault{SourceField: &subject} + } + + if eventType := mapping["event_type"].(string); eventType != "" { + jismp.EventType = &eventgrid.JSONFieldWithDefault{SourceField: &eventType} + } + } + + if imdvok { + mappings := imdv.([]interface{}) + mapping := mappings[0].(map[string]interface{}) + + if dataVersion := mapping["data_version"].(string); dataVersion != "" { + jismp.DataVersion = &eventgrid.JSONFieldWithDefault{DefaultValue: &dataVersion} + } + + if subject := mapping["subject"].(string); subject != "" { + jismp.Subject = &eventgrid.JSONFieldWithDefault{DefaultValue: &subject} + } + + if eventType := mapping["event_type"].(string); eventType != "" { + jismp.EventType = &eventgrid.JSONFieldWithDefault{DefaultValue: &eventType} + } + } + + jsonMapping := eventgrid.JSONInputSchemaMapping{ + JSONInputSchemaMappingProperties: &jismp, + InputSchemaMappingType: eventgrid.InputSchemaMappingTypeJSON, + } + + return &jsonMapping +} + +func flattenAzureRmEventgridDomainInputMapping(input eventgrid.BasicInputSchemaMapping) []interface{} { + if input == nil { + return nil + } + result := make(map[string]interface{}) + + jsonValues := input.(eventgrid.JSONInputSchemaMapping).JSONInputSchemaMappingProperties + + if jsonValues.EventTime != nil && jsonValues.EventTime.SourceField != nil { + result["event_time"] = *jsonValues.EventTime.SourceField + } + + if jsonValues.ID != nil && jsonValues.ID.SourceField != nil { + result["id"] = *jsonValues.ID.SourceField + } + + if jsonValues.Topic != nil && jsonValues.Topic.SourceField != nil { + result["topic"] = *jsonValues.Topic.SourceField + } + + if jsonValues.DataVersion != nil && jsonValues.DataVersion.SourceField != nil { + result["data_version"] = *jsonValues.DataVersion.SourceField + } + + if jsonValues.EventType != nil && jsonValues.EventType.SourceField != nil { + result["event_type"] = *jsonValues.EventType.SourceField + } + + if jsonValues.Subject != nil && jsonValues.Subject.SourceField != nil { + result["subject"] = *jsonValues.Subject.SourceField + } + + return []interface{}{result} +} + +func flattenAzureRmEventgridDomainInputMappingDefaultValues(input eventgrid.BasicInputSchemaMapping) []interface{} { + if input == nil { + return nil + } + result := make(map[string]interface{}) + + jsonValues := input.(eventgrid.JSONInputSchemaMapping).JSONInputSchemaMappingProperties + + if jsonValues.DataVersion != nil && jsonValues.DataVersion.DefaultValue != nil { + result["data_version"] = *jsonValues.DataVersion.DefaultValue + } + + if jsonValues.EventType != nil && jsonValues.EventType.DefaultValue != nil { + result["event_type"] = *jsonValues.EventType.DefaultValue + } + + if jsonValues.Subject != nil && jsonValues.Subject.DefaultValue != nil { + result["subject"] = *jsonValues.Subject.DefaultValue + } + + return []interface{}{result} +} diff --git a/azurerm/resource_arm_eventgrid_domain_test.go b/azurerm/resource_arm_eventgrid_domain_test.go new file mode 100644 index 000000000000..353f6de84bf6 --- /dev/null +++ b/azurerm/resource_arm_eventgrid_domain_test.go @@ -0,0 +1,212 @@ +package azurerm + +import ( + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" +) + +func TestAccAzureRMEventGridDomain_basic(t *testing.T) { + resourceName := "azurerm_eventgrid_domain.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventGridDomainDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMEventGridDomain_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventGridDomainExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMEventGridDomain_mapping(t *testing.T) { + resourceName := "azurerm_eventgrid_domain.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventGridDomainDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMEventGridDomain_mapping(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventGridDomainExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "input_mapping_fields.0.topic", "test"), + resource.TestCheckResourceAttr(resourceName, "input_mapping_fields.0.topic", "test"), + resource.TestCheckResourceAttr(resourceName, "input_mapping_default_values.0.data_version", "1.0"), + resource.TestCheckResourceAttr(resourceName, "input_mapping_default_values.0.subject", "DefaultSubject"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAzureRMEventGridDomain_basicWithTags(t *testing.T) { + resourceName := "azurerm_eventgrid_domain.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMEventGridDomainDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMEventGridDomain_basicWithTags(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMEventGridDomainExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testCheckAzureRMEventGridDomainDestroy(s *terraform.State) error { + client := testAccProvider.Meta().(*ArmClient).eventGridDomainsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + + for _, rs := range s.RootModule().Resources { + if rs.Type != "azurerm_eventgrid_domain" { + continue + } + + name := rs.Primary.Attributes["name"] + resourceGroup := rs.Primary.Attributes["resource_group_name"] + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return nil + } + + return err + } + + if resp.StatusCode != http.StatusNotFound { + return fmt.Errorf("EventGrid Domain still exists:\n%#v", resp) + } + } + + return nil +} + +func testCheckAzureRMEventGridDomainExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + // Ensure we have enough information in state to look up in API + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("Not found: %s", resourceName) + } + + name := rs.Primary.Attributes["name"] + resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] + if !hasResourceGroup { + return fmt.Errorf("Bad: no resource group found in state for EventGrid Domain: %s", name) + } + + client := testAccProvider.Meta().(*ArmClient).eventGridDomainsClient + ctx := testAccProvider.Meta().(*ArmClient).StopContext + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Bad: EventGrid Domain %q (resource group: %s) does not exist", name, resourceGroup) + } + + return fmt.Errorf("Bad: Get on eventGridDomainsClient: %s", err) + } + + return nil + } +} + +func testAccAzureRMEventGridDomain_basic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventgrid_domain" "test" { + name = "acctesteg-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" +} +`, rInt, location, rInt) +} + +func testAccAzureRMEventGridDomain_mapping(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventgrid_domain" "test" { + name = "acctesteg-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + input_schema = "CustomEventSchema" + input_mapping_fields { + topic = "test" + event_type = "test" + } + + input_mapping_default_values { + data_version = "1.0" + subject = "DefaultSubject" + } +} +`, rInt, location, rInt) +} + +func testAccAzureRMEventGridDomain_basicWithTags(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_eventgrid_domain" "test" { + name = "acctesteg-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + tags { + "foo" = "bar" + } +} +`, rInt, location, rInt) +} diff --git a/azurerm/resource_arm_eventgrid_topic.go b/azurerm/resource_arm_eventgrid_topic.go index e57e1c6821a6..dbbb69483a3e 100644 --- a/azurerm/resource_arm_eventgrid_topic.go +++ b/azurerm/resource_arm_eventgrid_topic.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid" + "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" "github.com/hashicorp/terraform/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" diff --git a/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go b/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go new file mode 100644 index 000000000000..a81c8283c0db --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go @@ -0,0 +1,301 @@ +// +build go1.9 + +// Copyright 2018 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package eventgrid + +import original "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type DomainProvisioningState = original.DomainProvisioningState + +const ( + Canceled DomainProvisioningState = original.Canceled + Creating DomainProvisioningState = original.Creating + Deleting DomainProvisioningState = original.Deleting + Failed DomainProvisioningState = original.Failed + Succeeded DomainProvisioningState = original.Succeeded + Updating DomainProvisioningState = original.Updating +) + +type EndpointType = original.EndpointType + +const ( + EndpointTypeEventHub EndpointType = original.EndpointTypeEventHub + EndpointTypeEventSubscriptionDestination EndpointType = original.EndpointTypeEventSubscriptionDestination + EndpointTypeHybridConnection EndpointType = original.EndpointTypeHybridConnection + EndpointTypeStorageQueue EndpointType = original.EndpointTypeStorageQueue + EndpointTypeWebHook EndpointType = original.EndpointTypeWebHook +) + +type EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestination + +const ( + EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeDeadLetterDestination + EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeStorageBlob +) + +type EventDeliverySchema = original.EventDeliverySchema + +const ( + CloudEventV01Schema EventDeliverySchema = original.CloudEventV01Schema + CustomInputSchema EventDeliverySchema = original.CustomInputSchema + EventGridSchema EventDeliverySchema = original.EventGridSchema +) + +type EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningState + +const ( + EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateAwaitingManualAction + EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateCanceled + EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateCreating + EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateDeleting + EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateFailed + EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateSucceeded + EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningStateUpdating +) + +type InputSchema = original.InputSchema + +const ( + InputSchemaCloudEventV01Schema InputSchema = original.InputSchemaCloudEventV01Schema + InputSchemaCustomEventSchema InputSchema = original.InputSchemaCustomEventSchema + InputSchemaEventGridSchema InputSchema = original.InputSchemaEventGridSchema +) + +type InputSchemaMappingType = original.InputSchemaMappingType + +const ( + InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = original.InputSchemaMappingTypeInputSchemaMapping + InputSchemaMappingTypeJSON InputSchemaMappingType = original.InputSchemaMappingTypeJSON +) + +type OperatorType = original.OperatorType + +const ( + OperatorTypeAdvancedFilter OperatorType = original.OperatorTypeAdvancedFilter + OperatorTypeBoolEquals OperatorType = original.OperatorTypeBoolEquals + OperatorTypeNumberGreaterThan OperatorType = original.OperatorTypeNumberGreaterThan + OperatorTypeNumberGreaterThanOrEquals OperatorType = original.OperatorTypeNumberGreaterThanOrEquals + OperatorTypeNumberIn OperatorType = original.OperatorTypeNumberIn + OperatorTypeNumberLessThan OperatorType = original.OperatorTypeNumberLessThan + OperatorTypeNumberLessThanOrEquals OperatorType = original.OperatorTypeNumberLessThanOrEquals + OperatorTypeNumberNotIn OperatorType = original.OperatorTypeNumberNotIn + OperatorTypeStringBeginsWith OperatorType = original.OperatorTypeStringBeginsWith + OperatorTypeStringContains OperatorType = original.OperatorTypeStringContains + OperatorTypeStringEndsWith OperatorType = original.OperatorTypeStringEndsWith + OperatorTypeStringIn OperatorType = original.OperatorTypeStringIn + OperatorTypeStringNotIn OperatorType = original.OperatorTypeStringNotIn +) + +type ResourceRegionType = original.ResourceRegionType + +const ( + GlobalResource ResourceRegionType = original.GlobalResource + RegionalResource ResourceRegionType = original.RegionalResource +) + +type TopicProvisioningState = original.TopicProvisioningState + +const ( + TopicProvisioningStateCanceled TopicProvisioningState = original.TopicProvisioningStateCanceled + TopicProvisioningStateCreating TopicProvisioningState = original.TopicProvisioningStateCreating + TopicProvisioningStateDeleting TopicProvisioningState = original.TopicProvisioningStateDeleting + TopicProvisioningStateFailed TopicProvisioningState = original.TopicProvisioningStateFailed + TopicProvisioningStateSucceeded TopicProvisioningState = original.TopicProvisioningStateSucceeded + TopicProvisioningStateUpdating TopicProvisioningState = original.TopicProvisioningStateUpdating +) + +type TopicTypeProvisioningState = original.TopicTypeProvisioningState + +const ( + TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = original.TopicTypeProvisioningStateCanceled + TopicTypeProvisioningStateCreating TopicTypeProvisioningState = original.TopicTypeProvisioningStateCreating + TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = original.TopicTypeProvisioningStateDeleting + TopicTypeProvisioningStateFailed TopicTypeProvisioningState = original.TopicTypeProvisioningStateFailed + TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = original.TopicTypeProvisioningStateSucceeded + TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = original.TopicTypeProvisioningStateUpdating +) + +type AdvancedFilter = original.AdvancedFilter +type BaseClient = original.BaseClient +type BasicAdvancedFilter = original.BasicAdvancedFilter +type BasicDeadLetterDestination = original.BasicDeadLetterDestination +type BasicEventSubscriptionDestination = original.BasicEventSubscriptionDestination +type BasicInputSchemaMapping = original.BasicInputSchemaMapping +type BoolEqualsAdvancedFilter = original.BoolEqualsAdvancedFilter +type DeadLetterDestination = original.DeadLetterDestination +type Domain = original.Domain +type DomainProperties = original.DomainProperties +type DomainRegenerateKeyRequest = original.DomainRegenerateKeyRequest +type DomainSharedAccessKeys = original.DomainSharedAccessKeys +type DomainTopic = original.DomainTopic +type DomainTopicsClient = original.DomainTopicsClient +type DomainTopicsListResult = original.DomainTopicsListResult +type DomainUpdateParameters = original.DomainUpdateParameters +type DomainsClient = original.DomainsClient +type DomainsCreateOrUpdateFuture = original.DomainsCreateOrUpdateFuture +type DomainsDeleteFuture = original.DomainsDeleteFuture +type DomainsListResult = original.DomainsListResult +type DomainsUpdateFuture = original.DomainsUpdateFuture +type EventHubEventSubscriptionDestination = original.EventHubEventSubscriptionDestination +type EventHubEventSubscriptionDestinationProperties = original.EventHubEventSubscriptionDestinationProperties +type EventSubscription = original.EventSubscription +type EventSubscriptionDestination = original.EventSubscriptionDestination +type EventSubscriptionFilter = original.EventSubscriptionFilter +type EventSubscriptionFullURL = original.EventSubscriptionFullURL +type EventSubscriptionProperties = original.EventSubscriptionProperties +type EventSubscriptionUpdateParameters = original.EventSubscriptionUpdateParameters +type EventSubscriptionsClient = original.EventSubscriptionsClient +type EventSubscriptionsCreateOrUpdateFuture = original.EventSubscriptionsCreateOrUpdateFuture +type EventSubscriptionsDeleteFuture = original.EventSubscriptionsDeleteFuture +type EventSubscriptionsListResult = original.EventSubscriptionsListResult +type EventSubscriptionsUpdateFuture = original.EventSubscriptionsUpdateFuture +type EventType = original.EventType +type EventTypeProperties = original.EventTypeProperties +type EventTypesListResult = original.EventTypesListResult +type HybridConnectionEventSubscriptionDestination = original.HybridConnectionEventSubscriptionDestination +type HybridConnectionEventSubscriptionDestinationProperties = original.HybridConnectionEventSubscriptionDestinationProperties +type InputSchemaMapping = original.InputSchemaMapping +type JSONField = original.JSONField +type JSONFieldWithDefault = original.JSONFieldWithDefault +type JSONInputSchemaMapping = original.JSONInputSchemaMapping +type JSONInputSchemaMappingProperties = original.JSONInputSchemaMappingProperties +type NumberGreaterThanAdvancedFilter = original.NumberGreaterThanAdvancedFilter +type NumberGreaterThanOrEqualsAdvancedFilter = original.NumberGreaterThanOrEqualsAdvancedFilter +type NumberInAdvancedFilter = original.NumberInAdvancedFilter +type NumberLessThanAdvancedFilter = original.NumberLessThanAdvancedFilter +type NumberLessThanOrEqualsAdvancedFilter = original.NumberLessThanOrEqualsAdvancedFilter +type NumberNotInAdvancedFilter = original.NumberNotInAdvancedFilter +type Operation = original.Operation +type OperationInfo = original.OperationInfo +type OperationsClient = original.OperationsClient +type OperationsListResult = original.OperationsListResult +type Resource = original.Resource +type RetryPolicy = original.RetryPolicy +type StorageBlobDeadLetterDestination = original.StorageBlobDeadLetterDestination +type StorageBlobDeadLetterDestinationProperties = original.StorageBlobDeadLetterDestinationProperties +type StorageQueueEventSubscriptionDestination = original.StorageQueueEventSubscriptionDestination +type StorageQueueEventSubscriptionDestinationProperties = original.StorageQueueEventSubscriptionDestinationProperties +type StringBeginsWithAdvancedFilter = original.StringBeginsWithAdvancedFilter +type StringContainsAdvancedFilter = original.StringContainsAdvancedFilter +type StringEndsWithAdvancedFilter = original.StringEndsWithAdvancedFilter +type StringInAdvancedFilter = original.StringInAdvancedFilter +type StringNotInAdvancedFilter = original.StringNotInAdvancedFilter +type Topic = original.Topic +type TopicProperties = original.TopicProperties +type TopicRegenerateKeyRequest = original.TopicRegenerateKeyRequest +type TopicSharedAccessKeys = original.TopicSharedAccessKeys +type TopicTypeInfo = original.TopicTypeInfo +type TopicTypeProperties = original.TopicTypeProperties +type TopicTypesClient = original.TopicTypesClient +type TopicTypesListResult = original.TopicTypesListResult +type TopicUpdateParameters = original.TopicUpdateParameters +type TopicsClient = original.TopicsClient +type TopicsCreateOrUpdateFuture = original.TopicsCreateOrUpdateFuture +type TopicsDeleteFuture = original.TopicsDeleteFuture +type TopicsListResult = original.TopicsListResult +type TopicsUpdateFuture = original.TopicsUpdateFuture +type TrackedResource = original.TrackedResource +type WebHookEventSubscriptionDestination = original.WebHookEventSubscriptionDestination +type WebHookEventSubscriptionDestinationProperties = original.WebHookEventSubscriptionDestinationProperties + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { + return original.NewDomainTopicsClient(subscriptionID) +} +func NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { + return original.NewDomainTopicsClientWithBaseURI(baseURI, subscriptionID) +} +func NewDomainsClient(subscriptionID string) DomainsClient { + return original.NewDomainsClient(subscriptionID) +} +func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { + return original.NewDomainsClientWithBaseURI(baseURI, subscriptionID) +} +func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { + return original.NewEventSubscriptionsClient(subscriptionID) +} +func NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { + return original.NewEventSubscriptionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewTopicTypesClient(subscriptionID string) TopicTypesClient { + return original.NewTopicTypesClient(subscriptionID) +} +func NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { + return original.NewTopicTypesClientWithBaseURI(baseURI, subscriptionID) +} +func NewTopicsClient(subscriptionID string) TopicsClient { + return original.NewTopicsClient(subscriptionID) +} +func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { + return original.NewTopicsClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleDomainProvisioningStateValues() []DomainProvisioningState { + return original.PossibleDomainProvisioningStateValues() +} +func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { + return original.PossibleEndpointTypeBasicDeadLetterDestinationValues() +} +func PossibleEndpointTypeValues() []EndpointType { + return original.PossibleEndpointTypeValues() +} +func PossibleEventDeliverySchemaValues() []EventDeliverySchema { + return original.PossibleEventDeliverySchemaValues() +} +func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { + return original.PossibleEventSubscriptionProvisioningStateValues() +} +func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { + return original.PossibleInputSchemaMappingTypeValues() +} +func PossibleInputSchemaValues() []InputSchema { + return original.PossibleInputSchemaValues() +} +func PossibleOperatorTypeValues() []OperatorType { + return original.PossibleOperatorTypeValues() +} +func PossibleResourceRegionTypeValues() []ResourceRegionType { + return original.PossibleResourceRegionTypeValues() +} +func PossibleTopicProvisioningStateValues() []TopicProvisioningState { + return original.PossibleTopicProvisioningStateValues() +} +func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { + return original.PossibleTopicTypeProvisioningStateValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go deleted file mode 100644 index 0e931f37207f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/models.go +++ /dev/null @@ -1,1208 +0,0 @@ -package eventgrid - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid" - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeEventHub ... - EndpointTypeEventHub EndpointType = "EventHub" - // EndpointTypeEventSubscriptionDestination ... - EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" - // EndpointTypeWebHook ... - EndpointTypeWebHook EndpointType = "WebHook" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeWebHook} -} - -// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. -type EventSubscriptionProvisioningState string - -const ( - // Canceled ... - Canceled EventSubscriptionProvisioningState = "Canceled" - // Creating ... - Creating EventSubscriptionProvisioningState = "Creating" - // Deleting ... - Deleting EventSubscriptionProvisioningState = "Deleting" - // Failed ... - Failed EventSubscriptionProvisioningState = "Failed" - // Succeeded ... - Succeeded EventSubscriptionProvisioningState = "Succeeded" - // Updating ... - Updating EventSubscriptionProvisioningState = "Updating" -) - -// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. -func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { - return []EventSubscriptionProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} -} - -// ResourceRegionType enumerates the values for resource region type. -type ResourceRegionType string - -const ( - // GlobalResource ... - GlobalResource ResourceRegionType = "GlobalResource" - // RegionalResource ... - RegionalResource ResourceRegionType = "RegionalResource" -) - -// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. -func PossibleResourceRegionTypeValues() []ResourceRegionType { - return []ResourceRegionType{GlobalResource, RegionalResource} -} - -// TopicProvisioningState enumerates the values for topic provisioning state. -type TopicProvisioningState string - -const ( - // TopicProvisioningStateCanceled ... - TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" - // TopicProvisioningStateCreating ... - TopicProvisioningStateCreating TopicProvisioningState = "Creating" - // TopicProvisioningStateDeleting ... - TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" - // TopicProvisioningStateFailed ... - TopicProvisioningStateFailed TopicProvisioningState = "Failed" - // TopicProvisioningStateSucceeded ... - TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" - // TopicProvisioningStateUpdating ... - TopicProvisioningStateUpdating TopicProvisioningState = "Updating" -) - -// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. -func PossibleTopicProvisioningStateValues() []TopicProvisioningState { - return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} -} - -// TopicTypeProvisioningState enumerates the values for topic type provisioning state. -type TopicTypeProvisioningState string - -const ( - // TopicTypeProvisioningStateCanceled ... - TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" - // TopicTypeProvisioningStateCreating ... - TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" - // TopicTypeProvisioningStateDeleting ... - TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" - // TopicTypeProvisioningStateFailed ... - TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" - // TopicTypeProvisioningStateSucceeded ... - TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" - // TopicTypeProvisioningStateUpdating ... - TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" -) - -// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. -func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { - return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} -} - -// EventHubEventSubscriptionDestination information about the event hub destination for an event -// subscription -type EventHubEventSubscriptionDestination struct { - // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination - *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - ehesd.EndpointType = EndpointTypeEventHub - objectMap := make(map[string]interface{}) - if ehesd.EventHubEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties - } - if ehesd.EndpointType != "" { - objectMap["endpointType"] = ehesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. -func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &ehesd, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. -func (ehesd *EventHubEventSubscriptionDestination) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) - if err != nil { - return err - } - ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - ehesd.EndpointType = endpointType - } - } - } - - return nil -} - -// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. -type EventHubEventSubscriptionDestinationProperties struct { - // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. - ResourceID *string `json:"resourceId,omitempty"` -} - -// EventSubscription event Subscription -type EventSubscription struct { - autorest.Response `json:"-"` - // EventSubscriptionProperties - Properties of the event subscription - *EventSubscriptionProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventSubscription. -func (es EventSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EventSubscriptionProperties != nil { - objectMap["properties"] = es.EventSubscriptionProperties - } - if es.ID != nil { - objectMap["id"] = es.ID - } - if es.Name != nil { - objectMap["name"] = es.Name - } - if es.Type != nil { - objectMap["type"] = es.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. -func (es *EventSubscription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var eventSubscriptionProperties EventSubscriptionProperties - err = json.Unmarshal(*v, &eventSubscriptionProperties) - if err != nil { - return err - } - es.EventSubscriptionProperties = &eventSubscriptionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// BasicEventSubscriptionDestination information about the destination for an event subscription -type BasicEventSubscriptionDestination interface { - AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) - AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) - AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) -} - -// EventSubscriptionDestination information about the destination for an event subscription -type EventSubscriptionDestination struct { - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["endpointType"] { - case string(EndpointTypeWebHook): - var whesd WebHookEventSubscriptionDestination - err := json.Unmarshal(body, &whesd) - return whesd, err - case string(EndpointTypeEventHub): - var ehesd EventHubEventSubscriptionDestination - err := json.Unmarshal(body, &ehesd) - return ehesd, err - default: - var esd EventSubscriptionDestination - err := json.Unmarshal(body, &esd) - return esd, err - } -} -func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) - - for index, rawMessage := range rawMessages { - esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) - if err != nil { - return nil, err - } - esdArray[index] = esd - } - return esdArray, nil -} - -// MarshalJSON is the custom marshaler for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { - esd.EndpointType = EndpointTypeEventSubscriptionDestination - objectMap := make(map[string]interface{}) - if esd.EndpointType != "" { - objectMap["endpointType"] = esd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return &esd, true -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. -func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &esd, true -} - -// EventSubscriptionFilter filter for the Event Subscription -type EventSubscriptionFilter struct { - // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. - // The format of this depends on the publisher of the events. - // Wildcard characters are not supported in this path. - SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` - // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. - // Wildcard characters are not supported in this path. - SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` - // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. - // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. - IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` - // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter - // should be compared in a case sensitive manner. - IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` -} - -// EventSubscriptionFullURL full endpoint url of an event subscription -type EventSubscriptionFullURL struct { - autorest.Response `json:"-"` - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` -} - -// EventSubscriptionProperties properties of the Event Subscription -type EventSubscriptionProperties struct { - // Topic - Name of the topic of the event subscription. - Topic *string `json:"topic,omitempty"` - // ProvisioningState - Provisioning state of the event subscription. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' - ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. -func (esp *EventSubscriptionProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "topic": - if v != nil { - var topic string - err = json.Unmarshal(*v, &topic) - if err != nil { - return err - } - esp.Topic = &topic - } - case "provisioningState": - if v != nil { - var provisioningState EventSubscriptionProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - esp.ProvisioningState = provisioningState - } - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esp.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esp.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esp.Labels = &labels - } - } - } - - return nil -} - -// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsCreateOrUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *EventSubscriptionsCreateOrUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.CreateOrUpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// EventSubscriptionsListResult result of the List EventSubscriptions operation -type EventSubscriptionsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of EventSubscriptions - Value *[]EventSubscription `json:"value,omitempty"` -} - -// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type EventSubscriptionsUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { - es, err = client.UpdateResponder(es.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") - } - } - return -} - -// EventSubscriptionUpdateParameters properties of the Event Subscription update -type EventSubscriptionUpdateParameters struct { - // Destination - Information about the destination where events have to be delivered for the event subscription. - Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` - // Filter - Information about the filter for the event subscription. - Filter *EventSubscriptionFilter `json:"filter,omitempty"` - // Labels - List of user defined labels. - Labels *[]string `json:"labels,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. -func (esup *EventSubscriptionUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "destination": - if v != nil { - destination, err := unmarshalBasicEventSubscriptionDestination(*v) - if err != nil { - return err - } - esup.Destination = destination - } - case "filter": - if v != nil { - var filter EventSubscriptionFilter - err = json.Unmarshal(*v, &filter) - if err != nil { - return err - } - esup.Filter = &filter - } - case "labels": - if v != nil { - var labels []string - err = json.Unmarshal(*v, &labels) - if err != nil { - return err - } - esup.Labels = &labels - } - } - } - - return nil -} - -// EventType event Type for a subject under a topic -type EventType struct { - // EventTypeProperties - Properties of the event type. - *EventTypeProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventType. -func (et EventType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if et.EventTypeProperties != nil { - objectMap["properties"] = et.EventTypeProperties - } - if et.ID != nil { - objectMap["id"] = et.ID - } - if et.Name != nil { - objectMap["name"] = et.Name - } - if et.Type != nil { - objectMap["type"] = et.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EventType struct. -func (et *EventType) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var eventTypeProperties EventTypeProperties - err = json.Unmarshal(*v, &eventTypeProperties) - if err != nil { - return err - } - et.EventTypeProperties = &eventTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - et.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - et.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - et.Type = &typeVar - } - } - } - - return nil -} - -// EventTypeProperties properties of the event type -type EventTypeProperties struct { - // DisplayName - Display name of the event type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the event type. - Description *string `json:"description,omitempty"` - // SchemaURL - Url of the schema for this event type. - SchemaURL *string `json:"schemaUrl,omitempty"` -} - -// EventTypesListResult result of the List Event Types operation -type EventTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of event types - Value *[]EventType `json:"value,omitempty"` -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // Display - Display name of the operation - Display *OperationInfo `json:"display,omitempty"` - // Origin - Origin of the operation - Origin *string `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties interface{} `json:"properties,omitempty"` -} - -// OperationInfo information about an operation -type OperationInfo struct { - // Provider - Name of the provider - Provider *string `json:"provider,omitempty"` - // Resource - Name of the resource type - Resource *string `json:"resource,omitempty"` - // Operation - Name of the operation - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation - Description *string `json:"description,omitempty"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// Topic eventGrid Topic -type Topic struct { - autorest.Response `json:"-"` - // TopicProperties - Properties of the topic - *TopicProperties `json:"properties,omitempty"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Topic. -func (t Topic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TopicProperties != nil { - objectMap["properties"] = t.TopicProperties - } - if t.Location != nil { - objectMap["location"] = t.Location - } - if t.Tags != nil { - objectMap["tags"] = t.Tags - } - if t.ID != nil { - objectMap["id"] = t.ID - } - if t.Name != nil { - objectMap["name"] = t.Name - } - if t.Type != nil { - objectMap["type"] = t.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Topic struct. -func (t *Topic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var topicProperties TopicProperties - err = json.Unmarshal(*v, &topicProperties) - if err != nil { - return err - } - t.TopicProperties = &topicProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - t.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - t.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TopicProperties properties of the Topic -type TopicProperties struct { - // ProvisioningState - Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' - ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - Endpoint for the topic. - Endpoint *string `json:"endpoint,omitempty"` -} - -// TopicRegenerateKeyRequest topic regenerate share access key request -type TopicRegenerateKeyRequest struct { - // KeyName - Key name to regenerate key1 or key2 - KeyName *string `json:"keyName,omitempty"` -} - -// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type TopicsCreateOrUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.CreateOrUpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// TopicSharedAccessKeys shared access keys of the Topic -type TopicSharedAccessKeys struct { - autorest.Response `json:"-"` - // Key1 - Shared access key1 for the topic. - Key1 *string `json:"key1,omitempty"` - // Key2 - Shared access key2 for the topic. - Key2 *string `json:"key2,omitempty"` -} - -// TopicsListResult result of the List Topics operation -type TopicsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of Topics - Value *[]Topic `json:"value,omitempty"` -} - -// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type TopicsUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *TopicsUpdateFuture) Result(client TopicsClient) (t Topic, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { - t, err = client.UpdateResponder(t.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") - } - } - return -} - -// TopicTypeInfo properties of a topic type info. -type TopicTypeInfo struct { - autorest.Response `json:"-"` - // TopicTypeProperties - Properties of the topic type info - *TopicTypeProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopicTypeInfo. -func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tti.TopicTypeProperties != nil { - objectMap["properties"] = tti.TopicTypeProperties - } - if tti.ID != nil { - objectMap["id"] = tti.ID - } - if tti.Name != nil { - objectMap["name"] = tti.Name - } - if tti.Type != nil { - objectMap["type"] = tti.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. -func (tti *TopicTypeInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var topicTypeProperties TopicTypeProperties - err = json.Unmarshal(*v, &topicTypeProperties) - if err != nil { - return err - } - tti.TopicTypeProperties = &topicTypeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tti.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tti.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tti.Type = &typeVar - } - } - } - - return nil -} - -// TopicTypeProperties properties of a topic type. -type TopicTypeProperties struct { - // Provider - Namespace of the provider of the topic type. - Provider *string `json:"provider,omitempty"` - // DisplayName - Display Name for the topic type. - DisplayName *string `json:"displayName,omitempty"` - // Description - Description of the topic type. - Description *string `json:"description,omitempty"` - // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' - ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` - // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' - ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` - // SupportedLocations - List of locations supported by this topic type. - SupportedLocations *[]string `json:"supportedLocations,omitempty"` -} - -// TopicTypesListResult result of the List Topic Types operation -type TopicTypesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of topic types - Value *[]TopicTypeInfo `json:"value,omitempty"` -} - -// TopicUpdateParameters properties of the Topic update -type TopicUpdateParameters struct { - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TopicUpdateParameters. -func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tup.Tags != nil { - objectMap["tags"] = tup.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource definition of a Tracked Resource -type TrackedResource struct { - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // Tags - Tags of the resource - Tags map[string]*string `json:"tags"` - // ID - Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.ID != nil { - objectMap["id"] = tr.ID - } - if tr.Name != nil { - objectMap["name"] = tr.Name - } - if tr.Type != nil { - objectMap["type"] = tr.Type - } - return json.Marshal(objectMap) -} - -// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription -type WebHookEventSubscriptionDestination struct { - // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination - *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` - // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub' - EndpointType EndpointType `json:"endpointType,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { - whesd.EndpointType = EndpointTypeWebHook - objectMap := make(map[string]interface{}) - if whesd.WebHookEventSubscriptionDestinationProperties != nil { - objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties - } - if whesd.EndpointType != "" { - objectMap["endpointType"] = whesd.EndpointType - } - return json.Marshal(objectMap) -} - -// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { - return &whesd, true -} - -// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { - return nil, false -} - -// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { - return nil, false -} - -// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. -func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { - return &whesd, true -} - -// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. -func (whesd *WebHookEventSubscriptionDestination) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties - err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) - if err != nil { - return err - } - whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties - } - case "endpointType": - if v != nil { - var endpointType EndpointType - err = json.Unmarshal(*v, &endpointType) - if err != nil { - return err - } - whesd.EndpointType = endpointType - } - } - } - - return nil -} - -// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for -// an event subscription. -type WebHookEventSubscriptionDestinationProperties struct { - // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. - EndpointURL *string `json:"endpointUrl,omitempty"` - // EndpointBaseURL - The base URL that represents the endpoint of the destination of an event subscription. - EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go index 677813b81fba..a2db4dbdb3c7 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/client.go @@ -1,4 +1,4 @@ -// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-01-01. +// Package eventgrid implements the Azure ARM Eventgrid service API version 2018-09-15-preview. // // Azure EventGrid Management Client package eventgrid diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go new file mode 100644 index 000000000000..ea412b84e25b --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domains.go @@ -0,0 +1,665 @@ +package eventgrid + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainsClient is the azure EventGrid Management Client +type DomainsClient struct { + BaseClient +} + +// NewDomainsClient creates an instance of the DomainsClient client. +func NewDomainsClient(subscriptionID string) DomainsClient { + return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client. +func NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { + return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new domain with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +// domainInfo - domain information +func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", pathParameters), + autorest.WithJSON(domainInfo), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete existing domain +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get properties of a domain +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the domains under a resource group +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription list all the domains under an Azure subscription +func (client DomainsClient) ListBySubscription(ctx context.Context) (result DomainsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSharedAccessKeys list the two keys used to publish to a domain +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListSharedAccessKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") + return + } + + result, err = client.ListSharedAccessKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") + } + + return +} + +// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. +func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate a shared access key for a domain +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +// regenerateKeyRequest - request body to regenerate key +func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.RegenerateKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: regenerateKeyRequest, + Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update asynchronously updates a domain with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +// domainUpdateParameters - domain update information +func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", pathParameters), + autorest.WithJSON(domainUpdateParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DomainsClient) UpdateResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go new file mode 100644 index 000000000000..7f97a096ad49 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/domaintopics.go @@ -0,0 +1,197 @@ +package eventgrid + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainTopicsClient is the azure EventGrid Management Client +type DomainTopicsClient struct { + BaseClient +} + +// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. +func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { + return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient client. +func NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { + return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get properties of a domain topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain +// topicName - name of the topic +func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result DomainTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, domainName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainTopicsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDomain list all the topics in a domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - domain name. +func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string) (result DomainTopicsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") + return + } + + result, err = client.ListByDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") + } + + return +} + +// ListByDomainPreparer prepares the ListByDomain request. +func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDomainSender sends the ListByDomain request. The method will close the +// http.Response Body if it receives an error. +func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDomainResponder handles the response to the ListByDomain request. The method always +// closes the http.Response Body. +func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go similarity index 92% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go index cb84fb01fac8..5f68dccbf8b5 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/eventsubscriptions.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/eventsubscriptions.go @@ -87,7 +87,7 @@ func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Contex "scope": scope, } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,7 +172,7 @@ func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope "scope": scope, } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -260,7 +260,7 @@ func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope st "scope": scope, } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -343,7 +343,7 @@ func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, s "scope": scope, } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -376,6 +376,85 @@ func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) return } +// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the top level domain +// topicName - name of the domain topic +func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string) (result EventSubscriptionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDomainTopicSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") + return + } + + result, err = client.ListByDomainTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") + } + + return +} + +// ListByDomainTopicPreparer prepares the ListByDomainTopic request. +func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2018-09-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListByResource list all event subscriptions that have been created for a specific topic // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. @@ -424,7 +503,7 @@ func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -499,7 +578,7 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -577,7 +656,7 @@ func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePrep "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -649,7 +728,7 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -725,7 +804,7 @@ func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePrepa "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -803,7 +882,7 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -883,7 +962,7 @@ func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePr "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -958,7 +1037,7 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1036,7 +1115,7 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePre "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1079,7 +1158,7 @@ func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeRes // for a resource, and // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' // for an EventGrid topic. -// eventSubscriptionName - name of the event subscription to be created +// eventSubscriptionName - name of the event subscription to be updated // eventSubscriptionUpdateParameters - updated event subscription information func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { if tracing.IsEnabled() { @@ -1114,7 +1193,7 @@ func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope "scope": scope, } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go new file mode 100644 index 000000000000..6ad697f4b940 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/models.go @@ -0,0 +1,3765 @@ +package eventgrid + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid" + +// DomainProvisioningState enumerates the values for domain provisioning state. +type DomainProvisioningState string + +const ( + // Canceled ... + Canceled DomainProvisioningState = "Canceled" + // Creating ... + Creating DomainProvisioningState = "Creating" + // Deleting ... + Deleting DomainProvisioningState = "Deleting" + // Failed ... + Failed DomainProvisioningState = "Failed" + // Succeeded ... + Succeeded DomainProvisioningState = "Succeeded" + // Updating ... + Updating DomainProvisioningState = "Updating" +) + +// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. +func PossibleDomainProvisioningStateValues() []DomainProvisioningState { + return []DomainProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeEventHub ... + EndpointTypeEventHub EndpointType = "EventHub" + // EndpointTypeEventSubscriptionDestination ... + EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" + // EndpointTypeHybridConnection ... + EndpointTypeHybridConnection EndpointType = "HybridConnection" + // EndpointTypeStorageQueue ... + EndpointTypeStorageQueue EndpointType = "StorageQueue" + // EndpointTypeWebHook ... + EndpointTypeWebHook EndpointType = "WebHook" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeStorageQueue, EndpointTypeWebHook} +} + +// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter +// destination. +type EndpointTypeBasicDeadLetterDestination string + +const ( + // EndpointTypeDeadLetterDestination ... + EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" + // EndpointTypeStorageBlob ... + EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" +) + +// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. +func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { + return []EndpointTypeBasicDeadLetterDestination{EndpointTypeDeadLetterDestination, EndpointTypeStorageBlob} +} + +// EventDeliverySchema enumerates the values for event delivery schema. +type EventDeliverySchema string + +const ( + // CloudEventV01Schema ... + CloudEventV01Schema EventDeliverySchema = "CloudEventV01Schema" + // CustomInputSchema ... + CustomInputSchema EventDeliverySchema = "CustomInputSchema" + // EventGridSchema ... + EventGridSchema EventDeliverySchema = "EventGridSchema" +) + +// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. +func PossibleEventDeliverySchemaValues() []EventDeliverySchema { + return []EventDeliverySchema{CloudEventV01Schema, CustomInputSchema, EventGridSchema} +} + +// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. +type EventSubscriptionProvisioningState string + +const ( + // EventSubscriptionProvisioningStateAwaitingManualAction ... + EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" + // EventSubscriptionProvisioningStateCanceled ... + EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" + // EventSubscriptionProvisioningStateCreating ... + EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" + // EventSubscriptionProvisioningStateDeleting ... + EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" + // EventSubscriptionProvisioningStateFailed ... + EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" + // EventSubscriptionProvisioningStateSucceeded ... + EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" + // EventSubscriptionProvisioningStateUpdating ... + EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" +) + +// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. +func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { + return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} +} + +// InputSchema enumerates the values for input schema. +type InputSchema string + +const ( + // InputSchemaCloudEventV01Schema ... + InputSchemaCloudEventV01Schema InputSchema = "CloudEventV01Schema" + // InputSchemaCustomEventSchema ... + InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" + // InputSchemaEventGridSchema ... + InputSchemaEventGridSchema InputSchema = "EventGridSchema" +) + +// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. +func PossibleInputSchemaValues() []InputSchema { + return []InputSchema{InputSchemaCloudEventV01Schema, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} +} + +// InputSchemaMappingType enumerates the values for input schema mapping type. +type InputSchemaMappingType string + +const ( + // InputSchemaMappingTypeInputSchemaMapping ... + InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" + // InputSchemaMappingTypeJSON ... + InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" +) + +// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. +func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { + return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // OperatorTypeAdvancedFilter ... + OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" + // OperatorTypeBoolEquals ... + OperatorTypeBoolEquals OperatorType = "BoolEquals" + // OperatorTypeNumberGreaterThan ... + OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" + // OperatorTypeNumberGreaterThanOrEquals ... + OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" + // OperatorTypeNumberIn ... + OperatorTypeNumberIn OperatorType = "NumberIn" + // OperatorTypeNumberLessThan ... + OperatorTypeNumberLessThan OperatorType = "NumberLessThan" + // OperatorTypeNumberLessThanOrEquals ... + OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" + // OperatorTypeNumberNotIn ... + OperatorTypeNumberNotIn OperatorType = "NumberNotIn" + // OperatorTypeStringBeginsWith ... + OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" + // OperatorTypeStringContains ... + OperatorTypeStringContains OperatorType = "StringContains" + // OperatorTypeStringEndsWith ... + OperatorTypeStringEndsWith OperatorType = "StringEndsWith" + // OperatorTypeStringIn ... + OperatorTypeStringIn OperatorType = "StringIn" + // OperatorTypeStringNotIn ... + OperatorTypeStringNotIn OperatorType = "StringNotIn" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} +} + +// ResourceRegionType enumerates the values for resource region type. +type ResourceRegionType string + +const ( + // GlobalResource ... + GlobalResource ResourceRegionType = "GlobalResource" + // RegionalResource ... + RegionalResource ResourceRegionType = "RegionalResource" +) + +// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. +func PossibleResourceRegionTypeValues() []ResourceRegionType { + return []ResourceRegionType{GlobalResource, RegionalResource} +} + +// TopicProvisioningState enumerates the values for topic provisioning state. +type TopicProvisioningState string + +const ( + // TopicProvisioningStateCanceled ... + TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" + // TopicProvisioningStateCreating ... + TopicProvisioningStateCreating TopicProvisioningState = "Creating" + // TopicProvisioningStateDeleting ... + TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" + // TopicProvisioningStateFailed ... + TopicProvisioningStateFailed TopicProvisioningState = "Failed" + // TopicProvisioningStateSucceeded ... + TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" + // TopicProvisioningStateUpdating ... + TopicProvisioningStateUpdating TopicProvisioningState = "Updating" +) + +// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. +func PossibleTopicProvisioningStateValues() []TopicProvisioningState { + return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} +} + +// TopicTypeProvisioningState enumerates the values for topic type provisioning state. +type TopicTypeProvisioningState string + +const ( + // TopicTypeProvisioningStateCanceled ... + TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" + // TopicTypeProvisioningStateCreating ... + TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" + // TopicTypeProvisioningStateDeleting ... + TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" + // TopicTypeProvisioningStateFailed ... + TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" + // TopicTypeProvisioningStateSucceeded ... + TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" + // TopicTypeProvisioningStateUpdating ... + TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" +) + +// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. +func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { + return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} +} + +// BasicAdvancedFilter represents an advanced filter that can be used to filter events based on various event +// envelope/data fields. +type BasicAdvancedFilter interface { + AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) + AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) + AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) + AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) + AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) + AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) + AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) + AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) + AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) + AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) + AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) + AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) + AsAdvancedFilter() (*AdvancedFilter, bool) +} + +// AdvancedFilter represents an advanced filter that can be used to filter events based on various event +// envelope/data fields. +type AdvancedFilter struct { + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["operatorType"] { + case string(OperatorTypeNumberIn): + var niaf NumberInAdvancedFilter + err := json.Unmarshal(body, &niaf) + return niaf, err + case string(OperatorTypeNumberNotIn): + var nniaf NumberNotInAdvancedFilter + err := json.Unmarshal(body, &nniaf) + return nniaf, err + case string(OperatorTypeNumberLessThan): + var nltaf NumberLessThanAdvancedFilter + err := json.Unmarshal(body, &nltaf) + return nltaf, err + case string(OperatorTypeNumberGreaterThan): + var ngtaf NumberGreaterThanAdvancedFilter + err := json.Unmarshal(body, &ngtaf) + return ngtaf, err + case string(OperatorTypeNumberLessThanOrEquals): + var nltoeaf NumberLessThanOrEqualsAdvancedFilter + err := json.Unmarshal(body, &nltoeaf) + return nltoeaf, err + case string(OperatorTypeNumberGreaterThanOrEquals): + var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter + err := json.Unmarshal(body, &ngtoeaf) + return ngtoeaf, err + case string(OperatorTypeBoolEquals): + var beaf BoolEqualsAdvancedFilter + err := json.Unmarshal(body, &beaf) + return beaf, err + case string(OperatorTypeStringIn): + var siaf StringInAdvancedFilter + err := json.Unmarshal(body, &siaf) + return siaf, err + case string(OperatorTypeStringNotIn): + var sniaf StringNotInAdvancedFilter + err := json.Unmarshal(body, &sniaf) + return sniaf, err + case string(OperatorTypeStringBeginsWith): + var sbwaf StringBeginsWithAdvancedFilter + err := json.Unmarshal(body, &sbwaf) + return sbwaf, err + case string(OperatorTypeStringEndsWith): + var sewaf StringEndsWithAdvancedFilter + err := json.Unmarshal(body, &sewaf) + return sewaf, err + case string(OperatorTypeStringContains): + var scaf StringContainsAdvancedFilter + err := json.Unmarshal(body, &scaf) + return scaf, err + default: + var af AdvancedFilter + err := json.Unmarshal(body, &af) + return af, err + } +} +func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + afArray := make([]BasicAdvancedFilter, len(rawMessages)) + + for index, rawMessage := range rawMessages { + af, err := unmarshalBasicAdvancedFilter(*rawMessage) + if err != nil { + return nil, err + } + afArray[index] = af + } + return afArray, nil +} + +// MarshalJSON is the custom marshaler for AdvancedFilter. +func (af AdvancedFilter) MarshalJSON() ([]byte, error) { + af.OperatorType = OperatorTypeAdvancedFilter + objectMap := make(map[string]interface{}) + if af.Key != nil { + objectMap["key"] = af.Key + } + if af.OperatorType != "" { + objectMap["operatorType"] = af.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return &af, true +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &af, true +} + +// BoolEqualsAdvancedFilter boolEquals Filter +type BoolEqualsAdvancedFilter struct { + // Value - The filter value + Value *bool `json:"value,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + beaf.OperatorType = OperatorTypeBoolEquals + objectMap := make(map[string]interface{}) + if beaf.Value != nil { + objectMap["value"] = beaf.Value + } + if beaf.Key != nil { + objectMap["key"] = beaf.Key + } + if beaf.OperatorType != "" { + objectMap["operatorType"] = beaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return &beaf, true +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &beaf, true +} + +// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a +// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a +// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. +type BasicDeadLetterDestination interface { + AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) + AsDeadLetterDestination() (*DeadLetterDestination, bool) +} + +// DeadLetterDestination information about the dead letter destination for an event subscription. To configure +// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an +// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from +// this class. +type DeadLetterDestination struct { + // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' + EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` +} + +func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointType"] { + case string(EndpointTypeStorageBlob): + var sbdld StorageBlobDeadLetterDestination + err := json.Unmarshal(body, &sbdld) + return sbdld, err + default: + var dld DeadLetterDestination + err := json.Unmarshal(body, &dld) + return dld, err + } +} +func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) + if err != nil { + return nil, err + } + dldArray[index] = dld + } + return dldArray, nil +} + +// MarshalJSON is the custom marshaler for DeadLetterDestination. +func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { + dld.EndpointType = EndpointTypeDeadLetterDestination + objectMap := make(map[string]interface{}) + if dld.EndpointType != "" { + objectMap["endpointType"] = dld.EndpointType + } + return json.Marshal(objectMap) +} + +// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { + return nil, false +} + +// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { + return &dld, true +} + +// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { + return &dld, true +} + +// Domain eventGrid Domain +type Domain struct { + autorest.Response `json:"-"` + // DomainProperties - Properties of the domain + *DomainProperties `json:"properties,omitempty"` + // Location - Location of the resource + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource + Tags map[string]*string `json:"tags"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Domain. +func (d Domain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DomainProperties != nil { + objectMap["properties"] = d.DomainProperties + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + if d.ID != nil { + objectMap["id"] = d.ID + } + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.Type != nil { + objectMap["type"] = d.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Domain struct. +func (d *Domain) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var domainProperties DomainProperties + err = json.Unmarshal(*v, &domainProperties) + if err != nil { + return err + } + d.DomainProperties = &domainProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DomainProperties properties of the Domain +type DomainProperties struct { + // ProvisioningState - Provisioning state of the domain. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Canceled', 'Failed' + ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` + // Endpoint - Endpoint for the domain. + Endpoint *string `json:"endpoint,omitempty"` + // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' + InputSchema InputSchema `json:"inputSchema,omitempty"` + // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. + InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. +func (dp *DomainProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState DomainProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + dp.ProvisioningState = provisioningState + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + dp.Endpoint = &endpoint + } + case "inputSchema": + if v != nil { + var inputSchema InputSchema + err = json.Unmarshal(*v, &inputSchema) + if err != nil { + return err + } + dp.InputSchema = inputSchema + } + case "inputSchemaMapping": + if v != nil { + inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) + if err != nil { + return err + } + dp.InputSchemaMapping = inputSchemaMapping + } + } + } + + return nil +} + +// DomainRegenerateKeyRequest domain regenerate share access key request +type DomainRegenerateKeyRequest struct { + // KeyName - Key name to regenerate key1 or key2 + KeyName *string `json:"keyName,omitempty"` +} + +// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainsCreateOrUpdateFuture) Result(client DomainsClient) (d Domain, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainsDeleteFuture) Result(client DomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DomainSharedAccessKeys shared access keys of the Domain +type DomainSharedAccessKeys struct { + autorest.Response `json:"-"` + // Key1 - Shared access key1 for the domain. + Key1 *string `json:"key1,omitempty"` + // Key2 - Shared access key2 for the domain. + Key2 *string `json:"key2,omitempty"` +} + +// DomainsListResult result of the List Domains operation +type DomainsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Domains + Value *[]Domain `json:"value,omitempty"` +} + +// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainsUpdateFuture) Result(client DomainsClient) (d Domain, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainTopic domain Topic +type DomainTopic struct { + autorest.Response `json:"-"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// DomainTopicsListResult result of the List Domain Topics operation +type DomainTopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Domain Topics + Value *[]DomainTopic `json:"value,omitempty"` +} + +// DomainUpdateParameters properties of the Domain update +type DomainUpdateParameters struct { + // Tags - Tags of the domains resource + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DomainUpdateParameters. +func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dup.Tags != nil { + objectMap["tags"] = dup.Tags + } + return json.Marshal(objectMap) +} + +// EventHubEventSubscriptionDestination information about the event hub destination for an event +// subscription +type EventHubEventSubscriptionDestination struct { + // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination + *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + ehesd.EndpointType = EndpointTypeEventHub + objectMap := make(map[string]interface{}) + if ehesd.EventHubEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties + } + if ehesd.EndpointType != "" { + objectMap["endpointType"] = ehesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return &ehesd, true +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &ehesd, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. +func (ehesd *EventHubEventSubscriptionDestination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) + if err != nil { + return err + } + ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + ehesd.EndpointType = endpointType + } + } + } + + return nil +} + +// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. +type EventHubEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` +} + +// EventSubscription event Subscription +type EventSubscription struct { + autorest.Response `json:"-"` + // EventSubscriptionProperties - Properties of the event subscription + *EventSubscriptionProperties `json:"properties,omitempty"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventSubscription. +func (es EventSubscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.EventSubscriptionProperties != nil { + objectMap["properties"] = es.EventSubscriptionProperties + } + if es.ID != nil { + objectMap["id"] = es.ID + } + if es.Name != nil { + objectMap["name"] = es.Name + } + if es.Type != nil { + objectMap["type"] = es.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. +func (es *EventSubscription) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventSubscriptionProperties EventSubscriptionProperties + err = json.Unmarshal(*v, &eventSubscriptionProperties) + if err != nil { + return err + } + es.EventSubscriptionProperties = &eventSubscriptionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + es.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + es.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + es.Type = &typeVar + } + } + } + + return nil +} + +// BasicEventSubscriptionDestination information about the destination for an event subscription +type BasicEventSubscriptionDestination interface { + AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) + AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) + AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) + AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) + AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) +} + +// EventSubscriptionDestination information about the destination for an event subscription +type EventSubscriptionDestination struct { + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointType"] { + case string(EndpointTypeWebHook): + var whesd WebHookEventSubscriptionDestination + err := json.Unmarshal(body, &whesd) + return whesd, err + case string(EndpointTypeEventHub): + var ehesd EventHubEventSubscriptionDestination + err := json.Unmarshal(body, &ehesd) + return ehesd, err + case string(EndpointTypeStorageQueue): + var sqesd StorageQueueEventSubscriptionDestination + err := json.Unmarshal(body, &sqesd) + return sqesd, err + case string(EndpointTypeHybridConnection): + var hcesd HybridConnectionEventSubscriptionDestination + err := json.Unmarshal(body, &hcesd) + return hcesd, err + default: + var esd EventSubscriptionDestination + err := json.Unmarshal(body, &esd) + return esd, err + } +} +func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) + + for index, rawMessage := range rawMessages { + esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) + if err != nil { + return nil, err + } + esdArray[index] = esd + } + return esdArray, nil +} + +// MarshalJSON is the custom marshaler for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { + esd.EndpointType = EndpointTypeEventSubscriptionDestination + objectMap := make(map[string]interface{}) + if esd.EndpointType != "" { + objectMap["endpointType"] = esd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return &esd, true +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &esd, true +} + +// EventSubscriptionFilter filter for the Event Subscription +type EventSubscriptionFilter struct { + // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. + // The format of this depends on the publisher of the events. + // Wildcard characters are not supported in this path. + SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` + // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. + // Wildcard characters are not supported in this path. + SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` + // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. + // If it is desired to subscribe to all event types, the string "all" needs to be specified as an element in this list. + IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` + // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter + // should be compared in a case sensitive manner. + IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` + // AdvancedFilters - A list of advanced filters. + AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. +func (esf *EventSubscriptionFilter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "subjectBeginsWith": + if v != nil { + var subjectBeginsWith string + err = json.Unmarshal(*v, &subjectBeginsWith) + if err != nil { + return err + } + esf.SubjectBeginsWith = &subjectBeginsWith + } + case "subjectEndsWith": + if v != nil { + var subjectEndsWith string + err = json.Unmarshal(*v, &subjectEndsWith) + if err != nil { + return err + } + esf.SubjectEndsWith = &subjectEndsWith + } + case "includedEventTypes": + if v != nil { + var includedEventTypes []string + err = json.Unmarshal(*v, &includedEventTypes) + if err != nil { + return err + } + esf.IncludedEventTypes = &includedEventTypes + } + case "isSubjectCaseSensitive": + if v != nil { + var isSubjectCaseSensitive bool + err = json.Unmarshal(*v, &isSubjectCaseSensitive) + if err != nil { + return err + } + esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive + } + case "advancedFilters": + if v != nil { + advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) + if err != nil { + return err + } + esf.AdvancedFilters = &advancedFilters + } + } + } + + return nil +} + +// EventSubscriptionFullURL full endpoint url of an event subscription +type EventSubscriptionFullURL struct { + autorest.Response `json:"-"` + // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. + EndpointURL *string `json:"endpointUrl,omitempty"` +} + +// EventSubscriptionProperties properties of the Event Subscription +type EventSubscriptionProperties struct { + // Topic - Name of the topic of the event subscription. + Topic *string `json:"topic,omitempty"` + // ProvisioningState - Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' + ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` + // Destination - Information about the destination where events have to be delivered for the event subscription. + Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` + // Filter - Information about the filter for the event subscription. + Filter *EventSubscriptionFilter `json:"filter,omitempty"` + // Labels - List of user defined labels. + Labels *[]string `json:"labels,omitempty"` + // ExpirationTimeUtc - Expiration time of the event subscription. + ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` + // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' + EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` + // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + // DeadLetterDestination - The DeadLetter destination of the event subscription. + DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. +func (esp *EventSubscriptionProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "topic": + if v != nil { + var topic string + err = json.Unmarshal(*v, &topic) + if err != nil { + return err + } + esp.Topic = &topic + } + case "provisioningState": + if v != nil { + var provisioningState EventSubscriptionProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + esp.ProvisioningState = provisioningState + } + case "destination": + if v != nil { + destination, err := unmarshalBasicEventSubscriptionDestination(*v) + if err != nil { + return err + } + esp.Destination = destination + } + case "filter": + if v != nil { + var filter EventSubscriptionFilter + err = json.Unmarshal(*v, &filter) + if err != nil { + return err + } + esp.Filter = &filter + } + case "labels": + if v != nil { + var labels []string + err = json.Unmarshal(*v, &labels) + if err != nil { + return err + } + esp.Labels = &labels + } + case "expirationTimeUtc": + if v != nil { + var expirationTimeUtc date.Time + err = json.Unmarshal(*v, &expirationTimeUtc) + if err != nil { + return err + } + esp.ExpirationTimeUtc = &expirationTimeUtc + } + case "eventDeliverySchema": + if v != nil { + var eventDeliverySchema EventDeliverySchema + err = json.Unmarshal(*v, &eventDeliverySchema) + if err != nil { + return err + } + esp.EventDeliverySchema = eventDeliverySchema + } + case "retryPolicy": + if v != nil { + var retryPolicy RetryPolicy + err = json.Unmarshal(*v, &retryPolicy) + if err != nil { + return err + } + esp.RetryPolicy = &retryPolicy + } + case "deadLetterDestination": + if v != nil { + deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) + if err != nil { + return err + } + esp.DeadLetterDestination = deadLetterDestination + } + } + } + + return nil +} + +// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EventSubscriptionsCreateOrUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EventSubscriptionsDeleteFuture) Result(client EventSubscriptionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EventSubscriptionsListResult result of the List EventSubscriptions operation +type EventSubscriptionsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of EventSubscriptions + Value *[]EventSubscription `json:"value,omitempty"` +} + +// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EventSubscriptionsUpdateFuture) Result(client EventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.UpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// EventSubscriptionUpdateParameters properties of the Event Subscription update +type EventSubscriptionUpdateParameters struct { + // Destination - Information about the destination where events have to be delivered for the event subscription. + Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` + // Filter - Information about the filter for the event subscription. + Filter *EventSubscriptionFilter `json:"filter,omitempty"` + // Labels - List of user defined labels. + Labels *[]string `json:"labels,omitempty"` + // ExpirationTimeUtc - Information about the expiration time for the event subscription. + ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` + // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventGridSchema', 'CloudEventV01Schema', 'CustomInputSchema' + EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` + // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + // DeadLetterDestination - The DeadLetter destination of the event subscription. + DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. +func (esup *EventSubscriptionUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "destination": + if v != nil { + destination, err := unmarshalBasicEventSubscriptionDestination(*v) + if err != nil { + return err + } + esup.Destination = destination + } + case "filter": + if v != nil { + var filter EventSubscriptionFilter + err = json.Unmarshal(*v, &filter) + if err != nil { + return err + } + esup.Filter = &filter + } + case "labels": + if v != nil { + var labels []string + err = json.Unmarshal(*v, &labels) + if err != nil { + return err + } + esup.Labels = &labels + } + case "expirationTimeUtc": + if v != nil { + var expirationTimeUtc date.Time + err = json.Unmarshal(*v, &expirationTimeUtc) + if err != nil { + return err + } + esup.ExpirationTimeUtc = &expirationTimeUtc + } + case "eventDeliverySchema": + if v != nil { + var eventDeliverySchema EventDeliverySchema + err = json.Unmarshal(*v, &eventDeliverySchema) + if err != nil { + return err + } + esup.EventDeliverySchema = eventDeliverySchema + } + case "retryPolicy": + if v != nil { + var retryPolicy RetryPolicy + err = json.Unmarshal(*v, &retryPolicy) + if err != nil { + return err + } + esup.RetryPolicy = &retryPolicy + } + case "deadLetterDestination": + if v != nil { + deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) + if err != nil { + return err + } + esup.DeadLetterDestination = deadLetterDestination + } + } + } + + return nil +} + +// EventType event Type for a subject under a topic +type EventType struct { + // EventTypeProperties - Properties of the event type. + *EventTypeProperties `json:"properties,omitempty"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventType. +func (et EventType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.EventTypeProperties != nil { + objectMap["properties"] = et.EventTypeProperties + } + if et.ID != nil { + objectMap["id"] = et.ID + } + if et.Name != nil { + objectMap["name"] = et.Name + } + if et.Type != nil { + objectMap["type"] = et.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventType struct. +func (et *EventType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventTypeProperties EventTypeProperties + err = json.Unmarshal(*v, &eventTypeProperties) + if err != nil { + return err + } + et.EventTypeProperties = &eventTypeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + et.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + et.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + et.Type = &typeVar + } + } + } + + return nil +} + +// EventTypeProperties properties of the event type +type EventTypeProperties struct { + // DisplayName - Display name of the event type. + DisplayName *string `json:"displayName,omitempty"` + // Description - Description of the event type. + Description *string `json:"description,omitempty"` + // SchemaURL - Url of the schema for this event type. + SchemaURL *string `json:"schemaUrl,omitempty"` +} + +// EventTypesListResult result of the List Event Types operation +type EventTypesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of event types + Value *[]EventType `json:"value,omitempty"` +} + +// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an +// event subscription. +type HybridConnectionEventSubscriptionDestination struct { + // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination + *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + hcesd.EndpointType = EndpointTypeHybridConnection + objectMap := make(map[string]interface{}) + if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties + } + if hcesd.EndpointType != "" { + objectMap["endpointType"] = hcesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return &hcesd, true +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &hcesd, true +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. +func (hcesd *HybridConnectionEventSubscriptionDestination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) + if err != nil { + return err + } + hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + hcesd.EndpointType = endpointType + } + } + } + + return nil +} + +// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection +// destination. +type HybridConnectionEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` +} + +// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an +// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported +// type of InputSchemaMapping is 'JsonInputSchemaMapping'. +type BasicInputSchemaMapping interface { + AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) + AsInputSchemaMapping() (*InputSchemaMapping, bool) +} + +// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an +// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only +// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. +type InputSchemaMapping struct { + // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' + InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` +} + +func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["inputSchemaMappingType"] { + case string(InputSchemaMappingTypeJSON): + var jism JSONInputSchemaMapping + err := json.Unmarshal(body, &jism) + return jism, err + default: + var ism InputSchemaMapping + err := json.Unmarshal(body, &ism) + return ism, err + } +} +func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) + if err != nil { + return nil, err + } + ismArray[index] = ism + } + return ismArray, nil +} + +// MarshalJSON is the custom marshaler for InputSchemaMapping. +func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { + ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping + objectMap := make(map[string]interface{}) + if ism.InputSchemaMappingType != "" { + objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType + } + return json.Marshal(objectMap) +} + +// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { + return nil, false +} + +// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { + return &ism, true +} + +// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { + return &ism, true +} + +// JSONField this is used to express the source of an input schema mapping for a single target field in the +// Event Grid Event schema. This is currently used in the mappings for the 'id','topic' and 'eventTime' +// properties. This represents a field in the input event schema. +type JSONField struct { + // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. + SourceField *string `json:"sourceField,omitempty"` +} + +// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target +// field in the Event Grid Event schema. This is currently used in the mappings for the +// 'subject','eventType' and 'dataVersion' properties. This represents a field in the input event schema +// along with a default value to be used, and at least one of these two properties should be provided. +type JSONFieldWithDefault struct { + // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. + SourceField *string `json:"sourceField,omitempty"` + // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. + DefaultValue *string `json:"defaultValue,omitempty"` +} + +// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be +// used to map properties from a custom input JSON schema to the Event Grid event schema. +type JSONInputSchemaMapping struct { + // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping + *JSONInputSchemaMappingProperties `json:"properties,omitempty"` + // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' + InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` +} + +// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { + jism.InputSchemaMappingType = InputSchemaMappingTypeJSON + objectMap := make(map[string]interface{}) + if jism.JSONInputSchemaMappingProperties != nil { + objectMap["properties"] = jism.JSONInputSchemaMappingProperties + } + if jism.InputSchemaMappingType != "" { + objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType + } + return json.Marshal(objectMap) +} + +// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { + return &jism, true +} + +// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { + return nil, false +} + +// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { + return &jism, true +} + +// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. +func (jism *JSONInputSchemaMapping) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties + err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) + if err != nil { + return err + } + jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties + } + case "inputSchemaMappingType": + if v != nil { + var inputSchemaMappingType InputSchemaMappingType + err = json.Unmarshal(*v, &inputSchemaMappingType) + if err != nil { + return err + } + jism.InputSchemaMappingType = inputSchemaMappingType + } + } + } + + return nil +} + +// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default +// values, for certain supported properties) to properties of the EventGridEvent schema. +type JSONInputSchemaMappingProperties struct { + // ID - The mapping information for the Id property of the Event Grid Event. + ID *JSONField `json:"id,omitempty"` + // Topic - The mapping information for the Topic property of the Event Grid Event. + Topic *JSONField `json:"topic,omitempty"` + // EventTime - The mapping information for the EventTime property of the Event Grid Event. + EventTime *JSONField `json:"eventTime,omitempty"` + // EventType - The mapping information for the EventType property of the Event Grid Event. + EventType *JSONFieldWithDefault `json:"eventType,omitempty"` + // Subject - The mapping information for the Subject property of the Event Grid Event. + Subject *JSONFieldWithDefault `json:"subject,omitempty"` + // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. + DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` +} + +// NumberGreaterThanAdvancedFilter numberGreaterThan Filter +type NumberGreaterThanAdvancedFilter struct { + // Value - The filter value + Value *float64 `json:"value,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { + ngtaf.OperatorType = OperatorTypeNumberGreaterThan + objectMap := make(map[string]interface{}) + if ngtaf.Value != nil { + objectMap["value"] = ngtaf.Value + } + if ngtaf.Key != nil { + objectMap["key"] = ngtaf.Key + } + if ngtaf.OperatorType != "" { + objectMap["operatorType"] = ngtaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return &ngtaf, true +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &ngtaf, true +} + +// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Filter +type NumberGreaterThanOrEqualsAdvancedFilter struct { + // Value - The filter value + Value *float64 `json:"value,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals + objectMap := make(map[string]interface{}) + if ngtoeaf.Value != nil { + objectMap["value"] = ngtoeaf.Value + } + if ngtoeaf.Key != nil { + objectMap["key"] = ngtoeaf.Key + } + if ngtoeaf.OperatorType != "" { + objectMap["operatorType"] = ngtoeaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return &ngtoeaf, true +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &ngtoeaf, true +} + +// NumberInAdvancedFilter numberIn filter +type NumberInAdvancedFilter struct { + // Values - The set of filter values + Values *[]float64 `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { + niaf.OperatorType = OperatorTypeNumberIn + objectMap := make(map[string]interface{}) + if niaf.Values != nil { + objectMap["values"] = niaf.Values + } + if niaf.Key != nil { + objectMap["key"] = niaf.Key + } + if niaf.OperatorType != "" { + objectMap["operatorType"] = niaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return &niaf, true +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &niaf, true +} + +// NumberLessThanAdvancedFilter numberLessThan Filter +type NumberLessThanAdvancedFilter struct { + // Value - The filter value + Value *float64 `json:"value,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { + nltaf.OperatorType = OperatorTypeNumberLessThan + objectMap := make(map[string]interface{}) + if nltaf.Value != nil { + objectMap["value"] = nltaf.Value + } + if nltaf.Key != nil { + objectMap["key"] = nltaf.Key + } + if nltaf.OperatorType != "" { + objectMap["operatorType"] = nltaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return &nltaf, true +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nltaf, true +} + +// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Filter +type NumberLessThanOrEqualsAdvancedFilter struct { + // Value - The filter value + Value *float64 `json:"value,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals + objectMap := make(map[string]interface{}) + if nltoeaf.Value != nil { + objectMap["value"] = nltoeaf.Value + } + if nltoeaf.Key != nil { + objectMap["key"] = nltoeaf.Key + } + if nltoeaf.OperatorType != "" { + objectMap["operatorType"] = nltoeaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return &nltoeaf, true +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nltoeaf, true +} + +// NumberNotInAdvancedFilter numberNotIn Filter +type NumberNotInAdvancedFilter struct { + // Values - The set of filter values + Values *[]float64 `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { + nniaf.OperatorType = OperatorTypeNumberNotIn + objectMap := make(map[string]interface{}) + if nniaf.Values != nil { + objectMap["values"] = nniaf.Values + } + if nniaf.Key != nil { + objectMap["key"] = nniaf.Key + } + if nniaf.OperatorType != "" { + objectMap["operatorType"] = nniaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return &nniaf, true +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nniaf, true +} + +// Operation represents an operation returned by the GetOperations request +type Operation struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // Display - Display name of the operation + Display *OperationInfo `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties interface{} `json:"properties,omitempty"` +} + +// OperationInfo information about an operation +type OperationInfo struct { + // Provider - Name of the provider + Provider *string `json:"provider,omitempty"` + // Resource - Name of the resource type + Resource *string `json:"resource,omitempty"` + // Operation - Name of the operation + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation + Description *string `json:"description,omitempty"` +} + +// OperationsListResult result of the List Operations operation +type OperationsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of operations + Value *[]Operation `json:"value,omitempty"` +} + +// Resource definition of a Resource +type Resource struct { + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// RetryPolicy information about the retry policy for an event subscription +type RetryPolicy struct { + // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. + MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` + // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. + EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` +} + +// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. +type StorageBlobDeadLetterDestination struct { + // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination + *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeDeadLetterDestination', 'EndpointTypeStorageBlob' + EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { + sbdld.EndpointType = EndpointTypeStorageBlob + objectMap := make(map[string]interface{}) + if sbdld.StorageBlobDeadLetterDestinationProperties != nil { + objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties + } + if sbdld.EndpointType != "" { + objectMap["endpointType"] = sbdld.EndpointType + } + return json.Marshal(objectMap) +} + +// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { + return &sbdld, true +} + +// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { + return nil, false +} + +// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { + return &sbdld, true +} + +// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. +func (sbdld *StorageBlobDeadLetterDestination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties + err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) + if err != nil { + return err + } + sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointTypeBasicDeadLetterDestination + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sbdld.EndpointType = endpointType + } + } + } + + return nil +} + +// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. +type StorageBlobDeadLetterDestinationProperties struct { + // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events + ResourceID *string `json:"resourceId,omitempty"` + // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events + BlobContainerName *string `json:"blobContainerName,omitempty"` +} + +// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event +// subscription. +type StorageQueueEventSubscriptionDestination struct { + // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination + *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + sqesd.EndpointType = EndpointTypeStorageQueue + objectMap := make(map[string]interface{}) + if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties + } + if sqesd.EndpointType != "" { + objectMap["endpointType"] = sqesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return &sqesd, true +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &sqesd, true +} + +// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. +func (sqesd *StorageQueueEventSubscriptionDestination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) + if err != nil { + return err + } + sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sqesd.EndpointType = endpointType + } + } + } + + return nil +} + +// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. +type StorageQueueEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. + QueueName *string `json:"queueName,omitempty"` +} + +// StringBeginsWithAdvancedFilter stringBeginsWith Filter +type StringBeginsWithAdvancedFilter struct { + // Values - The set of filter values + Values *[]string `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + sbwaf.OperatorType = OperatorTypeStringBeginsWith + objectMap := make(map[string]interface{}) + if sbwaf.Values != nil { + objectMap["values"] = sbwaf.Values + } + if sbwaf.Key != nil { + objectMap["key"] = sbwaf.Key + } + if sbwaf.OperatorType != "" { + objectMap["operatorType"] = sbwaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return &sbwaf, true +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sbwaf, true +} + +// StringContainsAdvancedFilter stringContains Filter +type StringContainsAdvancedFilter struct { + // Values - The set of filter values + Values *[]string `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { + scaf.OperatorType = OperatorTypeStringContains + objectMap := make(map[string]interface{}) + if scaf.Values != nil { + objectMap["values"] = scaf.Values + } + if scaf.Key != nil { + objectMap["key"] = scaf.Key + } + if scaf.OperatorType != "" { + objectMap["operatorType"] = scaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return &scaf, true +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &scaf, true +} + +// StringEndsWithAdvancedFilter stringEndsWith Filter +type StringEndsWithAdvancedFilter struct { + // Values - The set of filter values + Values *[]string `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + sewaf.OperatorType = OperatorTypeStringEndsWith + objectMap := make(map[string]interface{}) + if sewaf.Values != nil { + objectMap["values"] = sewaf.Values + } + if sewaf.Key != nil { + objectMap["key"] = sewaf.Key + } + if sewaf.OperatorType != "" { + objectMap["operatorType"] = sewaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return &sewaf, true +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sewaf, true +} + +// StringInAdvancedFilter stringIn Filter +type StringInAdvancedFilter struct { + // Values - The set of filter values + Values *[]string `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { + siaf.OperatorType = OperatorTypeStringIn + objectMap := make(map[string]interface{}) + if siaf.Values != nil { + objectMap["values"] = siaf.Values + } + if siaf.Key != nil { + objectMap["key"] = siaf.Key + } + if siaf.OperatorType != "" { + objectMap["operatorType"] = siaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return &siaf, true +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &siaf, true +} + +// StringNotInAdvancedFilter stringNotIn Filter +type StringNotInAdvancedFilter struct { + // Values - The set of filter values + Values *[]string `json:"values,omitempty"` + // Key - The filter key. Represents an event property with up to two levels of nesting. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { + sniaf.OperatorType = OperatorTypeStringNotIn + objectMap := make(map[string]interface{}) + if sniaf.Values != nil { + objectMap["values"] = sniaf.Values + } + if sniaf.Key != nil { + objectMap["key"] = sniaf.Key + } + if sniaf.OperatorType != "" { + objectMap["operatorType"] = sniaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return &sniaf, true +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sniaf, true +} + +// Topic eventGrid Topic +type Topic struct { + autorest.Response `json:"-"` + // TopicProperties - Properties of the topic + *TopicProperties `json:"properties,omitempty"` + // Location - Location of the resource + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource + Tags map[string]*string `json:"tags"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Topic. +func (t Topic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TopicProperties != nil { + objectMap["properties"] = t.TopicProperties + } + if t.Location != nil { + objectMap["location"] = t.Location + } + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + if t.ID != nil { + objectMap["id"] = t.ID + } + if t.Name != nil { + objectMap["name"] = t.Name + } + if t.Type != nil { + objectMap["type"] = t.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Topic struct. +func (t *Topic) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var topicProperties TopicProperties + err = json.Unmarshal(*v, &topicProperties) + if err != nil { + return err + } + t.TopicProperties = &topicProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + t.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + t.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } + } + } + + return nil +} + +// TopicProperties properties of the Topic +type TopicProperties struct { + // ProvisioningState - Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' + ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` + // Endpoint - Endpoint for the topic. + Endpoint *string `json:"endpoint,omitempty"` + // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventV01Schema' + InputSchema InputSchema `json:"inputSchema,omitempty"` + // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. + InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. +func (tp *TopicProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState TopicProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + tp.ProvisioningState = provisioningState + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + tp.Endpoint = &endpoint + } + case "inputSchema": + if v != nil { + var inputSchema InputSchema + err = json.Unmarshal(*v, &inputSchema) + if err != nil { + return err + } + tp.InputSchema = inputSchema + } + case "inputSchemaMapping": + if v != nil { + inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) + if err != nil { + return err + } + tp.InputSchemaMapping = inputSchemaMapping + } + } + } + + return nil +} + +// TopicRegenerateKeyRequest topic regenerate share access key request +type TopicRegenerateKeyRequest struct { + // KeyName - Key name to regenerate key1 or key2 + KeyName *string `json:"keyName,omitempty"` +} + +// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TopicsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TopicsCreateOrUpdateFuture) Result(client TopicsClient) (t Topic, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.CreateOrUpdateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TopicsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TopicsDeleteFuture) Result(client TopicsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TopicSharedAccessKeys shared access keys of the Topic +type TopicSharedAccessKeys struct { + autorest.Response `json:"-"` + // Key1 - Shared access key1 for the topic. + Key1 *string `json:"key1,omitempty"` + // Key2 - Shared access key2 for the topic. + Key2 *string `json:"key2,omitempty"` +} + +// TopicsListResult result of the List Topics operation +type TopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Topics + Value *[]Topic `json:"value,omitempty"` +} + +// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TopicsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *TopicsUpdateFuture) Result(client TopicsClient) (t Topic, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.UpdateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TopicTypeInfo properties of a topic type info. +type TopicTypeInfo struct { + autorest.Response `json:"-"` + // TopicTypeProperties - Properties of the topic type info + *TopicTypeProperties `json:"properties,omitempty"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopicTypeInfo. +func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tti.TopicTypeProperties != nil { + objectMap["properties"] = tti.TopicTypeProperties + } + if tti.ID != nil { + objectMap["id"] = tti.ID + } + if tti.Name != nil { + objectMap["name"] = tti.Name + } + if tti.Type != nil { + objectMap["type"] = tti.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. +func (tti *TopicTypeInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var topicTypeProperties TopicTypeProperties + err = json.Unmarshal(*v, &topicTypeProperties) + if err != nil { + return err + } + tti.TopicTypeProperties = &topicTypeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tti.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tti.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tti.Type = &typeVar + } + } + } + + return nil +} + +// TopicTypeProperties properties of a topic type. +type TopicTypeProperties struct { + // Provider - Namespace of the provider of the topic type. + Provider *string `json:"provider,omitempty"` + // DisplayName - Display Name for the topic type. + DisplayName *string `json:"displayName,omitempty"` + // Description - Description of the topic type. + Description *string `json:"description,omitempty"` + // ResourceRegionType - Region type of the resource. Possible values include: 'RegionalResource', 'GlobalResource' + ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` + // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' + ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` + // SupportedLocations - List of locations supported by this topic type. + SupportedLocations *[]string `json:"supportedLocations,omitempty"` +} + +// TopicTypesListResult result of the List Topic Types operation +type TopicTypesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of topic types + Value *[]TopicTypeInfo `json:"value,omitempty"` +} + +// TopicUpdateParameters properties of the Topic update +type TopicUpdateParameters struct { + // Tags - Tags of the resource + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TopicUpdateParameters. +func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tup.Tags != nil { + objectMap["tags"] = tup.Tags + } + return json.Marshal(objectMap) +} + +// TrackedResource definition of a Tracked Resource +type TrackedResource struct { + // Location - Location of the resource + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource + Tags map[string]*string `json:"tags"` + // ID - Fully qualified identifier of the resource + ID *string `json:"id,omitempty"` + // Name - Name of the resource + Name *string `json:"name,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.ID != nil { + objectMap["id"] = tr.ID + } + if tr.Name != nil { + objectMap["name"] = tr.Name + } + if tr.Type != nil { + objectMap["type"] = tr.Type + } + return json.Marshal(objectMap) +} + +// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription +type WebHookEventSubscriptionDestination struct { + // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination + *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + whesd.EndpointType = EndpointTypeWebHook + objectMap := make(map[string]interface{}) + if whesd.WebHookEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties + } + if whesd.EndpointType != "" { + objectMap["endpointType"] = whesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return &whesd, true +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &whesd, true +} + +// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. +func (whesd *WebHookEventSubscriptionDestination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) + if err != nil { + return err + } + whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + whesd.EndpointType = endpointType + } + } + } + + return nil +} + +// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for +// an event subscription. +type WebHookEventSubscriptionDestinationProperties struct { + // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. + EndpointURL *string `json:"endpointUrl,omitempty"` + // EndpointBaseURL - The base URL that represents the endpoint of the destination of an event subscription. + EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go index 39d476869d00..fa4dc1813184 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/operations.go @@ -75,7 +75,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationsListR // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go index 38073512d5ee..c6765951ae49 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topics.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topics.go @@ -80,7 +80,7 @@ func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceG "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,7 +159,7 @@ func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -241,7 +241,7 @@ func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName st "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -316,7 +316,7 @@ func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -388,7 +388,7 @@ func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context) (*htt "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -469,7 +469,7 @@ func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -546,7 +546,7 @@ func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, res "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -630,7 +630,7 @@ func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGr "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -704,7 +704,7 @@ func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName "topicName": autorest.Encode("path", topicName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go index a19cd7c0fefd..dd0785ade936 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/topictypes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/topictypes.go @@ -81,7 +81,7 @@ func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName st "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -149,7 +149,7 @@ func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListR // ListPreparer prepares the List request. func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -223,7 +223,7 @@ func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topic "topicTypeName": autorest.Encode("path", topicTypeName), } - const APIVersion = "2018-01-01" + const APIVersion = "2018-09-15-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go similarity index 98% rename from vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go index 12eed0452075..8a5b18bcded6 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " eventgrid/2018-01-01" + return "Azure-SDK-For-Go/" + version.Number + " eventgrid/2018-09-15-preview" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index 661764292e77..80198cbb68e0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,6 +2,7 @@ contrib.go.opencensus.io/exporter/ocagent # github.com/Azure/azure-sdk-for-go v24.0.0+incompatible github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources +github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventgrid/mgmt/eventgrid github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2017-09-01/batch @@ -17,7 +18,6 @@ github.com/Azure/azure-sdk-for-go/services/datalake/analytics/mgmt/2016-11-01/ac github.com/Azure/azure-sdk-for-go/services/datalake/store/2016-11-01/filesystem github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2016-05-15/dtl -github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2018-01-01/eventgrid github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2018-04-01/devices @@ -32,6 +32,7 @@ github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01 github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-01-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/devspaces/mgmt/2018-06-01-preview/devspaces github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns +github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2018-09-15-preview/eventgrid github.com/Azure/azure-sdk-for-go/services/preview/mariadb/mgmt/2018-06-01-preview/mariadb github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi diff --git a/website/azurerm.erb b/website/azurerm.erb index 3d1150a68e3c..db46ab0a7faa 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -821,6 +821,10 @@ > Messaging Resources