From 962fbb88eadf6ea364e85061f8a568fa0ffc1cc4 Mon Sep 17 00:00:00 2001 From: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:17:46 +0200 Subject: [PATCH 01/17] chore: follow-up CR changes for synthetics private location resource (#697) related to https://github.com/elastic/terraform-provider-elasticstack/pull/696 --- .../kibana_synthetics_private_location | 76 ------------------- .../kibana_synthetics_private_location.md | 16 ++-- ...ibana_synthetics_private_location.md.tmpl} | 2 +- 3 files changed, 10 insertions(+), 84 deletions(-) delete mode 100644 docs/resources/kibana_synthetics_private_location rename templates/resources/{kibana_synthetics_private_location.tmpl => kibana_synthetics_private_location.md.tmpl} (92%) diff --git a/docs/resources/kibana_synthetics_private_location b/docs/resources/kibana_synthetics_private_location deleted file mode 100644 index ee498c76a..000000000 --- a/docs/resources/kibana_synthetics_private_location +++ /dev/null @@ -1,76 +0,0 @@ ---- -subcategory: "Kibana" -layout: "" -page_title: "Elasticstack: elasticstack_kibana_synthetics_private_location Resource" -description: |- - Creates or updates a Kibana synthetics private location. ---- - -# Resource: elasticstack_kibana_synthetics_private_location - -Creates or updates a Kibana synthetics private location. -See [Monitor via a private agent](https://www.elastic.co/guide/en/observability/current/synthetics-private-location.html#monitor-via-private-agent) -and [api docs](https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html) - -## Example Usage - -```terraform -provider "elasticstack" { - fleet {} - kibana {} -} - -resource "elasticstack_fleet_agent_policy" "sample" { - name = "Sample Agent Policy" - namespace = "default" - description = "A sample agent policy" - monitor_logs = true - monitor_metrics = true - skip_destroy = false -} - -resource "elasticstack_kibana_synthetics_private_location" "example" { - label = "example label" - space_id = "default" - agent_policy_id = elasticstack_fleet_agent_policy.sample.policy_id - tags = ["tag-a", "tag-b"] - geo = { - lat = 40.7128 - lon = 74.0060 - } -} -``` - - -## Schema - -### Required - -- `agent_policy_id` (String) The ID of the agent policy associated with the private location. To create a private location for synthetics monitor you need to create an agent policy in fleet and use its agentPolicyId -- `label` (String) A label for the private location, used as unique identifier - -### Optional - -- `geo` (Attributes) Geographic coordinates (WGS84) for the location (see [below for nested schema](#nestedatt--geo)) -- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used. -- `tags` (List of String) An array of tags to categorize the private location. - -### Read-Only - -- `id` (String) Generated id for the private location. For monitor setup please use private location label. - - -### Nested Schema for `geo` - -Required: - -- `lat` (Number) The latitude of the location. -- `lon` (Number) The longitude of the location. - -## Import - -Import is supported using the following syntax: - -```shell -terraform import elasticstack_kibana_synthetics_private_location.my_location -``` \ No newline at end of file diff --git a/docs/resources/kibana_synthetics_private_location.md b/docs/resources/kibana_synthetics_private_location.md index 004815051..3ae5272b6 100644 --- a/docs/resources/kibana_synthetics_private_location.md +++ b/docs/resources/kibana_synthetics_private_location.md @@ -1,14 +1,16 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "elasticstack_kibana_synthetics_private_location Resource - terraform-provider-elasticstack" -subcategory: "" +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_synthetics_private_location Resource" description: |- - Synthetics private location config, see https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html for more details + Creates or updates a Kibana synthetics private location. --- -# elasticstack_kibana_synthetics_private_location (Resource) +# Resource: elasticstack_kibana_synthetics_private_location -Synthetics private location config, see https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html for more details +Creates or updates a Kibana synthetics private location. +See [Monitor via a private agent](https://www.elastic.co/guide/en/observability/current/synthetics-private-location.html#monitor-via-private-agent) +and [API docs](https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html) ## Example Usage @@ -71,4 +73,4 @@ Import is supported using the following syntax: ```shell terraform import elasticstack_kibana_synthetics_private_location.my_location -``` +``` \ No newline at end of file diff --git a/templates/resources/kibana_synthetics_private_location.tmpl b/templates/resources/kibana_synthetics_private_location.md.tmpl similarity index 92% rename from templates/resources/kibana_synthetics_private_location.tmpl rename to templates/resources/kibana_synthetics_private_location.md.tmpl index 694302668..c50a4c4a5 100644 --- a/templates/resources/kibana_synthetics_private_location.tmpl +++ b/templates/resources/kibana_synthetics_private_location.md.tmpl @@ -10,7 +10,7 @@ description: |- Creates or updates a Kibana synthetics private location. See [Monitor via a private agent](https://www.elastic.co/guide/en/observability/current/synthetics-private-location.html#monitor-via-private-agent) -and [api docs](https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html) +and [API docs](https://www.elastic.co/guide/en/kibana/current/create-private-location-api.html) ## Example Usage From d4007968e5e9bb69f23f08e6109d944cc5e96ba9 Mon Sep 17 00:00:00 2001 From: Sander van Vliet <117741489+sandermvanvliet-stack@users.noreply.github.com> Date: Thu, 8 Aug 2024 06:16:09 +0200 Subject: [PATCH 02/17] Support `restriction` in `elasticstack_elasticsearch_security_api_key` (#577) * Support restriction in elasticstack_elasticsearch_security_api_key * Update example in docs * Skip test for API key with restriction on any version below 8.9 * Update docs * Raise error when restriction is not supported for API keys * Appease the linter * Small refactor * Revert debug change * Booleans are hard * This is a finicky test * Format a terraform example file * Use the ServerVersion() instead of creating a whole new request * Update docs * Remove two unused structs * Changelog --------- Co-authored-by: Toby Brain --- CHANGELOG.md | 1 + .../elasticsearch_security_api_key.md | 31 +++++ .../resource.tf | 31 +++++ internal/elasticsearch/security/api_key.go | 37 +++++- .../elasticsearch/security/api_key_test.go | 122 +++++++++++++++++- internal/models/models.go | 35 +++-- 6 files changed, 240 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9201c9ce3..ff948f49b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Fix setting `id` for Fleet outputs and servers ([#666](https://github.com/elastic/terraform-provider-elasticstack/pull/666)) - Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683)) - Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696)) +- Support setting `restriction` in `elasticstack_elasticsearch_security_api_key` role definitions ([#577](https://github.com/elastic/terraform-provider-elasticstack/pull/577)) ## [0.11.4] - 2024-06-13 diff --git a/docs/resources/elasticsearch_security_api_key.md b/docs/resources/elasticsearch_security_api_key.md index 9d9c9b90e..972a3a558 100644 --- a/docs/resources/elasticsearch_security_api_key.md +++ b/docs/resources/elasticsearch_security_api_key.md @@ -41,6 +41,37 @@ resource "elasticstack_elasticsearch_security_api_key" "api_key" { }) } +# restriction on a role descriptor for an API key is supported since Elastic 8.9 +resource "elasticstack_elasticsearch_security_api_key" "api_key_with_restriction" { + # Set the name + name = "My API key" + # Set the role descriptors + role_descriptors = jsonencode({ + role-a = { + cluster = ["all"], + indices = [ + { + names = ["index-a*"], + privileges = ["read"] + } + ], + restriction = { + workflows = ["search_application_query"] + } + } + }) + + # Set the expiration for the API key + expiration = "1d" + + # Set the custom metadata for this user + metadata = jsonencode({ + "env" = "testing" + "open" = false + "number" = 49 + }) +} + output "api_key" { value = elasticstack_elasticsearch_security_api_key.api_key sensitive = true diff --git a/examples/resources/elasticstack_elasticsearch_security_api_key/resource.tf b/examples/resources/elasticstack_elasticsearch_security_api_key/resource.tf index 9ddad52ec..f974e130b 100644 --- a/examples/resources/elasticstack_elasticsearch_security_api_key/resource.tf +++ b/examples/resources/elasticstack_elasticsearch_security_api_key/resource.tf @@ -26,6 +26,37 @@ resource "elasticstack_elasticsearch_security_api_key" "api_key" { }) } +# restriction on a role descriptor for an API key is supported since Elastic 8.9 +resource "elasticstack_elasticsearch_security_api_key" "api_key_with_restriction" { + # Set the name + name = "My API key" + # Set the role descriptors + role_descriptors = jsonencode({ + role-a = { + cluster = ["all"], + indices = [ + { + names = ["index-a*"], + privileges = ["read"] + } + ], + restriction = { + workflows = ["search_application_query"] + } + } + }) + + # Set the expiration for the API key + expiration = "1d" + + # Set the custom metadata for this user + metadata = jsonencode({ + "env" = "testing" + "open" = false + "number" = 49 + }) +} + output "api_key" { value = elasticstack_elasticsearch_security_api_key.api_key sensitive = true diff --git a/internal/elasticsearch/security/api_key.go b/internal/elasticsearch/security/api_key.go index ef44aa1ad..fa8c54414 100644 --- a/internal/elasticsearch/security/api_key.go +++ b/internal/elasticsearch/security/api_key.go @@ -16,7 +16,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -var APIKeyMinVersion = version.Must(version.NewVersion("8.0.0")) // Enabled in 8.0 +var APIKeyMinVersion = version.Must(version.NewVersion("8.0.0")) // Enabled in 8.0 +var APIKeyWithRestrictionMinVersion = version.Must(version.NewVersion("8.9.0")) // Enabled in 8.0 func ResourceApiKey() *schema.Resource { apikeySchema := map[string]*schema.Schema{ @@ -107,11 +108,33 @@ func resourceSecurityApiKeyCreate(ctx context.Context, d *schema.ResourceData, m } if v, ok := d.GetOk("role_descriptors"); ok { - role_descriptors := map[string]models.Role{} + role_descriptors := map[string]models.ApiKeyRoleDescriptor{} if err := json.NewDecoder(strings.NewReader(v.(string))).Decode(&role_descriptors); err != nil { return diag.FromErr(err) } apikey.RolesDescriptors = role_descriptors + + var hasRestriction = false + var keysWithRestrictions []string + + for key, roleDescriptor := range role_descriptors { + if roleDescriptor.Restriction != nil { + hasRestriction = true + keysWithRestrictions = append(keysWithRestrictions, key) + } + } + + if hasRestriction { + isSupported, diags := doesCurrentVersionSupportRestrictionOnApiKey(ctx, client) + + if diags.HasError() { + return diags + } + + if !isSupported { + return diag.Errorf("Specifying `restriction` on an API key role description is not supported in this version of Elasticsearch. Role descriptor(s) %s", strings.Join(keysWithRestrictions, ", ")) + } + } } if v, ok := d.GetOk("metadata"); ok { @@ -155,6 +178,16 @@ func resourceSecurityApiKeyCreate(ctx context.Context, d *schema.ResourceData, m return resourceSecurityApiKeyRead(ctx, d, meta) } +func doesCurrentVersionSupportRestrictionOnApiKey(ctx context.Context, client *clients.ApiClient) (bool, diag.Diagnostics) { + currentVersion, diags := client.ServerVersion(ctx) + + if diags.HasError() { + return false, diags + } + + return currentVersion.GreaterThanOrEqual(APIKeyWithRestrictionMinVersion), nil +} + func resourceSecurityApiKeyUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { diags := diag.Diagnostics{diag.Diagnostic{ Severity: diag.Error, diff --git a/internal/elasticsearch/security/api_key_test.go b/internal/elasticsearch/security/api_key_test.go index 5bac86911..14b433927 100644 --- a/internal/elasticsearch/security/api_key_test.go +++ b/internal/elasticsearch/security/api_key_test.go @@ -1,9 +1,12 @@ package security_test import ( + "context" "encoding/json" "fmt" + "github.com/hashicorp/go-version" "reflect" + "regexp" "testing" "github.com/elastic/terraform-provider-elasticstack/internal/acctest" @@ -17,7 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func TestAccResourceSecuritApiKey(t *testing.T) { +func TestAccResourceSecurityApiKey(t *testing.T) { // generate a random name apiKeyName := sdkacctest.RandStringFromCharSet(10, sdkacctest.CharSetAlphaNum) @@ -28,17 +31,17 @@ func TestAccResourceSecuritApiKey(t *testing.T) { Steps: []resource.TestStep{ { SkipFunc: versionutils.CheckIfVersionIsUnsupported(security.APIKeyMinVersion), - Config: testAccResourceSecuritApiKeyCreate(apiKeyName), + Config: testAccResourceSecurityApiKeyCreate(apiKeyName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_elasticsearch_security_api_key.test", "name", apiKeyName), resource.TestCheckResourceAttrWith("elasticstack_elasticsearch_security_api_key.test", "role_descriptors", func(testValue string) error { - var testRoleDescriptor map[string]models.Role + var testRoleDescriptor map[string]models.ApiKeyRoleDescriptor if err := json.Unmarshal([]byte(testValue), &testRoleDescriptor); err != nil { return err } allowRestrictedIndices := false - expectedRoleDescriptor := map[string]models.Role{ + expectedRoleDescriptor := map[string]models.ApiKeyRoleDescriptor{ "role-a": { Cluster: []string{"all"}, Indices: []models.IndexPerms{{ @@ -64,7 +67,88 @@ func TestAccResourceSecuritApiKey(t *testing.T) { }) } -func testAccResourceSecuritApiKeyCreate(apiKeyName string) string { +func TestAccResourceSecurityApiKeyWithWorkflowRestriction(t *testing.T) { + // generate a random name + apiKeyName := sdkacctest.RandStringFromCharSet(10, sdkacctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + CheckDestroy: checkResourceSecurityApiKeyDestroy, + ProtoV6ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(security.APIKeyWithRestrictionMinVersion), + Config: testAccResourceSecurityApiKeyCreateWithWorkflowRestriction(apiKeyName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("elasticstack_elasticsearch_security_api_key.test", "name", apiKeyName), + resource.TestCheckResourceAttrWith("elasticstack_elasticsearch_security_api_key.test", "role_descriptors", func(testValue string) error { + var testRoleDescriptor map[string]models.ApiKeyRoleDescriptor + if err := json.Unmarshal([]byte(testValue), &testRoleDescriptor); err != nil { + return err + } + + allowRestrictedIndices := false + expectedRoleDescriptor := map[string]models.ApiKeyRoleDescriptor{ + "role-a": { + Cluster: []string{"all"}, + Indices: []models.IndexPerms{{ + Names: []string{"index-a*"}, + Privileges: []string{"read"}, + AllowRestrictedIndices: &allowRestrictedIndices, + }}, + Restriction: &models.Restriction{Workflows: []string{"search_application_query"}}, + }, + } + + if !reflect.DeepEqual(testRoleDescriptor, expectedRoleDescriptor) { + return fmt.Errorf("%v doesn't match %v", testRoleDescriptor, expectedRoleDescriptor) + } + + return nil + }), + resource.TestCheckResourceAttrSet("elasticstack_elasticsearch_security_api_key.test", "expiration"), + resource.TestCheckResourceAttrSet("elasticstack_elasticsearch_security_api_key.test", "api_key"), + resource.TestCheckResourceAttrSet("elasticstack_elasticsearch_security_api_key.test", "encoded"), + ), + }, + }, + }) +} + +func TestAccResourceSecurityApiKeyWithWorkflowRestrictionOnElasticPre8_9_x(t *testing.T) { + // generate a random name + apiKeyName := sdkacctest.RandStringFromCharSet(10, sdkacctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + CheckDestroy: checkResourceSecurityApiKeyDestroy, + ProtoV6ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + { + SkipFunc: SkipWhenApiKeysAreNotSupportedOrRestrictionsAreSupported(security.APIKeyMinVersion, security.APIKeyWithRestrictionMinVersion), + Config: testAccResourceSecurityApiKeyCreateWithWorkflowRestriction(apiKeyName), + ExpectError: regexp.MustCompile(fmt.Sprintf(".*Error: Specifying `restriction` on an API key role description is not supported in this version of Elasticsearch. Role descriptor\\(s\\) %s.*", "role-a")), + }, + }, + }) +} + +func SkipWhenApiKeysAreNotSupportedOrRestrictionsAreSupported(minApiKeySupportedVersion *version.Version, minRestrictionSupportedVersion *version.Version) func() (bool, error) { + return func() (b bool, err error) { + client, err := clients.NewAcceptanceTestingClient() + if err != nil { + return false, err + } + serverVersion, diags := client.ServerVersion(context.Background()) + if diags.HasError() { + return false, fmt.Errorf("failed to parse the elasticsearch version %v", diags) + } + + return serverVersion.LessThan(minApiKeySupportedVersion) || serverVersion.GreaterThanOrEqual(minRestrictionSupportedVersion), nil + } +} + +func testAccResourceSecurityApiKeyCreate(apiKeyName string) string { return fmt.Sprintf(` provider "elasticstack" { elasticsearch {} @@ -89,6 +173,34 @@ resource "elasticstack_elasticsearch_security_api_key" "test" { `, apiKeyName) } +func testAccResourceSecurityApiKeyCreateWithWorkflowRestriction(apiKeyName string) string { + return fmt.Sprintf(` +provider "elasticstack" { + elasticsearch {} +} + +resource "elasticstack_elasticsearch_security_api_key" "test" { + name = "%s" + + role_descriptors = jsonencode({ + role-a = { + cluster = ["all"] + indices = [{ + names = ["index-a*"] + privileges = ["read"] + allow_restricted_indices = false + }], + restriction = { + workflows = [ "search_application_query"] + } + } + }) + + expiration = "1d" +} + `, apiKeyName) +} + func checkResourceSecurityApiKeyDestroy(s *terraform.State) error { client, err := clients.NewAcceptanceTestingClient() if err != nil { diff --git a/internal/models/models.go b/internal/models/models.go index 4f4918a14..dc8af8937 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -82,6 +82,21 @@ type Role struct { RusAs []string `json:"run_as,omitempty"` } +type ApiKeyRoleDescriptor struct { + Name string `json:"-"` + Applications []Application `json:"applications,omitempty"` + Global map[string]interface{} `json:"global,omitempty"` + Cluster []string `json:"cluster,omitempty"` + Indices []IndexPerms `json:"indices,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + RusAs []string `json:"run_as,omitempty"` + Restriction *Restriction `json:"restriction,omitempty"` +} + +type Restriction struct { + Workflows []string `json:"workflows,omitempty"` +} + type RoleMapping struct { Name string `json:"-"` Enabled bool `json:"enabled"` @@ -92,20 +107,20 @@ type RoleMapping struct { } type ApiKey struct { - Name string `json:"name"` - RolesDescriptors map[string]Role `json:"role_descriptors,omitempty"` - Expiration string `json:"expiration,omitempty"` - Metadata map[string]interface{} `json:"metadata,omitempty"` + Name string `json:"name"` + RolesDescriptors map[string]ApiKeyRoleDescriptor `json:"role_descriptors,omitempty"` + Expiration string `json:"expiration,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` } type ApiKeyResponse struct { ApiKey - RolesDescriptors map[string]Role `json:"role_descriptors,omitempty"` - Expiration int64 `json:"expiration,omitempty"` - Id string `json:"id,omitempty"` - Key string `json:"api_key,omitempty"` - EncodedKey string `json:"encoded,omitempty"` - Invalidated bool `json:"invalidated,omitempty"` + RolesDescriptors map[string]ApiKeyRoleDescriptor `json:"role_descriptors,omitempty"` + Expiration int64 `json:"expiration,omitempty"` + Id string `json:"id,omitempty"` + Key string `json:"api_key,omitempty"` + EncodedKey string `json:"encoded,omitempty"` + Invalidated bool `json:"invalidated,omitempty"` } type IndexPerms struct { From 6c74e6480d75463108f65f35e6183c7464fb54c0 Mon Sep 17 00:00:00 2001 From: Dominik Giger Date: Mon, 12 Aug 2024 11:20:03 +0200 Subject: [PATCH 03/17] Bugfix SLO API: Update type for `group_by` to accept either string or array-of-strings (#701) - Starting with 8.14.0, the API can now return a list of strings instead of just a string. - To be able to handle both old and new APIs, the spec has been updated to accept either a string or a list of strings. - This change only ensures that the provider doesn't crash with the new API, there is no support yet for multiple group-by arguments. --- CHANGELOG.md | 1 + generated/slo-spec.yml | 12 +- generated/slo/.openapi-generator/FILES | 2 + generated/slo/README.md | 1 + generated/slo/api/openapi.yaml | 19 ++- generated/slo/docs/CreateSloRequest.md | 8 +- generated/slo/docs/SloResponse.md | 10 +- generated/slo/docs/SloResponseGroupBy.md | 30 ++++ generated/slo/model_create_slo_request.go | 13 +- generated/slo/model_slo_response.go | 15 +- generated/slo/model_slo_response_group_by.go | 145 +++++++++++++++++++ internal/clients/kibana/slo.go | 10 +- 12 files changed, 231 insertions(+), 35 deletions(-) create mode 100644 generated/slo/docs/SloResponseGroupBy.md create mode 100644 generated/slo/model_slo_response_group_by.go diff --git a/CHANGELOG.md b/CHANGELOG.md index ff948f49b..9af4a12c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683)) - Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696)) - Support setting `restriction` in `elasticstack_elasticsearch_security_api_key` role definitions ([#577](https://github.com/elastic/terraform-provider-elasticstack/pull/577)) +- Fix type of `group_by` attribute in the `kibana_slo` resource to be compatible with versions 8.14+ ([#701](https://github.com/elastic/terraform-provider-elasticstack/pull/701)) ## [0.11.4] - 2024-06-13 diff --git a/generated/slo-spec.yml b/generated/slo-spec.yml index 5aa20726b..5529502e2 100644 --- a/generated/slo-spec.yml +++ b/generated/slo-spec.yml @@ -1173,7 +1173,11 @@ components: example: true groupBy: description: optional group by field to use to generate an SLO per distinct value - type: string + oneOf: + - type: string + - type: array + items: + type: string example: some.field instanceId: description: the value derived from the groupBy field, if present, otherwise '*' @@ -1320,7 +1324,11 @@ components: $ref: '#/components/schemas/settings' groupBy: description: optional group by field to use to generate an SLO per distinct value - type: string + oneOf: + - type: string + - type: array + items: + type: string example: some.field tags: description: List of tags diff --git a/generated/slo/.openapi-generator/FILES b/generated/slo/.openapi-generator/FILES index 6c78451d1..9145efdc6 100644 --- a/generated/slo/.openapi-generator/FILES +++ b/generated/slo/.openapi-generator/FILES @@ -45,6 +45,7 @@ docs/Objective.md docs/Settings.md docs/SloAPI.md docs/SloResponse.md +docs/SloResponseGroupBy.md docs/SloResponseIndicator.md docs/Summary.md docs/SummaryStatus.md @@ -94,6 +95,7 @@ model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go model_objective.go model_settings.go model_slo_response.go +model_slo_response_group_by.go model_slo_response_indicator.go model_summary.go model_summary_status.go diff --git a/generated/slo/README.md b/generated/slo/README.md index cea692cc2..261fc2d0e 100644 --- a/generated/slo/README.md +++ b/generated/slo/README.md @@ -128,6 +128,7 @@ Class | Method | HTTP request | Description - [Objective](docs/Objective.md) - [Settings](docs/Settings.md) - [SloResponse](docs/SloResponse.md) + - [SloResponseGroupBy](docs/SloResponseGroupBy.md) - [SloResponseIndicator](docs/SloResponseIndicator.md) - [Summary](docs/Summary.md) - [SummaryStatus](docs/SummaryStatus.md) diff --git a/generated/slo/api/openapi.yaml b/generated/slo/api/openapi.yaml index d2796a419..33bc46518 100644 --- a/generated/slo/api/openapi.yaml +++ b/generated/slo/api/openapi.yaml @@ -1062,10 +1062,7 @@ components: example: true type: boolean groupBy: - description: optional group by field to use to generate an SLO per distinct - value - example: some.field - type: string + $ref: '#/components/schemas/slo_response_groupBy' instanceId: description: "the value derived from the groupBy field, if present, otherwise\ \ '*'" @@ -1289,10 +1286,7 @@ components: settings: $ref: '#/components/schemas/settings' groupBy: - description: optional group by field to use to generate an SLO per distinct - value - example: some.field - type: string + $ref: '#/components/schemas/slo_response_groupBy' tags: description: List of tags items: @@ -1783,6 +1777,15 @@ components: - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + slo_response_groupBy: + description: optional group by field to use to generate an SLO per distinct + value + example: some.field + oneOf: + - type: string + - items: + type: string + type: array create_slo_request_indicator: oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' diff --git a/generated/slo/docs/CreateSloRequest.md b/generated/slo/docs/CreateSloRequest.md index c56190f41..e8b5ec1bc 100644 --- a/generated/slo/docs/CreateSloRequest.md +++ b/generated/slo/docs/CreateSloRequest.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | | **Objective** | [**Objective**](Objective.md) | | **Settings** | Pointer to [**Settings**](Settings.md) | | [optional] -**GroupBy** | Pointer to **string** | optional group by field to use to generate an SLO per distinct value | [optional] +**GroupBy** | Pointer to [**SloResponseGroupBy**](SloResponseGroupBy.md) | | [optional] **Tags** | Pointer to **[]string** | List of tags | [optional] ## Methods @@ -206,20 +206,20 @@ HasSettings returns a boolean if a field has been set. ### GetGroupBy -`func (o *CreateSloRequest) GetGroupBy() string` +`func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy` GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. ### GetGroupByOk -`func (o *CreateSloRequest) GetGroupByOk() (*string, bool)` +`func (o *CreateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool)` GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetGroupBy -`func (o *CreateSloRequest) SetGroupBy(v string)` +`func (o *CreateSloRequest) SetGroupBy(v SloResponseGroupBy)` SetGroupBy sets GroupBy field to given value. diff --git a/generated/slo/docs/SloResponse.md b/generated/slo/docs/SloResponse.md index b3a1d6bda..071b3ecd8 100644 --- a/generated/slo/docs/SloResponse.md +++ b/generated/slo/docs/SloResponse.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **Revision** | **float64** | The SLO revision | **Summary** | [**Summary**](Summary.md) | | **Enabled** | **bool** | Indicate if the SLO is enabled | -**GroupBy** | **string** | optional group by field to use to generate an SLO per distinct value | +**GroupBy** | [**SloResponseGroupBy**](SloResponseGroupBy.md) | | **InstanceId** | **string** | the value derived from the groupBy field, if present, otherwise '*' | **Tags** | **[]string** | List of tags | **CreatedAt** | **string** | The creation date | @@ -25,7 +25,7 @@ Name | Type | Description | Notes ### NewSloResponse -`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, tags []string, createdAt string, updatedAt string, ) *SloResponse` +`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy SloResponseGroupBy, instanceId string, tags []string, createdAt string, updatedAt string, ) *SloResponse` NewSloResponse instantiates a new SloResponse object This constructor will assign default values to properties that have it defined, @@ -262,20 +262,20 @@ SetEnabled sets Enabled field to given value. ### GetGroupBy -`func (o *SloResponse) GetGroupBy() string` +`func (o *SloResponse) GetGroupBy() SloResponseGroupBy` GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. ### GetGroupByOk -`func (o *SloResponse) GetGroupByOk() (*string, bool)` +`func (o *SloResponse) GetGroupByOk() (*SloResponseGroupBy, bool)` GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetGroupBy -`func (o *SloResponse) SetGroupBy(v string)` +`func (o *SloResponse) SetGroupBy(v SloResponseGroupBy)` SetGroupBy sets GroupBy field to given value. diff --git a/generated/slo/docs/SloResponseGroupBy.md b/generated/slo/docs/SloResponseGroupBy.md new file mode 100644 index 000000000..81a44275f --- /dev/null +++ b/generated/slo/docs/SloResponseGroupBy.md @@ -0,0 +1,30 @@ +# SloResponseGroupBy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Methods + +### NewSloResponseGroupBy + +`func NewSloResponseGroupBy() *SloResponseGroupBy` + +NewSloResponseGroupBy instantiates a new SloResponseGroupBy object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSloResponseGroupByWithDefaults + +`func NewSloResponseGroupByWithDefaults() *SloResponseGroupBy` + +NewSloResponseGroupByWithDefaults instantiates a new SloResponseGroupBy object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/model_create_slo_request.go b/generated/slo/model_create_slo_request.go index b96f904a4..02210deb0 100644 --- a/generated/slo/model_create_slo_request.go +++ b/generated/slo/model_create_slo_request.go @@ -30,8 +30,7 @@ type CreateSloRequest struct { BudgetingMethod BudgetingMethod `json:"budgetingMethod"` Objective Objective `json:"objective"` Settings *Settings `json:"settings,omitempty"` - // optional group by field to use to generate an SLO per distinct value - GroupBy *string `json:"groupBy,omitempty"` + GroupBy *SloResponseGroupBy `json:"groupBy,omitempty"` // List of tags Tags []string `json:"tags,omitempty"` } @@ -268,9 +267,9 @@ func (o *CreateSloRequest) SetSettings(v Settings) { } // GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *CreateSloRequest) GetGroupBy() string { +func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy { if o == nil || IsNil(o.GroupBy) { - var ret string + var ret SloResponseGroupBy return ret } return *o.GroupBy @@ -278,7 +277,7 @@ func (o *CreateSloRequest) GetGroupBy() string { // GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateSloRequest) GetGroupByOk() (*string, bool) { +func (o *CreateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool) { if o == nil || IsNil(o.GroupBy) { return nil, false } @@ -294,8 +293,8 @@ func (o *CreateSloRequest) HasGroupBy() bool { return false } -// SetGroupBy gets a reference to the given string and assigns it to the GroupBy field. -func (o *CreateSloRequest) SetGroupBy(v string) { +// SetGroupBy gets a reference to the given SloResponseGroupBy and assigns it to the GroupBy field. +func (o *CreateSloRequest) SetGroupBy(v SloResponseGroupBy) { o.GroupBy = &v } diff --git a/generated/slo/model_slo_response.go b/generated/slo/model_slo_response.go index 91044e65b..6bb82ce1e 100644 --- a/generated/slo/model_slo_response.go +++ b/generated/slo/model_slo_response.go @@ -34,9 +34,8 @@ type SloResponse struct { Revision float64 `json:"revision"` Summary Summary `json:"summary"` // Indicate if the SLO is enabled - Enabled bool `json:"enabled"` - // optional group by field to use to generate an SLO per distinct value - GroupBy string `json:"groupBy"` + Enabled bool `json:"enabled"` + GroupBy SloResponseGroupBy `json:"groupBy"` // the value derived from the groupBy field, if present, otherwise '*' InstanceId string `json:"instanceId"` // List of tags @@ -51,7 +50,7 @@ type SloResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, tags []string, createdAt string, updatedAt string) *SloResponse { +func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy SloResponseGroupBy, instanceId string, tags []string, createdAt string, updatedAt string) *SloResponse { this := SloResponse{} this.Id = id this.Name = name @@ -345,9 +344,9 @@ func (o *SloResponse) SetEnabled(v bool) { } // GetGroupBy returns the GroupBy field value -func (o *SloResponse) GetGroupBy() string { +func (o *SloResponse) GetGroupBy() SloResponseGroupBy { if o == nil { - var ret string + var ret SloResponseGroupBy return ret } @@ -356,7 +355,7 @@ func (o *SloResponse) GetGroupBy() string { // GetGroupByOk returns a tuple with the GroupBy field value // and a boolean to check if the value has been set. -func (o *SloResponse) GetGroupByOk() (*string, bool) { +func (o *SloResponse) GetGroupByOk() (*SloResponseGroupBy, bool) { if o == nil { return nil, false } @@ -364,7 +363,7 @@ func (o *SloResponse) GetGroupByOk() (*string, bool) { } // SetGroupBy sets field value -func (o *SloResponse) SetGroupBy(v string) { +func (o *SloResponse) SetGroupBy(v SloResponseGroupBy) { o.GroupBy = v } diff --git a/generated/slo/model_slo_response_group_by.go b/generated/slo/model_slo_response_group_by.go new file mode 100644 index 000000000..6e8723595 --- /dev/null +++ b/generated/slo/model_slo_response_group_by.go @@ -0,0 +1,145 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" +) + +// SloResponseGroupBy - optional group by field to use to generate an SLO per distinct value +type SloResponseGroupBy struct { + ArrayOfString *[]string + String *string +} + +// []stringAsSloResponseGroupBy is a convenience function that returns []string wrapped in SloResponseGroupBy +func ArrayOfStringAsSloResponseGroupBy(v *[]string) SloResponseGroupBy { + return SloResponseGroupBy{ + ArrayOfString: v, + } +} + +// stringAsSloResponseGroupBy is a convenience function that returns string wrapped in SloResponseGroupBy +func StringAsSloResponseGroupBy(v *string) SloResponseGroupBy { + return SloResponseGroupBy{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *SloResponseGroupBy) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ArrayOfString + err = json.Unmarshal(data, &dst.ArrayOfString) + if err == nil { + jsonstring, _ := json.Marshal(dst.ArrayOfString) + if string(jsonstring) == "{}" { // empty struct + dst.ArrayOfString = nil + } else { + match++ + } + } else { + dst.ArrayOfString = nil + } + + // try to unmarshal data into String + err = json.Unmarshal(data, &dst.String) + if err == nil { + jsonstring, _ := json.Marshal(dst.String) + if string(jsonstring) == "{}" { // empty struct + dst.String = nil + } else { + match++ + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.ArrayOfString = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(SloResponseGroupBy)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(SloResponseGroupBy)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src SloResponseGroupBy) MarshalJSON() ([]byte, error) { + if src.ArrayOfString != nil { + return json.Marshal(&src.ArrayOfString) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *SloResponseGroupBy) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.ArrayOfString != nil { + return obj.ArrayOfString + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableSloResponseGroupBy struct { + value *SloResponseGroupBy + isSet bool +} + +func (v NullableSloResponseGroupBy) Get() *SloResponseGroupBy { + return v.value +} + +func (v *NullableSloResponseGroupBy) Set(val *SloResponseGroupBy) { + v.value = val + v.isSet = true +} + +func (v NullableSloResponseGroupBy) IsSet() bool { + return v.isSet +} + +func (v *NullableSloResponseGroupBy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSloResponseGroupBy(val *SloResponseGroupBy) *NullableSloResponseGroupBy { + return &NullableSloResponseGroupBy{value: val, isSet: true} +} + +func (v NullableSloResponseGroupBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSloResponseGroupBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/clients/kibana/slo.go b/internal/clients/kibana/slo.go index 4edc8434d..1c0c519c6 100644 --- a/internal/clients/kibana/slo.go +++ b/internal/clients/kibana/slo.go @@ -109,7 +109,7 @@ func CreateSlo(ctx context.Context, apiClient *clients.ApiClient, s models.Slo) BudgetingMethod: slo.BudgetingMethod(s.BudgetingMethod), Objective: s.Objective, Settings: s.Settings, - GroupBy: s.GroupBy, + GroupBy: transformGroupBy(s.GroupBy), Tags: s.Tags, } @@ -180,3 +180,11 @@ func sloResponseToModel(spaceID string, res *slo.SloResponse) *models.Slo { Tags: res.Tags, } } + +func transformGroupBy(groupBy *string) *slo.SloResponseGroupBy { + if groupBy == nil { + return nil + } + + return &slo.SloResponseGroupBy{String: groupBy} +} From 57eceb027a1e881b4f2a8a1eb916ee46a3979dcb Mon Sep 17 00:00:00 2001 From: Dominik Giger Date: Mon, 12 Aug 2024 14:01:26 +0200 Subject: [PATCH 04/17] Bump version for 0.11.5 (#706) --- CHANGELOG.md | 2 ++ Makefile | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af4a12c5..096ab6d8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +## [0.11.5] - 2024-08-12 + - Fix setting `id` for Fleet outputs and servers ([#666](https://github.com/elastic/terraform-provider-elasticstack/pull/666)) - Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683)) - Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696)) diff --git a/Makefile b/Makefile index 3235784d5..06f906235 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ .DEFAULT_GOAL = help SHELL := /bin/bash -VERSION ?= 0.11.4 + +VERSION ?= 0.11.5 NAME = elasticstack BINARY = terraform-provider-${NAME} From 261d77e9c62acd1cd8789703250132cb647c8e3f Mon Sep 17 00:00:00 2001 From: Dominik Giger Date: Mon, 12 Aug 2024 15:32:34 +0200 Subject: [PATCH 05/17] Update changelog for 0.11.5 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 096ab6d8b..e7e7c8071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -315,7 +315,8 @@ - Initial set of docs - CI integration -[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...HEAD +[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.5...HEAD +[0.11.5]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...v0.11.5 [0.11.4]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.3...v0.11.4 [0.11.3]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.2...v0.11.3 [0.11.2]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.1...v0.11.2 From 7dd5d83881c262461069520d9f1b1a9f2467ffb1 Mon Sep 17 00:00:00 2001 From: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> Date: Sat, 17 Aug 2024 04:18:32 +0200 Subject: [PATCH 06/17] chore: 8.15.0 is here - lets try it out (#708) --- .github/workflows/test.yml | 1 + Makefile | 4 ++-- libs/go-kibana-rest/docker-compose.yml | 7 +++---- libs/go-kibana-rest/kbapi/api.kibana_spaces_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da7f2fa21..2687fb064 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -103,6 +103,7 @@ jobs: - '8.12.2' - '8.13.4' - '8.14.3' + - '8.15.0' steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 diff --git a/Makefile b/Makefile index 06f906235..a139c928a 100644 --- a/Makefile +++ b/Makefile @@ -16,14 +16,14 @@ SWAGGER_VERSION ?= 8.7 GOVERSION ?= $(shell grep -e '^go' go.mod | cut -f 2 -d ' ') -STACK_VERSION ?= 8.13.4 +STACK_VERSION ?= 8.15.0 ELASTICSEARCH_NAME ?= terraform-elasticstack-es ELASTICSEARCH_ENDPOINTS ?= http://$(ELASTICSEARCH_NAME):9200 ELASTICSEARCH_USERNAME ?= elastic ELASTICSEARCH_PASSWORD ?= password ELASTICSEARCH_NETWORK ?= elasticstack-network -ELASTICSEARCH_MEM ?= 1024m +ELASTICSEARCH_MEM ?= 2048m KIBANA_NAME ?= terraform-elasticstack-kb KIBANA_ENDPOINT ?= http://$(KIBANA_NAME):5601 diff --git a/libs/go-kibana-rest/docker-compose.yml b/libs/go-kibana-rest/docker-compose.yml index fe3dbb953..0f12cb3e1 100644 --- a/libs/go-kibana-rest/docker-compose.yml +++ b/libs/go-kibana-rest/docker-compose.yml @@ -1,7 +1,6 @@ -version: '2.3' services: elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.14.3 + image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0 environment: cluster.name: test discovery.type: single-node @@ -12,7 +11,7 @@ services: ports: - "9200:9200/tcp" set-kibana-password: - image: docker.elastic.co/kibana/kibana:8.14.3 + image: docker.elastic.co/kibana/kibana:8.15.0 restart: on-failure links: - elasticsearch @@ -23,7 +22,7 @@ services: elasticsearch: condition: service_started kibana: - image: docker.elastic.co/kibana/kibana:8.14.3 + image: docker.elastic.co/kibana/kibana:8.15.0 environment: ELASTICSEARCH_HOSTS: http://es:9200 ELASTICSEARCH_USERNAME: kibana_system diff --git a/libs/go-kibana-rest/kbapi/api.kibana_spaces_test.go b/libs/go-kibana-rest/kbapi/api.kibana_spaces_test.go index a7a52d5d8..02596a9f0 100644 --- a/libs/go-kibana-rest/kbapi/api.kibana_spaces_test.go +++ b/libs/go-kibana-rest/kbapi/api.kibana_spaces_test.go @@ -42,7 +42,7 @@ func (s *KBAPITestSuite) TestKibanaSpaces() { Objects: []KibanaSpaceObjectParameter{ { Type: "config", - ID: "8.14.3", + ID: "8.15.0", }, }, } From 75207c88bf9466711226ac8835b8623b53d395ed Mon Sep 17 00:00:00 2001 From: Dominik Giger Date: Mon, 19 Aug 2024 10:11:52 +0200 Subject: [PATCH 07/17] Use ephemeral github token for build. (#712) The `VAULT_GITHUB_TOKEN` env var contains the token with permissions to create releases. Goreleaser on the other hand will only use `GITHUB_TOKEN` for the release. --- .buildkite/hooks/pre-command | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 4849ba1af..850aac259 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -12,5 +12,5 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "terraform-provider-elasticstack-release" ]] export GPG_PRIVATE_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_private ${RELEASE_VAULT_PATH}) export GPG_PASSPHRASE_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_passphrase ${RELEASE_VAULT_PATH}) export GPG_FINGERPRINT_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_fingerprint ${RELEASE_VAULT_PATH}) - export GITHUB_TOKEN=$(scripts/retry.sh 5 vault kv get -field gh_personal_access_token ${RELEASE_VAULT_PATH}) + export GITHUB_TOKEN="${VAULT_GITHUB_TOKEN}" fi From 7773917d765725ead98b29122a79027f9c75e8d2 Mon Sep 17 00:00:00 2001 From: jdesnoes <126451335+jdesnoes@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:12:23 +0200 Subject: [PATCH 08/17] Kibana spaces data source (#682) * Spaces Data Source * Bump github.com/hashicorp/terraform-plugin-framework (#679) Bumps [github.com/hashicorp/terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-framework/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-framework/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-framework/compare/v1.9.0...v1.10.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Spaces data source * Spaces data source * Kibana spaces data source * Kibana spaces data source * Kibana spaces data source * Kibana spaces data source * Kibana spaces data source * Kibana spaces data source * Suggestions apply --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 + docs/data-sources/kibana_spaces.md | 51 ++++++++++++++++ .../elasticstack_kibana_spaces/data-source.tf | 9 +++ go.mod | 1 + go.sum | 2 + internal/kibana/spaces/data_source.go | 53 +++++++++++++++++ internal/kibana/spaces/data_source_test.go | 36 +++++++++++ internal/kibana/spaces/models.go | 20 +++++++ internal/kibana/spaces/read.go | 51 ++++++++++++++++ internal/kibana/spaces/schema.go | 59 +++++++++++++++++++ provider/plugin_framework.go | 5 +- templates/data-sources/kibana_spaces.md.tmpl | 17 ++++++ 12 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 docs/data-sources/kibana_spaces.md create mode 100644 examples/data-sources/elasticstack_kibana_spaces/data-source.tf create mode 100644 internal/kibana/spaces/data_source.go create mode 100644 internal/kibana/spaces/data_source_test.go create mode 100644 internal/kibana/spaces/models.go create mode 100644 internal/kibana/spaces/read.go create mode 100644 internal/kibana/spaces/schema.go create mode 100644 templates/data-sources/kibana_spaces.md.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index e7e7c8071..055fc6d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +- Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682)) + ## [0.11.5] - 2024-08-12 - Fix setting `id` for Fleet outputs and servers ([#666](https://github.com/elastic/terraform-provider-elasticstack/pull/666)) diff --git a/docs/data-sources/kibana_spaces.md b/docs/data-sources/kibana_spaces.md new file mode 100644 index 000000000..4bb1d0120 --- /dev/null +++ b/docs/data-sources/kibana_spaces.md @@ -0,0 +1,51 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_spaces Data Source" +description: |- + Retrieve all Kibana spaces. See https://www.elastic.co/guide/en/kibana/master/spaces-api-get-all.html +--- + +# Data Source: elasticstack_kibana_spaces + +Use this data source to retrieve and get information about all existing Kibana spaces. + +## Example Usage + +```terraform +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +data "elasticstack_kibana_spaces" "all_spaces" { + +} +``` + + +## Schema + +### Read-Only + +- `id` (String) Generated ID for the spaces. +- `spaces` (Attributes List) The list of spaces. (see [below for nested schema](#nestedatt--spaces)) + + +### Nested Schema for `spaces` + +Required: + +- `name` (String) The display name for the space. + +Optional: + +- `description` (String) The description for the space. +- `disabled_features` (List of String) The list of disabled features for the space. To get a list of available feature IDs, use the Features API (https://www.elastic.co/guide/en/kibana/master/features-api-get.html). +- `image_url` (String) The data-URL encoded image to display in the space avatar. + +Read-Only: + +- `color` (String) The hexadecimal color code used in the space avatar. By default, the color is automatically generated from the space name. +- `id` (String) Internal identifier of the resource. +- `initials` (String) The initials shown in the space avatar. By default, the initials are automatically generated from the space name. Initials must be 1 or 2 characters. diff --git a/examples/data-sources/elasticstack_kibana_spaces/data-source.tf b/examples/data-sources/elasticstack_kibana_spaces/data-source.tf new file mode 100644 index 000000000..af3acbf72 --- /dev/null +++ b/examples/data-sources/elasticstack_kibana_spaces/data-source.tf @@ -0,0 +1,9 @@ + +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +data "elasticstack_kibana_spaces" "all_spaces" { + +} diff --git a/go.mod b/go.mod index 245c7e789..0d472137b 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-mux v0.16.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 + github.com/hashicorp/terraform-plugin-testing v1.9.0 github.com/mitchellh/mapstructure v1.5.0 github.com/oapi-codegen/runtime v1.1.1 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 57f5adc6b..c09e89233 100644 --- a/go.sum +++ b/go.sum @@ -100,6 +100,8 @@ github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQs github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 h1:kJiWGx2kiQVo97Y5IOGR4EMcZ8DtMswHhUuFibsCQQE= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= +github.com/hashicorp/terraform-plugin-testing v1.9.0 h1:xOsQRqqlHKXpFq6etTxih3ubdK3HVDtfE1IY7Rpd37o= +github.com/hashicorp/terraform-plugin-testing v1.9.0/go.mod h1:fhhVx/8+XNJZTD5o3b4stfZ6+q7z9+lIWigIYdT6/44= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= diff --git a/internal/kibana/spaces/data_source.go b/internal/kibana/spaces/data_source.go new file mode 100644 index 000000000..f531e836c --- /dev/null +++ b/internal/kibana/spaces/data_source.go @@ -0,0 +1,53 @@ +package spaces + +import ( + "context" + + "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/hashicorp/terraform-plugin-framework/datasource" +) + +// Ensure the implementation satisfies the expected interfaces. +var ( + _ datasource.DataSource = &dataSource{} + _ datasource.DataSourceWithConfigure = &dataSource{} +) + +// NewDataSource is a helper function to simplify the provider implementation. +func NewDataSource() datasource.DataSource { + return &dataSource{} +} + +// dataSource is the data source implementation. +type dataSource struct { + client *kbapi.KibanaSpacesAPI +} + +// Metadata returns the data source type name. +func (d *dataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_kibana_spaces" +} + +// Configure adds the provider configured client to the data source. +func (d *dataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + // Add a nil check when handling ProviderData because Terraform + // sets that data after it calls the ConfigureProvider RPC. + if req.ProviderData == nil { + return + } + + client, diags := clients.ConvertProviderData(req.ProviderData) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + kibanaClient, err := client.GetKibanaClient() + if err != nil { + resp.Diagnostics.AddError("unable to get Kibana client", err.Error()) + return + } + + d.client = kibanaClient.KibanaSpaces +} diff --git a/internal/kibana/spaces/data_source_test.go b/internal/kibana/spaces/data_source_test.go new file mode 100644 index 000000000..efc1cc246 --- /dev/null +++ b/internal/kibana/spaces/data_source_test.go @@ -0,0 +1,36 @@ +package spaces_test + +import ( + "testing" + + "github.com/elastic/terraform-provider-elasticstack/internal/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccSpacesDataSource(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProtoV6ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + { + Config: testAccSpacesDataSourceConfig, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.elasticstack_kibana_spaces.all_spaces", "spaces.0.id", "default"), + resource.TestCheckResourceAttr("data.elasticstack_kibana_spaces.all_spaces", "spaces.0.name", "Default"), + resource.TestCheckResourceAttr("data.elasticstack_kibana_spaces.all_spaces", "spaces.0.description", "This is your default space!"), + ), + }, + }, + }) +} + +const testAccSpacesDataSourceConfig = ` +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +data "elasticstack_kibana_spaces" "all_spaces" { + +} +` diff --git a/internal/kibana/spaces/models.go b/internal/kibana/spaces/models.go new file mode 100644 index 000000000..e7187566f --- /dev/null +++ b/internal/kibana/spaces/models.go @@ -0,0 +1,20 @@ +package spaces + +import "github.com/hashicorp/terraform-plugin-framework/types" + +// dataSourceModel maps the data source schema data. +type dataSourceModel struct { + ID types.String `tfsdk:"id"` + Spaces []model `tfsdk:"spaces"` +} + +// model maps spaces schema data. +type model struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Description types.String `tfsdk:"description"` + DisabledFeatures types.List `tfsdk:"disabled_features"` + Initials types.String `tfsdk:"initials"` + Color types.String `tfsdk:"color"` + ImageUrl types.String `tfsdk:"image_url"` +} diff --git a/internal/kibana/spaces/read.go b/internal/kibana/spaces/read.go new file mode 100644 index 000000000..ee7879a81 --- /dev/null +++ b/internal/kibana/spaces/read.go @@ -0,0 +1,51 @@ +package spaces + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +// Read refreshes the Terraform state with the latest data. +func (d *dataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var state dataSourceModel + + // Call client API + spaces, err := d.client.List() + if err != nil { + resp.Diagnostics.AddError("unable to list spaces", err.Error()) + return + } + + // Map response body to model + for _, space := range spaces { + spaceState := model{ + ID: types.StringValue(space.ID), + Name: types.StringValue(space.Name), + Description: types.StringValue(space.Description), + Initials: types.StringValue(space.Initials), + Color: types.StringValue(space.Color), + ImageUrl: types.StringValue(space.ImageURL), + } + + disabledFeatures, diags := types.ListValueFrom(ctx, types.StringType, space.DisabledFeatures) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + spaceState.DisabledFeatures = disabledFeatures + + state.Spaces = append(state.Spaces, spaceState) + } + + state.ID = types.StringValue("spaces") + + // Set state + diags := resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } +} diff --git a/internal/kibana/spaces/schema.go b/internal/kibana/spaces/schema.go new file mode 100644 index 000000000..bb08c3958 --- /dev/null +++ b/internal/kibana/spaces/schema.go @@ -0,0 +1,59 @@ +package spaces + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +// Schema defines the schema for the data source. +func (d *dataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + Description: "Manages Kibana spaces", + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Description: "Generated ID for the spaces.", + Computed: true, + }, + "spaces": schema.ListNestedAttribute{ + Description: "The list of spaces.", + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Description: "Internal identifier of the resource.", + Computed: true, + }, + "name": schema.StringAttribute{ + Description: "The display name for the space.", + Required: true, + }, + "description": schema.StringAttribute{ + Description: "The description for the space.", + Optional: true, + }, + "disabled_features": schema.ListAttribute{ + Description: "The list of disabled features for the space. To get a list of available feature IDs, use the Features API (https://www.elastic.co/guide/en/kibana/master/features-api-get.html).", + ElementType: types.StringType, + Optional: true, + }, + "initials": schema.StringAttribute{ + Description: "The initials shown in the space avatar. By default, the initials are automatically generated from the space name. Initials must be 1 or 2 characters.", + Computed: true, + }, + "color": schema.StringAttribute{ + Description: "The hexadecimal color code used in the space avatar. By default, the color is automatically generated from the space name.", + Computed: true, + }, + "image_url": schema.StringAttribute{ + Description: "The data-URL encoded image to display in the space avatar.", + Optional: true, + }, + }, + }, + }, + }, + } +} diff --git a/provider/plugin_framework.go b/provider/plugin_framework.go index 5a6b7f5f0..dceb73adf 100644 --- a/provider/plugin_framework.go +++ b/provider/plugin_framework.go @@ -7,6 +7,7 @@ import ( "github.com/elastic/terraform-provider-elasticstack/internal/clients/config" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/import_saved_objects" + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/spaces" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics/private_location" "github.com/elastic/terraform-provider-elasticstack/internal/schema" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -65,7 +66,9 @@ func (p *Provider) Configure(ctx context.Context, req fwprovider.ConfigureReques } func (p *Provider) DataSources(ctx context.Context) []func() datasource.DataSource { - return []func() datasource.DataSource{} + return []func() datasource.DataSource{ + spaces.NewDataSource, + } } func (p *Provider) Resources(ctx context.Context) []func() resource.Resource { diff --git a/templates/data-sources/kibana_spaces.md.tmpl b/templates/data-sources/kibana_spaces.md.tmpl new file mode 100644 index 000000000..4ad23929c --- /dev/null +++ b/templates/data-sources/kibana_spaces.md.tmpl @@ -0,0 +1,17 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_spaces Data Source" +description: |- + Retrieve all Kibana spaces. See https://www.elastic.co/guide/en/kibana/master/spaces-api-get-all.html +--- + +# Data Source: elasticstack_kibana_spaces + +Use this data source to retrieve and get information about all existing Kibana spaces. + +## Example Usage + +{{ tffile "examples/data-sources/elasticstack_kibana_spaces/data-source.tf" }} + +{{ .SchemaMarkdown | trimspace }} From 92e0b14da1051d41bb7b3877bf2367ceada96c59 Mon Sep 17 00:00:00 2001 From: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> Date: Tue, 20 Aug 2024 04:53:54 +0200 Subject: [PATCH 09/17] Add kibana synthetics http and tcp monitor resources (#699) Implements https://github.com/elastic/terraform-provider-elasticstack/issues/610 --- .github/workflows/test.yml | 13 +- CHANGELOG.md | 1 + Makefile | 4 +- docs/resources/kibana_synthetics_monitor.md | 160 +++++ .../kibana_synthetics_private_location.md | 2 +- .../import.sh | 1 + .../resource.tf | 31 + .../import.sh | 2 +- go.mod | 1 + go.sum | 2 + internal/kibana/synthetics/acc_test.go | 389 +++++++++++ internal/kibana/synthetics/create.go | 47 ++ internal/kibana/synthetics/delete.go | 37 + .../synthetics/private_location/create.go | 10 +- .../synthetics/private_location/delete.go | 24 +- .../synthetics/private_location/read.go | 24 +- .../synthetics/private_location/resource.go | 24 +- .../synthetics/private_location/schema.go | 46 +- .../private_location/schema_test.go | 10 +- internal/kibana/synthetics/read.go | 57 ++ internal/kibana/synthetics/resource.go | 84 +++ internal/kibana/synthetics/schema.go | 631 ++++++++++++++++++ internal/kibana/synthetics/schema_test.go | 446 +++++++++++++ internal/kibana/synthetics/update.go | 54 ++ libs/go-kibana-rest/docker-compose.yml | 9 +- .../kbapi/api.kibana_synthetics.go | 221 +++--- .../kbapi/api.kibana_synthetics_test.go | 142 +++- provider/plugin_framework.go | 2 + .../kibana_synthetics_monitor.md.tmpl | 37 + 29 files changed, 2317 insertions(+), 194 deletions(-) create mode 100644 docs/resources/kibana_synthetics_monitor.md create mode 100644 examples/resources/elasticstack_kibana_synthetics_monitor/import.sh create mode 100644 examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf create mode 100644 internal/kibana/synthetics/acc_test.go create mode 100644 internal/kibana/synthetics/create.go create mode 100644 internal/kibana/synthetics/delete.go create mode 100644 internal/kibana/synthetics/read.go create mode 100644 internal/kibana/synthetics/resource.go create mode 100644 internal/kibana/synthetics/schema_test.go create mode 100644 internal/kibana/synthetics/update.go create mode 100644 templates/resources/kibana_synthetics_monitor.md.tmpl diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2687fb064..088f8d73b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,10 +60,12 @@ jobs: image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.version }} env: discovery.type: single-node - xpack.license.self_generated.type: trial xpack.security.enabled: true xpack.security.authc.api_key.enabled: true + xpack.security.authc.token.enabled: true + xpack.security.http.ssl.enabled: false xpack.watcher.enabled: true + xpack.license.self_generated.type: trial repositories.url.allowed_urls: https://example.com/* path.repo: /tmp ELASTIC_PASSWORD: ${{ env.ELASTIC_PASSWORD }} @@ -78,9 +80,10 @@ jobs: ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }} ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }} XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d - xpack.fleet.enabled: true +# LOGGING_ROOT_LEVEL: debug ports: - 5601:5601 + options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10 timeout-minutes: 15 strategy: @@ -135,6 +138,12 @@ jobs: ELASTICSEARCH_USERNAME: "elastic" ELASTICSEARCH_PASSWORD: ${{ env.ELASTIC_PASSWORD }} + - id: force-install-synthetics + name: Force install synthetics + if: matrix.version == '8.14.3' || matrix.version == '8.15.0' + run: |- + for i in {1..5}; do curl -s -H "Authorization: ApiKey ${{ steps.get-api-key.outputs.apikey }}" --header "Content-Type: application/json" --header "kbn-xsrf: true" --request POST --data '{ "force": true }' http://localhost:5601/api/fleet/epm/packages/synthetics/1.2.2 && break || sleep 15; done + - name: TF acceptance tests timeout-minutes: 10 run: make testacc diff --git a/CHANGELOG.md b/CHANGELOG.md index 055fc6d3d..1f2b99897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## [Unreleased] +- Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699)) - Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682)) diff --git a/Makefile b/Makefile index a139c928a..32ca0af18 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ docker-kibana: docker-network docker-elasticsearch set-kibana-password ## Start -e ELASTICSEARCH_USERNAME=$(KIBANA_SYSTEM_USERNAME) \ -e ELASTICSEARCH_PASSWORD=$(KIBANA_SYSTEM_PASSWORD) \ -e XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d \ - -e "logging.root.level=debug" \ + -e LOGGING_ROOT_LEVEL=debug \ --name $(KIBANA_NAME) \ --network $(ELASTICSEARCH_NETWORK) \ docker.elastic.co/kibana/kibana:$(STACK_VERSION); \ @@ -157,7 +157,7 @@ docker-kibana-with-tls: docker-network docker-elasticsearch set-kibana-password -e SERVER_SSL_CERTIFICATE=/certs/localhost+1.pem \ -e SERVER_SSL_KEY=/certs/localhost+1-key.pem \ -e SERVER_SSL_ENABLED=true \ - -e "logging.root.level=debug" \ + -e LOGGING_ROOT_LEVEL=debug \ --name $(KIBANA_NAME) \ --network $(ELASTICSEARCH_NETWORK) \ docker.elastic.co/kibana/kibana:$(STACK_VERSION); \ diff --git a/docs/resources/kibana_synthetics_monitor.md b/docs/resources/kibana_synthetics_monitor.md new file mode 100644 index 000000000..37ef5de61 --- /dev/null +++ b/docs/resources/kibana_synthetics_monitor.md @@ -0,0 +1,160 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_synthetics_monitor Resource" +description: |- + Creates or updates a Kibana synthetics monitor. +--- + +# Resource: elasticstack_kibana_synthetics_monitor + +Creates or updates a Kibana synthetics monitor. +See [API docs](https://www.elastic.co/guide/en/kibana/current/add-monitor-api.html) + +## Supported monitor types + * `http` + * `tcp` + +**NOTE:** Due-to nature of partial update API, reset values to defaults is not supported. +In case you would like to reset an optional monitor value, please set it explicitly or delete and create new monitor. + + +## Example Usage + +```terraform +provider "elasticstack" { + kibana {} +} + +resource "elasticstack_kibana_synthetics_monitor" "my_monitor" { + name = "Example http monitor" + space_id = "default" + schedule = 10 + locations = ["us_west"] + enabled = false + tags = ["tag"] + alert = { + status = { + enabled = true + } + tls = { + enabled = false + } + } + service_name = "example apm service" + timeout = 30 + http = { + url = "http://localhost:8080" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.2"] + max_redirects = "10" + mode = "all" + ipv4 = true + ipv6 = true + } +} +``` + + +## Schema + +### Required + +- `name` (String) The monitor’s name. + +### Optional + +- `alert` (Attributes) Alert configuration. Default: `{ status: { enabled: true }, tls: { enabled: true } }`. (see [below for nested schema](#nestedatt--alert)) +- `enabled` (Boolean) Whether the monitor is enabled. Default: `true` +- `http` (Attributes) HTTP Monitor specific fields (see [below for nested schema](#nestedatt--http)) +- `locations` (List of String) Where to deploy the monitor. Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations. +- `params` (String) Monitor parameters. Raw JSON object, use `jsonencode` function to represent JSON +- `private_locations` (List of String) These Private Locations refer to locations hosted and managed by you, whereas locations are hosted by Elastic. You can specify a Private Location using the location’s name. +- `retest_on_failure` (Boolean) Enable or disable retesting when a monitor fails. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created, and if configured, an alert sent. Then the monitor will resume running according to the defined schedule. Using retest_on_failure can reduce noise related to transient problems. Default: `true`. +- `schedule` (Number) The monitor’s schedule in minutes. Supported values are 1, 3, 5, 10, 15, 30, 60, 120 and 240. +- `service_name` (String) The APM service name. +- `space_id` (String) The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: *, \, /, ?, ", <, >, |, whitespace, ,, #, :, or -. Default: `default` +- `tags` (List of String) An array of tags. +- `tcp` (Attributes) TCP Monitor specific fields (see [below for nested schema](#nestedatt--tcp)) +- `timeout` (Number) The monitor timeout in seconds, monitor will fail if it doesn’t complete within this time. Default: `16` + +### Read-Only + +- `id` (String) Generated identifier for the monitor + + +### Nested Schema for `alert` + +Optional: + +- `status` (Attributes) (see [below for nested schema](#nestedatt--alert--status)) +- `tls` (Attributes) (see [below for nested schema](#nestedatt--alert--tls)) + + +### Nested Schema for `alert.status` + +Optional: + +- `enabled` (Boolean) + + + +### Nested Schema for `alert.tls` + +Optional: + +- `enabled` (Boolean) + + + + +### Nested Schema for `http` + +Required: + +- `url` (String) URL to monitor. + +Optional: + +- `check` (String) The check request settings.. Raw JSON object, use `jsonencode` function to represent JSON +- `ipv4` (Boolean) Whether to ping using the ipv4 protocol. +- `ipv6` (Boolean) Whether to ping using the ipv6 protocol. +- `max_redirects` (Number) The maximum number of redirects to follow. Default: `0` +- `mode` (String) The mode of the monitor. Can be "all" or "any". If you’re using a DNS-load balancer and want to ping every IP address for the specified hostname, you should use all. +- `password` (String) The password for authenticating with the server. The credentials are passed with the request. +- `proxy_header` (String) Additional headers to send to proxies during CONNECT requests.. Raw JSON object, use `jsonencode` function to represent JSON +- `proxy_url` (String) The URL of the proxy to use for this monitor. +- `response` (String) Controls the indexing of the HTTP response body contents to the `http.response.body.contents` field.. Raw JSON object, use `jsonencode` function to represent JSON +- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. +- `ssl_verification_mode` (String) Controls the verification of server certificates. +- `username` (String) The username for authenticating with the server. The credentials are passed with the request. + + + +### Nested Schema for `tcp` + +Required: + +- `host` (String) The host to monitor; it can be an IP address or a hostname. The host can include the port using a colon (e.g., "example.com:9200"). + +Optional: + +- `check_receive` (String) The expected answer. +- `check_send` (String) An optional payload string to send to the remote host. +- `proxy_url` (String) The URL of the SOCKS5 proxy to use when connecting to the server. The value must be a URL with a scheme of `socks5://`. If the SOCKS5 proxy server requires client authentication, then a username and password can be embedded in the URL. When using a proxy, hostnames are resolved on the proxy server instead of on the client. You can change this behavior by setting the `proxy_use_local_resolver` option. +- `proxy_use_local_resolver` (Boolean) A Boolean value that determines whether hostnames are resolved locally instead of being resolved on the proxy server. The default value is false, which means that name resolution occurs on the proxy server. +- `ssl_supported_protocols` (List of String) List of allowed SSL/TLS versions. +- `ssl_verification_mode` (String) Controls the verification of server certificates. + +## Import + +Import is supported using the following syntax: + +```shell +terraform import elasticstack_kibana_synthetics_monitor.my_monitor / +``` + +**NOTE:** Not all monitor fields are supported during the import due-to API limitation. +Full field support could be implemented after this [kibana issue](https://github.com/elastic/kibana/issues/189906) is resolved. + +Currently not supported fields during the import: `params`, `retest_on_failure`, `http.proxy_header`, `http.username`, `http.password`, `http.check`, `http.response`, `tcp.check_send`, `tcp.check_receive` diff --git a/docs/resources/kibana_synthetics_private_location.md b/docs/resources/kibana_synthetics_private_location.md index 3ae5272b6..527554a61 100644 --- a/docs/resources/kibana_synthetics_private_location.md +++ b/docs/resources/kibana_synthetics_private_location.md @@ -72,5 +72,5 @@ Required: Import is supported using the following syntax: ```shell -terraform import elasticstack_kibana_synthetics_private_location.my_location +terraform import elasticstack_kibana_synthetics_private_location.my_location / ``` \ No newline at end of file diff --git a/examples/resources/elasticstack_kibana_synthetics_monitor/import.sh b/examples/resources/elasticstack_kibana_synthetics_monitor/import.sh new file mode 100644 index 000000000..c66f88e8f --- /dev/null +++ b/examples/resources/elasticstack_kibana_synthetics_monitor/import.sh @@ -0,0 +1 @@ +terraform import elasticstack_kibana_synthetics_monitor.my_monitor / diff --git a/examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf b/examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf new file mode 100644 index 000000000..b38e70609 --- /dev/null +++ b/examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf @@ -0,0 +1,31 @@ +provider "elasticstack" { + kibana {} +} + +resource "elasticstack_kibana_synthetics_monitor" "my_monitor" { + name = "Example http monitor" + space_id = "default" + schedule = 10 + locations = ["us_west"] + enabled = false + tags = ["tag"] + alert = { + status = { + enabled = true + } + tls = { + enabled = false + } + } + service_name = "example apm service" + timeout = 30 + http = { + url = "http://localhost:8080" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.2"] + max_redirects = "10" + mode = "all" + ipv4 = true + ipv6 = true + } +} diff --git a/examples/resources/elasticstack_kibana_synthetics_private_location/import.sh b/examples/resources/elasticstack_kibana_synthetics_private_location/import.sh index 628bacff4..2a16897dc 100644 --- a/examples/resources/elasticstack_kibana_synthetics_private_location/import.sh +++ b/examples/resources/elasticstack_kibana_synthetics_private_location/import.sh @@ -1 +1 @@ -terraform import elasticstack_kibana_synthetics_private_location.my_location +terraform import elasticstack_kibana_synthetics_private_location.my_location / diff --git a/go.mod b/go.mod index 0d472137b..53aba661f 100644 --- a/go.mod +++ b/go.mod @@ -49,6 +49,7 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.21.0 // indirect github.com/hashicorp/terraform-json v0.22.1 // indirect + github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/go.sum b/go.sum index c09e89233..414f5829d 100644 --- a/go.sum +++ b/go.sum @@ -90,6 +90,8 @@ github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7 github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= github.com/hashicorp/terraform-plugin-framework v1.10.0 h1:xXhICE2Fns1RYZxEQebwkB2+kXouLC932Li9qelozrc= github.com/hashicorp/terraform-plugin-framework v1.10.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM= +github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 h1:b8vZYB/SkXJT4YPbT3trzE6oJ7dPyMy68+9dEDKsJjE= +github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0/go.mod h1:tP9BC3icoXBz72evMS5UTFvi98CiKhPdXF6yLs1wS8A= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo= github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= diff --git a/internal/kibana/synthetics/acc_test.go b/internal/kibana/synthetics/acc_test.go new file mode 100644 index 000000000..264ba04c4 --- /dev/null +++ b/internal/kibana/synthetics/acc_test.go @@ -0,0 +1,389 @@ +package synthetics_test + +import ( + "fmt" + sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "testing" + + "github.com/elastic/terraform-provider-elasticstack/internal/acctest" + "github.com/elastic/terraform-provider-elasticstack/internal/versionutils" + "github.com/hashicorp/go-version" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +var ( + minKibanaVersion = version.Must(version.NewVersion("8.14.0")) +) + +const ( + httpMonitorConfig = ` + +resource "elasticstack_kibana_synthetics_monitor" "%s" { + name = "TestHttpMonitorResource - %s" + space_id = "testacc" + schedule = 5 + private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] + enabled = true + tags = ["a", "b"] + alert = { + status = { + enabled = true + } + tls = { + enabled = true + } + } + service_name = "test apm service" + timeout = 30 + http = { + url = "http://localhost:5601" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.0", "TLSv1.1", "TLSv1.2"] + max_redirects = 10 + mode = "any" + ipv4 = true + ipv6 = false + proxy_url = "http://localhost:8080" + } +} +` + + httpMonitorUpdated = ` +resource "elasticstack_kibana_synthetics_monitor" "%s" { + name = "TestHttpMonitorResource Updated - %s" + space_id = "testacc" + schedule = 10 + private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] + enabled = false + tags = ["c", "d", "e"] + alert = { + status = { + enabled = true + } + tls = { + enabled = false + } + } + service_name = "test apm service" + timeout = 30 + http = { + url = "http://localhost:8080" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.2"] + max_redirects = 10 + mode = "all" + ipv4 = true + ipv6 = true + proxy_url = "http://localhost" + proxy_header = jsonencode({ + "header-name" = "header-value-updated" + }) + username = "testupdated" + password = "testpassword-updated" + check = jsonencode({ + "request": { + "method": "POST", + "headers": { + "Content-Type": "application/x-www-form-urlencoded", + }, + "body": "name=first&email=someemail@someemailprovider.com", + }, + "response": { + "status": [200, 201, 301], + "body": { + "positive": ["foo", "bar"] + } + } + }) + response = jsonencode({ + "include_body": "never", + "include_body_max_bytes": "1024", + }) + } + params = jsonencode({ + "param-name" = "param-value-updated" + }) + retest_on_failure = false +} + +` + + tcpMonitorConfig = ` + +resource "elasticstack_kibana_synthetics_monitor" "%s" { + name = "TestTcpMonitorResource - %s" + space_id = "default" + schedule = 5 + private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] + enabled = true + tags = ["a", "b"] + alert = { + status = { + enabled = true + } + tls = { + enabled = true + } + } + service_name = "test apm service" + timeout = 30 + tcp = { + host = "http://localhost:5601" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.0", "TLSv1.1", "TLSv1.2"] + proxy_url = "http://localhost:8080" + proxy_use_local_resolver = true + } +} +` + + tcpMonitorUpdated = ` +resource "elasticstack_kibana_synthetics_monitor" "%s" { + name = "TestTcpMonitorResource Updated - %s" + space_id = "default" + schedule = 10 + private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] + enabled = false + tags = ["c", "d", "e"] + alert = { + status = { + enabled = true + } + tls = { + enabled = false + } + } + service_name = "test apm service" + timeout = 30 + tcp = { + host = "http://localhost:8080" + ssl_verification_mode = "full" + ssl_supported_protocols = ["TLSv1.2"] + proxy_url = "http://localhost" + proxy_use_local_resolver = false + check_send = "Hello Updated" + check_receive = "World Updated" + } +} + +` +) + +func TestSyntheticMonitorHTTPResource(t *testing.T) { + + name := sdkacctest.RandStringFromCharSet(22, sdkacctest.CharSetAlphaNum) + id := "http-monitor" + httpMonitorId, config := testMonitorConfig(id, httpMonitorConfig, name) + _, configUpdated := testMonitorConfig(id, httpMonitorUpdated, name) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProtoV6ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + // Create and Read http monitor + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + Config: config, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet(httpMonitorId, "id"), + resource.TestCheckResourceAttr(httpMonitorId, "name", "TestHttpMonitorResource - "+name), + resource.TestCheckResourceAttr(httpMonitorId, "space_id", "testacc"), + resource.TestCheckResourceAttr(httpMonitorId, "schedule", "5"), + resource.TestCheckResourceAttr(httpMonitorId, "private_locations.#", "1"), + resource.TestCheckResourceAttrSet(httpMonitorId, "private_locations.0"), + resource.TestCheckResourceAttr(httpMonitorId, "enabled", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.#", "2"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.0", "a"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.1", "b"), + resource.TestCheckResourceAttr(httpMonitorId, "alert.status.enabled", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "alert.tls.enabled", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "service_name", "test apm service"), + resource.TestCheckResourceAttr(httpMonitorId, "timeout", "30"), + resource.TestCheckResourceAttr(httpMonitorId, "http.url", "http://localhost:5601"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_verification_mode", "full"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.#", "3"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.0", "TLSv1.0"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.1", "TLSv1.1"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.2", "TLSv1.2"), + resource.TestCheckResourceAttr(httpMonitorId, "http.max_redirects", "10"), + resource.TestCheckResourceAttr(httpMonitorId, "http.mode", "any"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ipv4", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ipv6", "false"), + resource.TestCheckResourceAttr(httpMonitorId, "http.proxy_url", "http://localhost:8080"), + ), + }, + // ImportState testing + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + ResourceName: httpMonitorId, + ImportState: true, + ImportStateVerify: true, + Config: config, + }, + // Update and Read testing http monitor + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + ResourceName: httpMonitorId, + Config: configUpdated, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet(httpMonitorId, "id"), + resource.TestCheckResourceAttr(httpMonitorId, "name", "TestHttpMonitorResource Updated - "+name), + resource.TestCheckResourceAttr(httpMonitorId, "space_id", "testacc"), + resource.TestCheckResourceAttr(httpMonitorId, "schedule", "10"), + resource.TestCheckResourceAttr(httpMonitorId, "private_locations.#", "1"), + resource.TestCheckResourceAttrSet(httpMonitorId, "private_locations.0"), + resource.TestCheckResourceAttr(httpMonitorId, "enabled", "false"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.#", "3"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.0", "c"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.1", "d"), + resource.TestCheckResourceAttr(httpMonitorId, "tags.2", "e"), + resource.TestCheckResourceAttr(httpMonitorId, "alert.status.enabled", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "alert.tls.enabled", "false"), + resource.TestCheckResourceAttr(httpMonitorId, "service_name", "test apm service"), + resource.TestCheckResourceAttr(httpMonitorId, "timeout", "30"), + resource.TestCheckResourceAttr(httpMonitorId, "http.url", "http://localhost:8080"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_verification_mode", "full"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.#", "1"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ssl_supported_protocols.0", "TLSv1.2"), + resource.TestCheckResourceAttr(httpMonitorId, "http.max_redirects", "10"), + resource.TestCheckResourceAttr(httpMonitorId, "http.mode", "all"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ipv4", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "http.ipv6", "true"), + resource.TestCheckResourceAttr(httpMonitorId, "http.proxy_url", "http://localhost"), + resource.TestCheckNoResourceAttr(httpMonitorId, "tcp"), + //check for merge attributes + resource.TestCheckResourceAttr(httpMonitorId, "http.proxy_header", `{"header-name":"header-value-updated"}`), + resource.TestCheckResourceAttr(httpMonitorId, "http.username", "testupdated"), + resource.TestCheckResourceAttr(httpMonitorId, "http.password", "testpassword-updated"), + resource.TestCheckResourceAttr(httpMonitorId, "http.check", `{"request":{"body":"name=first\u0026email=someemail@someemailprovider.com","headers":{"Content-Type":"application/x-www-form-urlencoded"},"method":"POST"},"response":{"body":{"positive":["foo","bar"]},"status":[200,201,301]}}`), + resource.TestCheckResourceAttr(httpMonitorId, "http.response", `{"include_body":"never","include_body_max_bytes":"1024"}`), + resource.TestCheckResourceAttr(httpMonitorId, "params", `{"param-name":"param-value-updated"}`), + resource.TestCheckResourceAttr(httpMonitorId, "retest_on_failure", "false"), + ), + }, + // Delete testing automatically occurs in TestCase + }, + }) +} + +func TestSyntheticMonitorTCPResource(t *testing.T) { + + name := sdkacctest.RandStringFromCharSet(22, sdkacctest.CharSetAlphaNum) + id := "tcp-monitor" + tcpMonitorId, config := testMonitorConfig(id, tcpMonitorConfig, name) + _, configUpdated := testMonitorConfig(id, tcpMonitorUpdated, name) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProtoV6ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + + // Create and Read tcp monitor + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + Config: config, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet(tcpMonitorId, "id"), + resource.TestCheckResourceAttr(tcpMonitorId, "name", "TestTcpMonitorResource - "+name), + resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "default"), + resource.TestCheckResourceAttr(tcpMonitorId, "schedule", "5"), + resource.TestCheckResourceAttr(tcpMonitorId, "private_locations.#", "1"), + resource.TestCheckResourceAttrSet(tcpMonitorId, "private_locations.0"), + resource.TestCheckResourceAttr(tcpMonitorId, "enabled", "true"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.#", "2"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.0", "a"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.1", "b"), + resource.TestCheckResourceAttr(tcpMonitorId, "alert.status.enabled", "true"), + resource.TestCheckResourceAttr(tcpMonitorId, "alert.tls.enabled", "true"), + resource.TestCheckResourceAttr(tcpMonitorId, "service_name", "test apm service"), + resource.TestCheckResourceAttr(tcpMonitorId, "timeout", "30"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.host", "http://localhost:5601"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_verification_mode", "full"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.#", "3"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.0", "TLSv1.0"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.1", "TLSv1.1"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.2", "TLSv1.2"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_url", "http://localhost:8080"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_use_local_resolver", "true"), + ), + }, + // ImportState testing + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + ResourceName: tcpMonitorId, + ImportState: true, + ImportStateVerify: true, + Config: config, + }, + // Update and Read tcp monitor + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + ResourceName: tcpMonitorId, + Config: configUpdated, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet(tcpMonitorId, "id"), + resource.TestCheckResourceAttr(tcpMonitorId, "name", "TestTcpMonitorResource Updated - "+name), + resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "default"), + resource.TestCheckResourceAttr(tcpMonitorId, "schedule", "10"), + resource.TestCheckResourceAttr(tcpMonitorId, "private_locations.#", "1"), + resource.TestCheckResourceAttrSet(tcpMonitorId, "private_locations.0"), + resource.TestCheckResourceAttr(tcpMonitorId, "enabled", "false"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.#", "3"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.0", "c"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.1", "d"), + resource.TestCheckResourceAttr(tcpMonitorId, "tags.2", "e"), + resource.TestCheckResourceAttr(tcpMonitorId, "alert.status.enabled", "true"), + resource.TestCheckResourceAttr(tcpMonitorId, "alert.tls.enabled", "false"), + resource.TestCheckResourceAttr(tcpMonitorId, "service_name", "test apm service"), + resource.TestCheckResourceAttr(tcpMonitorId, "timeout", "30"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.host", "http://localhost:8080"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_verification_mode", "full"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.#", "1"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.ssl_supported_protocols.0", "TLSv1.2"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_url", "http://localhost"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.proxy_use_local_resolver", "false"), + resource.TestCheckNoResourceAttr(tcpMonitorId, "http"), + //check for merge attributes + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.check_send", "Hello Updated"), + resource.TestCheckResourceAttr(tcpMonitorId, "tcp.check_receive", "World Updated"), + ), + }, + // Delete testing automatically occurs in TestCase + + }, + }) +} + +func testMonitorConfig(id, cfg, name string) (string, string) { + + resourceId := "elasticstack_kibana_synthetics_monitor." + id + privateLocationId := "pl-" + id + agentPolicyId := "apl-" + id + + provider := fmt.Sprintf(` +provider "elasticstack" { + elasticsearch {} + kibana {} + fleet{} +} + +resource "elasticstack_fleet_agent_policy" "%s" { + name = "TestMonitorResource Agent Policy - %s" + namespace = "testacc" + description = "TestMonitorResource Agent Policy" + monitor_logs = true + monitor_metrics = true + skip_destroy = false +} + +resource "elasticstack_kibana_synthetics_private_location" "%s" { + label = "TestMonitorResource-label-%s" + space_id = "testacc" + agent_policy_id = elasticstack_fleet_agent_policy.%s.policy_id +} +`, agentPolicyId, name, privateLocationId, name, agentPolicyId) + + config := fmt.Sprintf(cfg, id, name, privateLocationId) + + return resourceId, provider + config +} diff --git a/internal/kibana/synthetics/create.go b/internal/kibana/synthetics/create.go new file mode 100644 index 000000000..26cc9285f --- /dev/null +++ b/internal/kibana/synthetics/create.go @@ -0,0 +1,47 @@ +package synthetics + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, response *resource.CreateResponse) { + + kibanaClient := GetKibanaClient(r, response.Diagnostics) + if kibanaClient == nil { + return + } + + plan := new(tfModelV0) + diags := request.Plan.Get(ctx, plan) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + input, diags := plan.toKibanaAPIRequest() + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + namespace := plan.SpaceID.ValueString() + result, err := kibanaClient.KibanaSynthetics.Monitor.Add(ctx, input.config, input.fields, namespace) + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("Failed to create Kibana monitor `%s`, namespace %s", input.config.Name, namespace), err.Error()) + return + } + + plan, err = plan.toModelV0(result) + if err != nil { + response.Diagnostics.AddError("Failed to convert Kibana monitor API to TF state", err.Error()) + return + } + + diags = response.State.Set(ctx, plan) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } +} diff --git a/internal/kibana/synthetics/delete.go b/internal/kibana/synthetics/delete.go new file mode 100644 index 000000000..fc93d57a2 --- /dev/null +++ b/internal/kibana/synthetics/delete.go @@ -0,0 +1,37 @@ +package synthetics + +import ( + "context" + "fmt" + "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func (r *Resource) Delete(ctx context.Context, request resource.DeleteRequest, response *resource.DeleteResponse) { + + kibanaClient := GetKibanaClient(r, response.Diagnostics) + if kibanaClient == nil { + return + } + + var plan tfModelV0 + diags := request.State.Get(ctx, &plan) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + compositeId, dg := GetCompositeId(plan.ID.ValueString()) + response.Diagnostics.Append(dg...) + if response.Diagnostics.HasError() { + return + } + + namespace := plan.SpaceID.ValueString() + _, err := kibanaClient.KibanaSynthetics.Monitor.Delete(ctx, namespace, kbapi.MonitorID(compositeId.ResourceId)) + + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("Failed to delete private location `%s`, namespace %s", compositeId, namespace), err.Error()) + return + } +} diff --git a/internal/kibana/synthetics/private_location/create.go b/internal/kibana/synthetics/private_location/create.go index 9f0bf2aa3..7fd4c8a34 100644 --- a/internal/kibana/synthetics/private_location/create.go +++ b/internal/kibana/synthetics/private_location/create.go @@ -3,15 +3,13 @@ package private_location import ( "context" "fmt" + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-log/tflog" ) func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, response *resource.CreateResponse) { - tflog.Info(ctx, "Create private location") - - kibanaClient := r.getKibanaClient(response.Diagnostics) + kibanaClient := synthetics.GetKibanaClient(r, response.Diagnostics) if kibanaClient == nil { return } @@ -23,10 +21,10 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r return } - input := plan.toPrivateLocation() + input := plan.toPrivateLocationConfig() namespace := plan.SpaceID.ValueString() - result, err := kibanaClient.KibanaSynthetics.PrivateLocation.Create(input.PrivateLocationConfig, namespace) + result, err := kibanaClient.KibanaSynthetics.PrivateLocation.Create(ctx, input, namespace) if err != nil { response.Diagnostics.AddError(fmt.Sprintf("Failed to create private location `%s`, namespace %s", input.Label, namespace), err.Error()) return diff --git a/internal/kibana/synthetics/private_location/delete.go b/internal/kibana/synthetics/private_location/delete.go index 1b7ecb5f1..34cf9a097 100644 --- a/internal/kibana/synthetics/private_location/delete.go +++ b/internal/kibana/synthetics/private_location/delete.go @@ -3,15 +3,13 @@ package private_location import ( "context" "fmt" + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-log/tflog" ) func (r *Resource) Delete(ctx context.Context, request resource.DeleteRequest, response *resource.DeleteResponse) { - tflog.Info(ctx, "Delete private location") - - kibanaClient := r.getKibanaClient(response.Diagnostics) + kibanaClient := synthetics.GetKibanaClient(r, response.Diagnostics) if kibanaClient == nil { return } @@ -23,12 +21,24 @@ func (r *Resource) Delete(ctx context.Context, request resource.DeleteRequest, r return } - id := plan.ID.ValueString() + resourceId := plan.ID.ValueString() namespace := plan.SpaceID.ValueString() - err := kibanaClient.KibanaSynthetics.PrivateLocation.Delete(id, namespace) + + compositeId, dg := tryReadCompositeId(resourceId) + response.Diagnostics.Append(dg...) + if response.Diagnostics.HasError() { + return + } + + if compositeId != nil { + resourceId = compositeId.ResourceId + namespace = compositeId.ClusterId + } + + err := kibanaClient.KibanaSynthetics.PrivateLocation.Delete(ctx, resourceId, namespace) if err != nil { - response.Diagnostics.AddError(fmt.Sprintf("Failed to delete private location `%s`, namespace %s", id, namespace), err.Error()) + response.Diagnostics.AddError(fmt.Sprintf("Failed to delete private location `%s`, namespace %s", resourceId, namespace), err.Error()) return } diff --git a/internal/kibana/synthetics/private_location/read.go b/internal/kibana/synthetics/private_location/read.go index dedd7a8b7..dcd004d2d 100644 --- a/internal/kibana/synthetics/private_location/read.go +++ b/internal/kibana/synthetics/private_location/read.go @@ -5,15 +5,13 @@ import ( "errors" "fmt" "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-log/tflog" ) func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, response *resource.ReadResponse) { - tflog.Info(ctx, "Read private location") - - kibanaClient := r.getKibanaClient(response.Diagnostics) + kibanaClient := synthetics.GetKibanaClient(r, response.Diagnostics) if kibanaClient == nil { return } @@ -25,9 +23,21 @@ func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, respo return } - label := state.Label.ValueString() + resourceId := state.ID.ValueString() namespace := state.SpaceID.ValueString() - result, err := kibanaClient.KibanaSynthetics.PrivateLocation.Get(label, namespace) + + compositeId, dg := tryReadCompositeId(resourceId) + response.Diagnostics.Append(dg...) + if response.Diagnostics.HasError() { + return + } + + if compositeId != nil { + resourceId = compositeId.ResourceId + namespace = compositeId.ClusterId + } + + result, err := kibanaClient.KibanaSynthetics.PrivateLocation.Get(ctx, resourceId, namespace) if err != nil { var apiError *kbapi.APIError if errors.As(err, &apiError) && apiError.Code == 404 { @@ -35,7 +45,7 @@ func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, respo return } - response.Diagnostics.AddError(fmt.Sprintf("Failed to get private location `%s`, namespace %s", label, namespace), err.Error()) + response.Diagnostics.AddError(fmt.Sprintf("Failed to get private location `%s`, namespace %s", resourceId, namespace), err.Error()) return } diff --git a/internal/kibana/synthetics/private_location/resource.go b/internal/kibana/synthetics/private_location/resource.go index 0da381cde..c4023e7de 100644 --- a/internal/kibana/synthetics/private_location/resource.go +++ b/internal/kibana/synthetics/private_location/resource.go @@ -2,10 +2,8 @@ package private_location import ( "context" - "github.com/disaster37/go-kibana-rest/v8" "github.com/elastic/terraform-provider-elasticstack/internal/clients" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" - "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -17,9 +15,15 @@ const resourceName = synthetics.MetadataPrefix + "private_location" var _ resource.Resource = &Resource{} var _ resource.ResourceWithConfigure = &Resource{} var _ resource.ResourceWithImportState = &Resource{} +var _ synthetics.ESApiClient = &Resource{} type Resource struct { client *clients.ApiClient + synthetics.ESApiClient +} + +func (r *Resource) GetClient() *clients.ApiClient { + return r.client } func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { @@ -27,8 +31,7 @@ func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *res } func (r *Resource) ImportState(ctx context.Context, request resource.ImportStateRequest, response *resource.ImportStateResponse) { - tflog.Info(ctx, "Import private location") - resource.ImportStatePassthroughID(ctx, path.Root("label"), request, response) + resource.ImportStatePassthroughID(ctx, path.Root("id"), request, response) } func (r *Resource) Configure(ctx context.Context, request resource.ConfigureRequest, response *resource.ConfigureResponse) { @@ -48,16 +51,3 @@ func (r *Resource) Update(ctx context.Context, _ resource.UpdateRequest, respons "Synthetics private location could only be replaced. Please, note, that only unused locations could be deleted.", ) } - -func (r *Resource) getKibanaClient(dg diag.Diagnostics) *kibana.Client { - if !r.resourceReady(&dg) { - return nil - } - - kibanaClient, err := r.client.GetKibanaClient() - if err != nil { - dg.AddError("unable to get kibana client", err.Error()) - return nil - } - return kibanaClient -} diff --git a/internal/kibana/synthetics/private_location/schema.go b/internal/kibana/synthetics/private_location/schema.go index 9b7316a5a..6a78942c5 100644 --- a/internal/kibana/synthetics/private_location/schema.go +++ b/internal/kibana/synthetics/private_location/schema.go @@ -2,6 +2,7 @@ package private_location import ( "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -9,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/types" + "strings" ) type tfModelV0 struct { @@ -72,53 +74,41 @@ func privateLocationSchema() schema.Schema { } } -func (r *Resource) resourceReady(dg *diag.Diagnostics) bool { - if r.client == nil { - dg.AddError( - "Unconfigured Client", - "Expected configured client. Please report this issue to the provider developers.", - ) - - return false - } - return true -} - -func (m *tfModelV0) toPrivateLocation() kbapi.PrivateLocation { +func (m *tfModelV0) toPrivateLocationConfig() kbapi.PrivateLocationConfig { var geoConfig *kbapi.SyntheticGeoConfig if m.Geo != nil { geoConfig = m.Geo.ToSyntheticGeoConfig() } - var tags []string - for _, tag := range m.Tags { - tags = append(tags, tag.ValueString()) - } - pLoc := kbapi.PrivateLocationConfig{ + return kbapi.PrivateLocationConfig{ Label: m.Label.ValueString(), AgentPolicyId: m.AgentPolicyId.ValueString(), - Tags: tags, + Tags: synthetics.ValueStringSlice(m.Tags), Geo: geoConfig, } +} - return kbapi.PrivateLocation{ - Id: m.ID.ValueString(), - Namespace: m.SpaceID.ValueString(), - PrivateLocationConfig: pLoc, +func tryReadCompositeId(id string) (*clients.CompositeId, diag.Diagnostics) { + if strings.Contains(id, "/") { + compositeId, diagnostics := synthetics.GetCompositeId(id) + return compositeId, diagnostics } + return nil, diag.Diagnostics{} } func toModelV0(pLoc kbapi.PrivateLocation) tfModelV0 { - var tags []types.String - for _, tag := range pLoc.Tags { - tags = append(tags, types.StringValue(tag)) + + resourceID := clients.CompositeId{ + ClusterId: pLoc.Namespace, + ResourceId: pLoc.Id, } + return tfModelV0{ - ID: types.StringValue(pLoc.Id), + ID: types.StringValue(resourceID.String()), Label: types.StringValue(pLoc.Label), SpaceID: types.StringValue(pLoc.Namespace), AgentPolicyId: types.StringValue(pLoc.AgentPolicyId), - Tags: tags, + Tags: synthetics.StringSliceValue(pLoc.Tags), Geo: synthetics.FromSyntheticGeoConfig(pLoc.Geo), } } diff --git a/internal/kibana/synthetics/private_location/schema_test.go b/internal/kibana/synthetics/private_location/schema_test.go index c22c6a846..60ba3b047 100644 --- a/internal/kibana/synthetics/private_location/schema_test.go +++ b/internal/kibana/synthetics/private_location/schema_test.go @@ -1,6 +1,7 @@ package private_location import ( + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "testing" "github.com/disaster37/go-kibana-rest/v8/kbapi" @@ -71,7 +72,14 @@ func Test_roundtrip(t *testing.T) { PrivateLocationConfig: plc, } modelV0 := toModelV0(input) - actual := modelV0.toPrivateLocation() + + compositeId, _ := synthetics.GetCompositeId(modelV0.ID.ValueString()) + + actual := kbapi.PrivateLocation{ + Id: compositeId.ResourceId, + Namespace: modelV0.SpaceID.ValueString(), + PrivateLocationConfig: modelV0.toPrivateLocationConfig(), + } assert.Equal(t, input, actual) }) } diff --git a/internal/kibana/synthetics/read.go b/internal/kibana/synthetics/read.go new file mode 100644 index 000000000..d38799baa --- /dev/null +++ b/internal/kibana/synthetics/read.go @@ -0,0 +1,57 @@ +package synthetics + +import ( + "context" + "errors" + "fmt" + "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func (r *Resource) Read(ctx context.Context, request resource.ReadRequest, response *resource.ReadResponse) { + + kibanaClient := GetKibanaClient(r, response.Diagnostics) + if kibanaClient == nil { + return + } + + state := new(tfModelV0) + diags := request.State.Get(ctx, state) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + compositeId, dg := GetCompositeId(state.ID.ValueString()) + response.Diagnostics.Append(dg...) + if response.Diagnostics.HasError() { + return + } + + namespace := compositeId.ClusterId + monitorId := kbapi.MonitorID(compositeId.ResourceId) + result, err := kibanaClient.KibanaSynthetics.Monitor.Get(ctx, monitorId, namespace) + if err != nil { + var apiError *kbapi.APIError + if errors.As(err, &apiError) && apiError.Code == 404 { + response.State.RemoveResource(ctx) + return + } + + response.Diagnostics.AddError(fmt.Sprintf("Failed to get monitor `%s`, namespace %s", monitorId, namespace), err.Error()) + return + } + + state, err = state.toModelV0(result) + if err != nil { + response.Diagnostics.AddError("Failed to convert Kibana monitor API to TF state", err.Error()) + return + } + + // Set refreshed state + diags = response.State.Set(ctx, state) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } +} diff --git a/internal/kibana/synthetics/resource.go b/internal/kibana/synthetics/resource.go new file mode 100644 index 000000000..1925ff521 --- /dev/null +++ b/internal/kibana/synthetics/resource.go @@ -0,0 +1,84 @@ +package synthetics + +import ( + "context" + "github.com/disaster37/go-kibana-rest/v8" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/hashicorp/terraform-plugin-framework-validators/resourcevalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +const resourceName = MetadataPrefix + "monitor" + +// Ensure provider defined types fully satisfy framework interfaces +var _ resource.Resource = &Resource{} +var _ resource.ResourceWithConfigure = &Resource{} +var _ resource.ResourceWithImportState = &Resource{} +var _ resource.ResourceWithConfigValidators = &Resource{} +var _ ESApiClient = &Resource{} + +type ESApiClient interface { + GetClient() *clients.ApiClient +} + +func GetKibanaClient(c ESApiClient, dg diag.Diagnostics) *kibana.Client { + + client := c.GetClient() + if client == nil { + dg.AddError( + "Unconfigured Client", + "Expected configured client. Please report this issue to the provider developers.", + ) + return nil + } + + kibanaClient, err := client.GetKibanaClient() + if err != nil { + dg.AddError("unable to get kibana client", err.Error()) + return nil + } + return kibanaClient +} + +type Resource struct { + client *clients.ApiClient + ESApiClient +} + +func (r *Resource) GetClient() *clients.ApiClient { + return r.client +} +func (r *Resource) ConfigValidators(ctx context.Context) []resource.ConfigValidator { + return []resource.ConfigValidator{ + resourcevalidator.ExactlyOneOf( + path.MatchRoot("http"), + path.MatchRoot("tcp"), + // other monitor config types: icmp, browser + ), + resourcevalidator.AtLeastOneOf( + path.MatchRoot("locations"), + path.MatchRoot("private_locations"), + ), + } +} + +func (r *Resource) ImportState(ctx context.Context, request resource.ImportStateRequest, response *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), request, response) +} + +func (r *Resource) Configure(ctx context.Context, request resource.ConfigureRequest, response *resource.ConfigureResponse) { + client, diags := clients.ConvertProviderData(request.ProviderData) + response.Diagnostics.Append(diags...) + r.client = client +} + +func (r *Resource) Metadata(ctx context.Context, request resource.MetadataRequest, response *resource.MetadataResponse) { + response.TypeName = request.ProviderTypeName + resourceName +} + +func (r *Resource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { + response.Schema = monitorConfigSchema() + +} diff --git a/internal/kibana/synthetics/schema.go b/internal/kibana/synthetics/schema.go index 91f29aaf6..2f8267a4b 100644 --- a/internal/kibana/synthetics/schema.go +++ b/internal/kibana/synthetics/schema.go @@ -1,15 +1,307 @@ package synthetics import ( + "encoding/json" + "fmt" "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" + "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" + "strconv" ) const ( MetadataPrefix = "_kibana_synthetics_" ) +type kibanaAPIRequest struct { + fields kbapi.MonitorFields + config kbapi.SyntheticsMonitorConfig +} + +type tfStatusConfigV0 struct { + Enabled types.Bool `tfsdk:"enabled"` +} + +type tfAlertConfigV0 struct { + Status *tfStatusConfigV0 `tfsdk:"status"` + TLS *tfStatusConfigV0 `tfsdk:"tls"` +} + +type tfHTTPMonitorFieldsV0 struct { + URL types.String `tfsdk:"url"` + SslVerificationMode types.String `tfsdk:"ssl_verification_mode"` + SslSupportedProtocols []types.String `tfsdk:"ssl_supported_protocols"` + MaxRedirects types.Int64 `tfsdk:"max_redirects"` + Mode types.String `tfsdk:"mode"` + IPv4 types.Bool `tfsdk:"ipv4"` + IPv6 types.Bool `tfsdk:"ipv6"` + ProxyURL types.String `tfsdk:"proxy_url"` + ProxyHeader jsontypes.Normalized `tfsdk:"proxy_header"` + Username types.String `tfsdk:"username"` + Password types.String `tfsdk:"password"` + Response jsontypes.Normalized `tfsdk:"response"` + Check jsontypes.Normalized `tfsdk:"check"` +} + +type tfTCPMonitorFieldsV0 struct { + Host types.String `tfsdk:"host"` + SslVerificationMode types.String `tfsdk:"ssl_verification_mode"` + SslSupportedProtocols []types.String `tfsdk:"ssl_supported_protocols"` + CheckSend types.String `tfsdk:"check_send"` + CheckReceive types.String `tfsdk:"check_receive"` + ProxyURL types.String `tfsdk:"proxy_url"` + ProxyUseLocalResolver types.Bool `tfsdk:"proxy_use_local_resolver"` +} + +type tfModelV0 struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + SpaceID types.String `tfsdk:"space_id"` + Schedule types.Int64 `tfsdk:"schedule"` + Locations []types.String `tfsdk:"locations"` + PrivateLocations []types.String `tfsdk:"private_locations"` + Enabled types.Bool `tfsdk:"enabled"` + Tags []types.String `tfsdk:"tags"` + Alert *tfAlertConfigV0 `tfsdk:"alert"` + APMServiceName types.String `tfsdk:"service_name"` + TimeoutSeconds types.Int64 `tfsdk:"timeout"` + HTTP *tfHTTPMonitorFieldsV0 `tfsdk:"http"` + TCP *tfTCPMonitorFieldsV0 `tfsdk:"tcp"` + Params jsontypes.Normalized `tfsdk:"params"` + RetestOnFailure types.Bool `tfsdk:"retest_on_failure"` +} + +func GetCompositeId(id string) (*clients.CompositeId, diag.Diagnostics) { + compositeID, sdkDiag := clients.CompositeIdFromStr(id) + dg := diag.Diagnostics{} + if sdkDiag.HasError() { + dg.AddError(fmt.Sprintf("Failed to parse monitor ID %s", id), fmt.Sprintf("Resource ID must have following format: /. Current value: %s", id)) + return nil, dg + } + return compositeID, dg +} + +func monitorConfigSchema() schema.Schema { + return schema.Schema{ + MarkdownDescription: "Synthetics monitor config, see https://www.elastic.co/guide/en/kibana/current/add-monitor-api.html for more details. The monitor must have one of the following: http, tcp, icmp or browser.", + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "Generated identifier for the monitor", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "name": schema.StringAttribute{ + Optional: false, + Required: true, + MarkdownDescription: "The monitor’s name.", + }, + "space_id": schema.StringAttribute{ + MarkdownDescription: "The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: *, \\, /, ?, \", <, >, |, whitespace, ,, #, :, or -. Default: `default`", + Optional: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "schedule": schema.Int64Attribute{ + Optional: true, + MarkdownDescription: "The monitor’s schedule in minutes. Supported values are 1, 3, 5, 10, 15, 30, 60, 120 and 240.", + Validators: []validator.Int64{ + int64validator.OneOf(1, 3, 5, 10, 15, 30, 60, 120, 240), + }, + }, + "locations": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + MarkdownDescription: "Where to deploy the monitor. Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.", + Validators: []validator.List{ + listvalidator.ValueStringsAre( + stringvalidator.OneOf( + "japan", + "india", + "singapore", + "australia_east", + "united_kingdom", + "germany", + "canada_east", + "brazil", + "us_east", + "us_west", + ), + ), + }, + }, + "private_locations": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + MarkdownDescription: "These Private Locations refer to locations hosted and managed by you, whereas locations are hosted by Elastic. You can specify a Private Location using the location’s name.", + }, + "enabled": schema.BoolAttribute{ + Optional: true, + MarkdownDescription: "Whether the monitor is enabled. Default: `true`", + }, + "tags": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + MarkdownDescription: "An array of tags.", + }, + "alert": monitorAlertConfigSchema(), + "service_name": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The APM service name.", + }, + "timeout": schema.Int64Attribute{ + Optional: true, + MarkdownDescription: "The monitor timeout in seconds, monitor will fail if it doesn’t complete within this time. Default: `16`", + }, + "params": jsonObjectSchema("Monitor parameters"), + "http": httpMonitorFieldsSchema(), + "tcp": tcpMonitorFieldsSchema(), + "retest_on_failure": schema.BoolAttribute{ + Optional: true, + MarkdownDescription: "Enable or disable retesting when a monitor fails. By default, monitors are automatically retested if the monitor goes from \"up\" to \"down\". If the result of the retest is also \"down\", an error will be created, and if configured, an alert sent. Then the monitor will resume running according to the defined schedule. Using retest_on_failure can reduce noise related to transient problems. Default: `true`.", + }, + }, + } +} + +func jsonObjectSchema(doc string) schema.Attribute { + return schema.StringAttribute{ + Optional: true, + MarkdownDescription: fmt.Sprintf("%s. Raw JSON object, use `jsonencode` function to represent JSON", doc), + CustomType: jsontypes.NormalizedType{}, + } +} + +func statusConfigSchema() schema.Attribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "enabled": schema.BoolAttribute{ + Optional: true, + }, + }, + } +} + +func monitorAlertConfigSchema() schema.Attribute { + return schema.SingleNestedAttribute{ + Optional: true, + MarkdownDescription: "Alert configuration. Default: `{ status: { enabled: true }, tls: { enabled: true } }`.", + Attributes: map[string]schema.Attribute{ + "status": statusConfigSchema(), + "tls": statusConfigSchema(), + }, + } +} + +func httpMonitorFieldsSchema() schema.Attribute { + return schema.SingleNestedAttribute{ + Optional: true, + MarkdownDescription: "HTTP Monitor specific fields", + Attributes: map[string]schema.Attribute{ + "url": schema.StringAttribute{ + Optional: false, + Required: true, + MarkdownDescription: "URL to monitor.", + }, + "ssl_verification_mode": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "Controls the verification of server certificates. ", + }, + "ssl_supported_protocols": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + MarkdownDescription: "List of allowed SSL/TLS versions.", + }, + "max_redirects": schema.Int64Attribute{ + Optional: true, + MarkdownDescription: "The maximum number of redirects to follow. Default: `0`", + }, + "mode": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The mode of the monitor. Can be \"all\" or \"any\". If you’re using a DNS-load balancer and want to ping every IP address for the specified hostname, you should use all.", + Validators: []validator.String{ + stringvalidator.OneOf("any", "all"), + }, + }, + "ipv4": schema.BoolAttribute{ + Optional: true, + MarkdownDescription: "Whether to ping using the ipv4 protocol.", + }, + "ipv6": schema.BoolAttribute{ + Optional: true, + MarkdownDescription: "Whether to ping using the ipv6 protocol.", + }, + "username": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The username for authenticating with the server. The credentials are passed with the request.", + }, + "password": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The password for authenticating with the server. The credentials are passed with the request.", + }, + "proxy_header": jsonObjectSchema("Additional headers to send to proxies during CONNECT requests."), + "proxy_url": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The URL of the proxy to use for this monitor.", + }, + "response": jsonObjectSchema("Controls the indexing of the HTTP response body contents to the `http.response.body.contents` field."), + "check": jsonObjectSchema("The check request settings."), + }, + } +} + +func tcpMonitorFieldsSchema() schema.Attribute { + return schema.SingleNestedAttribute{ + Optional: true, + MarkdownDescription: "TCP Monitor specific fields", + Attributes: map[string]schema.Attribute{ + "host": schema.StringAttribute{ + Optional: false, + Required: true, + MarkdownDescription: "The host to monitor; it can be an IP address or a hostname. The host can include the port using a colon (e.g., \"example.com:9200\").", + }, + "ssl_verification_mode": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "Controls the verification of server certificates. ", + }, + "ssl_supported_protocols": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + MarkdownDescription: "List of allowed SSL/TLS versions.", + }, + "check_send": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "An optional payload string to send to the remote host.", + }, + "check_receive": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The expected answer. ", + }, + "proxy_url": schema.StringAttribute{ + Optional: true, + MarkdownDescription: "The URL of the SOCKS5 proxy to use when connecting to the server. The value must be a URL with a scheme of `socks5://`. If the SOCKS5 proxy server requires client authentication, then a username and password can be embedded in the URL. When using a proxy, hostnames are resolved on the proxy server instead of on the client. You can change this behavior by setting the `proxy_use_local_resolver` option.", + }, + "proxy_use_local_resolver": schema.BoolAttribute{ + Optional: true, + MarkdownDescription: " A Boolean value that determines whether hostnames are resolved locally instead of being resolved on the proxy server. The default value is false, which means that name resolution occurs on the proxy server.", + }, + }, + } +} + func GeoConfigSchema() schema.Attribute { return schema.SingleNestedAttribute{ Optional: true, @@ -50,3 +342,342 @@ func FromSyntheticGeoConfig(v *kbapi.SyntheticGeoConfig) *TFGeoConfigV0 { Lon: types.Float64Value(v.Lon), } } + +func ValueStringSlice(v []types.String) []string { + var res []string + for _, s := range v { + res = append(res, s.ValueString()) + } + return res +} + +func StringSliceValue(v []string) []types.String { + var res []types.String + for _, s := range v { + res = append(res, types.StringValue(s)) + } + return res +} + +func toNormalizedValue(jsObj kbapi.JsonObject) (jsontypes.Normalized, error) { + res, err := json.Marshal(jsObj) + if err != nil { + return jsontypes.NewNormalizedUnknown(), err + } + return jsontypes.NewNormalizedValue(string(res)), nil +} + +func toJsonObject(v jsontypes.Normalized) (kbapi.JsonObject, diag.Diagnostics) { + if v.IsNull() { + return nil, diag.Diagnostics{} + } + var res kbapi.JsonObject + dg := v.Unmarshal(&res) + if dg.HasError() { + return nil, dg + } + return res, diag.Diagnostics{} +} + +func stringToInt64(v string) (int64, error) { + var res int64 + var err error + if v != "" { + res, err = strconv.ParseInt(v, 10, 64) + } + return res, err +} + +func (v *tfModelV0) toModelV0(api *kbapi.SyntheticsMonitor) (*tfModelV0, error) { + var schedule int64 + var err error + if api.Schedule != nil { + schedule, err = stringToInt64(api.Schedule.Number) + if err != nil { + return nil, err + } + } + var locLabels []string + var privateLocLabels []string + for _, l := range api.Locations { + if l.IsServiceManaged { + locLabels = append(locLabels, l.Label) + } else { + privateLocLabels = append(privateLocLabels, l.Label) + } + } + + timeout, err := stringToInt64(string(api.Timeout)) + if err != nil { + return nil, err + } + + var http *tfHTTPMonitorFieldsV0 + var tcp *tfTCPMonitorFieldsV0 + + switch mType := api.Type; mType { + case kbapi.Http: + http = &tfHTTPMonitorFieldsV0{} + if v.HTTP != nil { + http = v.HTTP + } + http, err = http.toTfHTTPMonitorFieldsV0(api) + case kbapi.Tcp: + tcp = &tfTCPMonitorFieldsV0{} + if v.TCP != nil { + tcp = v.TCP + } + tcp, err = tcp.toTfTCPMonitorFieldsV0(api) + default: + err = fmt.Errorf("unsupported monitor type: %s", mType) + } + + if err != nil { + return nil, err + } + + params := v.Params + if api.Params != nil { + params, err = toNormalizedValue(api.Params) + if err != nil { + return nil, err + } + } + + resourceID := clients.CompositeId{ + ClusterId: api.Namespace, + ResourceId: string(api.Id), + } + + return &tfModelV0{ + ID: types.StringValue(resourceID.String()), + Name: types.StringValue(api.Name), + SpaceID: types.StringValue(api.Namespace), + Schedule: types.Int64Value(schedule), + Locations: StringSliceValue(locLabels), + PrivateLocations: StringSliceValue(privateLocLabels), + Enabled: types.BoolPointerValue(api.Enabled), + Tags: StringSliceValue(api.Tags), + Alert: toTfAlertConfigV0(api.Alert), + APMServiceName: types.StringValue(api.APMServiceName), + TimeoutSeconds: types.Int64Value(timeout), + Params: params, + HTTP: http, + TCP: tcp, + RetestOnFailure: v.RetestOnFailure, + }, nil +} + +func (v *tfTCPMonitorFieldsV0) toTfTCPMonitorFieldsV0(api *kbapi.SyntheticsMonitor) (*tfTCPMonitorFieldsV0, error) { + checkSend := v.CheckSend + if api.CheckSend != "" { + checkSend = types.StringValue(api.CheckSend) + } + checkReceive := v.CheckReceive + if api.CheckReceive != "" { + checkReceive = types.StringValue(api.CheckReceive) + } + return &tfTCPMonitorFieldsV0{ + Host: types.StringValue(api.Host), + SslVerificationMode: types.StringValue(api.SslVerificationMode), + SslSupportedProtocols: StringSliceValue(api.SslSupportedProtocols), + CheckSend: checkSend, + CheckReceive: checkReceive, + ProxyURL: types.StringValue(api.ProxyUrl), + ProxyUseLocalResolver: types.BoolPointerValue(api.ProxyUseLocalResolver), + }, nil +} + +func (v *tfHTTPMonitorFieldsV0) toTfHTTPMonitorFieldsV0(api *kbapi.SyntheticsMonitor) (*tfHTTPMonitorFieldsV0, error) { + + var err error + proxyHeaders := v.ProxyHeader + if api.ProxyHeaders != nil { + proxyHeaders, err = toNormalizedValue(api.ProxyHeaders) + if err != nil { + return nil, err + } + } + + username := v.Username + if api.Username != "" { + username = types.StringValue(api.Username) + } + password := v.Password + if api.Password != "" { + password = types.StringValue(api.Password) + } + + maxRedirects, err := stringToInt64(api.MaxRedirects) + if err != nil { + return nil, err + } + + return &tfHTTPMonitorFieldsV0{ + URL: types.StringValue(api.Url), + SslVerificationMode: types.StringValue(api.SslVerificationMode), + SslSupportedProtocols: StringSliceValue(api.SslSupportedProtocols), + MaxRedirects: types.Int64Value(maxRedirects), + Mode: types.StringValue(string(api.Mode)), + IPv4: types.BoolPointerValue(api.Ipv4), + IPv6: types.BoolPointerValue(api.Ipv6), + Username: username, + Password: password, + ProxyHeader: proxyHeaders, + ProxyURL: types.StringValue(api.ProxyUrl), + Check: v.Check, + Response: v.Response, + }, nil +} + +func toTfAlertConfigV0(alert *kbapi.MonitorAlertConfig) *tfAlertConfigV0 { + if alert == nil { + return nil + } + return &tfAlertConfigV0{ + Status: toTfStatusConfigV0(alert.Status), + TLS: toTfStatusConfigV0(alert.Tls), + } +} + +func toTfStatusConfigV0(status *kbapi.SyntheticsStatusConfig) *tfStatusConfigV0 { + if status == nil { + return nil + } + return &tfStatusConfigV0{ + Enabled: types.BoolPointerValue(status.Enabled), + } +} + +func (v *tfModelV0) toKibanaAPIRequest() (*kibanaAPIRequest, diag.Diagnostics) { + + fields, dg := v.toMonitorFields() + if dg.HasError() { + return nil, dg + } + config, dg := v.toSyntheticsMonitorConfig() + if dg.HasError() { + return nil, dg + } + return &kibanaAPIRequest{ + fields: fields, + config: *config, + }, dg +} + +func (v *tfModelV0) toMonitorFields() (kbapi.MonitorFields, diag.Diagnostics) { + var dg diag.Diagnostics + + if v.HTTP != nil { + return v.toHttpMonitorFields() + } else if v.TCP != nil { + return v.toTCPMonitorFields(), dg + } + + dg.AddError("Unsupported monitor type config", "one of http,tcp monitor fields is required") + return nil, dg +} + +func (v *tfModelV0) toSyntheticsMonitorConfig() (*kbapi.SyntheticsMonitorConfig, diag.Diagnostics) { + locations := Map[types.String, kbapi.MonitorLocation](v.Locations, func(s types.String) kbapi.MonitorLocation { return kbapi.MonitorLocation(s.ValueString()) }) + params, dg := toJsonObject(v.Params) + if dg.HasError() { + return nil, dg + } + + var alert *kbapi.MonitorAlertConfig + if v.Alert != nil { + alert = v.Alert.toTfAlertConfigV0() + } + + return &kbapi.SyntheticsMonitorConfig{ + Name: v.Name.ValueString(), + Schedule: kbapi.MonitorSchedule(v.Schedule.ValueInt64()), + Locations: locations, + PrivateLocations: ValueStringSlice(v.PrivateLocations), + Enabled: v.Enabled.ValueBoolPointer(), + Tags: ValueStringSlice(v.Tags), + Alert: alert, + APMServiceName: v.APMServiceName.ValueString(), + TimeoutSeconds: int(v.TimeoutSeconds.ValueInt64()), + Namespace: v.SpaceID.ValueString(), + Params: params, + RetestOnFailure: v.RetestOnFailure.ValueBoolPointer(), + }, diag.Diagnostics{} //dg +} + +func (v *tfModelV0) toHttpMonitorFields() (kbapi.MonitorFields, diag.Diagnostics) { + proxyHeaders, dg := toJsonObject(v.HTTP.ProxyHeader) + if dg.HasError() { + return nil, dg + } + response, dg := toJsonObject(v.HTTP.Response) + if dg.HasError() { + return nil, dg + } + check, dg := toJsonObject(v.HTTP.Check) + if dg.HasError() { + return nil, dg + } + maxRedirects := "" + if !v.HTTP.MaxRedirects.IsUnknown() && !v.HTTP.MaxRedirects.IsNull() { // handle omitempty case + maxRedirects = strconv.FormatInt(v.HTTP.MaxRedirects.ValueInt64(), 10) + + } + return kbapi.HTTPMonitorFields{ + Url: v.HTTP.URL.ValueString(), + SslVerificationMode: v.HTTP.SslVerificationMode.ValueString(), + SslSupportedProtocols: ValueStringSlice(v.HTTP.SslSupportedProtocols), + MaxRedirects: maxRedirects, + Mode: kbapi.HttpMonitorMode(v.HTTP.Mode.ValueString()), + Ipv4: v.HTTP.IPv4.ValueBoolPointer(), + Ipv6: v.HTTP.IPv6.ValueBoolPointer(), + Username: v.HTTP.Username.ValueString(), + Password: v.HTTP.Password.ValueString(), + ProxyHeader: proxyHeaders, + ProxyUrl: v.HTTP.ProxyURL.ValueString(), + Response: response, + Check: check, + }, diag.Diagnostics{} //dg +} + +func (v *tfModelV0) toTCPMonitorFields() kbapi.MonitorFields { + return kbapi.TCPMonitorFields{ + Host: v.TCP.Host.ValueString(), + SslVerificationMode: v.TCP.SslVerificationMode.ValueString(), + SslSupportedProtocols: ValueStringSlice(v.TCP.SslSupportedProtocols), + CheckSend: v.TCP.CheckSend.ValueString(), + CheckReceive: v.TCP.CheckReceive.ValueString(), + ProxyUrl: v.TCP.ProxyURL.ValueString(), + ProxyUseLocalResolver: v.TCP.ProxyUseLocalResolver.ValueBoolPointer(), + } +} + +func Map[T, U any](ts []T, f func(T) U) []U { + var us []U + for _, v := range ts { + us = append(us, f(v)) + } + return us +} + +func (v tfAlertConfigV0) toTfAlertConfigV0() *kbapi.MonitorAlertConfig { + var status *kbapi.SyntheticsStatusConfig + if v.Status != nil { + status = v.Status.toTfStatusConfigV0() + } + var tls *kbapi.SyntheticsStatusConfig + if v.TLS != nil { + tls = v.TLS.toTfStatusConfigV0() + } + return &kbapi.MonitorAlertConfig{ + Status: status, + Tls: tls, + } +} + +func (v tfStatusConfigV0) toTfStatusConfigV0() *kbapi.SyntheticsStatusConfig { + return &kbapi.SyntheticsStatusConfig{ + Enabled: v.Enabled.ValueBoolPointer(), + } +} diff --git a/internal/kibana/synthetics/schema_test.go b/internal/kibana/synthetics/schema_test.go new file mode 100644 index 000000000..a6a160e19 --- /dev/null +++ b/internal/kibana/synthetics/schema_test.go @@ -0,0 +1,446 @@ +package synthetics + +import ( + "encoding/json" + "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" + "testing" + + "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/stretchr/testify/assert" +) + +var ( + fBool = boolPointer(false) + tBool = boolPointer(true) +) + +func boolPointer(v bool) *bool { + var res = new(bool) + *res = v + return res +} + +func TestToModelV0(t *testing.T) { + testcases := []struct { + name string + input kbapi.SyntheticsMonitor + expected tfModelV0 + }{ + { + name: "HTTP monitor empty data", + input: kbapi.SyntheticsMonitor{ + Type: kbapi.Http, + }, + expected: tfModelV0{ + ID: types.StringValue("/"), + Name: types.StringValue(""), + SpaceID: types.StringValue(""), + Schedule: types.Int64Value(0), + APMServiceName: types.StringValue(""), + TimeoutSeconds: types.Int64Value(0), + Params: jsontypes.NewNormalizedValue("null"), + HTTP: &tfHTTPMonitorFieldsV0{ + URL: types.StringValue(""), + SslVerificationMode: types.StringValue(""), + MaxRedirects: types.Int64Value(0), + Mode: types.StringValue(""), + Username: types.StringValue(""), + Password: types.StringValue(""), + ProxyHeader: jsontypes.NewNormalizedValue("null"), + ProxyURL: types.StringValue(""), + Response: jsontypes.NewNormalizedValue("null"), + Check: jsontypes.NewNormalizedValue("null"), + }, + }, + }, + { + name: "TCP monitor empty data", + input: kbapi.SyntheticsMonitor{ + Type: kbapi.Tcp, + }, + expected: tfModelV0{ + ID: types.StringValue("/"), + Name: types.StringValue(""), + SpaceID: types.StringValue(""), + Schedule: types.Int64Value(0), + APMServiceName: types.StringValue(""), + TimeoutSeconds: types.Int64Value(0), + Params: jsontypes.NewNormalizedValue("null"), + TCP: &tfTCPMonitorFieldsV0{ + Host: types.StringValue(""), + SslVerificationMode: types.StringValue(""), + CheckSend: types.StringValue(""), + CheckReceive: types.StringValue(""), + ProxyURL: types.StringValue(""), + }, + }, + }, + { + name: "HTTP monitor", + input: kbapi.SyntheticsMonitor{ + Id: "test-id-http", + Name: "test-name-http", + Namespace: "default", + Enabled: tBool, + Alert: &kbapi.MonitorAlertConfig{Status: &kbapi.SyntheticsStatusConfig{Enabled: tBool}, Tls: &kbapi.SyntheticsStatusConfig{Enabled: fBool}}, + Schedule: &kbapi.MonitorScheduleConfig{Number: "5", Unit: "m"}, + Tags: []string{"tag1", "tag2"}, + APMServiceName: "test-service-http", + Timeout: json.Number("30"), + Locations: []kbapi.MonitorLocationConfig{ + {Label: "us_east", IsServiceManaged: true}, + {Label: "test private location", IsServiceManaged: false}, + }, + Origin: "origin", + Params: kbapi.JsonObject{"param1": "value1"}, + MaxAttempts: 3, + Revision: 1, + Ui: kbapi.JsonObject{"is_tls_enabled": false}, + Type: kbapi.Http, + Url: "https://example.com", + Mode: kbapi.HttpMonitorMode("all"), + MaxRedirects: "5", + Ipv4: tBool, + Ipv6: fBool, + Username: "user", + Password: "pass", + ProxyHeaders: kbapi.JsonObject{"header1": "value1"}, + ProxyUrl: "https://proxy.com", + CheckResponseBodyPositive: []string{"foo", "bar"}, + CheckResponseStatus: []string{"200", "201"}, + ResponseIncludeBody: "always", + ResponseIncludeHeaders: true, + ResponseIncludeBodyMaxBytes: "1024", + CheckRequestBody: kbapi.JsonObject{"type": "text", "value": "name=first&email=someemail%40someemailprovider.com"}, + CheckRequestHeaders: kbapi.JsonObject{"Content-Type": "application/x-www-form-urlencoded"}, + CheckRequestMethod: "POST", + SslVerificationMode: "full", + SslSupportedProtocols: []string{"TLSv1.2", "TLSv1.3"}, + }, + expected: tfModelV0{ + ID: types.StringValue("default/test-id-http"), + Name: types.StringValue("test-name-http"), + SpaceID: types.StringValue("default"), + Schedule: types.Int64Value(5), + Locations: []types.String{types.StringValue("us_east")}, + PrivateLocations: []types.String{types.StringValue("test private location")}, + Enabled: types.BoolPointerValue(tBool), + Tags: []types.String{types.StringValue("tag1"), types.StringValue("tag2")}, + Alert: &tfAlertConfigV0{Status: &tfStatusConfigV0{Enabled: types.BoolPointerValue(tBool)}, TLS: &tfStatusConfigV0{Enabled: types.BoolPointerValue(fBool)}}, + APMServiceName: types.StringValue("test-service-http"), + TimeoutSeconds: types.Int64Value(30), + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + HTTP: &tfHTTPMonitorFieldsV0{ + URL: types.StringValue("https://example.com"), + SslVerificationMode: types.StringValue("full"), + SslSupportedProtocols: []types.String{types.StringValue("TLSv1.2"), types.StringValue("TLSv1.3")}, + MaxRedirects: types.Int64Value(5), + Mode: types.StringValue("all"), + IPv4: types.BoolPointerValue(tBool), + IPv6: types.BoolPointerValue(fBool), + Username: types.StringValue("user"), + Password: types.StringValue("pass"), + ProxyHeader: jsontypes.NewNormalizedValue(`{"header1":"value1"}`), + ProxyURL: types.StringValue("https://proxy.com"), + }, + }, + }, + { + name: "TCP monitor", + input: kbapi.SyntheticsMonitor{ + Id: "test-id-tcp", + Name: "test-name-tcp", + Namespace: "default", + Enabled: tBool, + Alert: &kbapi.MonitorAlertConfig{Status: &kbapi.SyntheticsStatusConfig{Enabled: tBool}}, + Schedule: &kbapi.MonitorScheduleConfig{Number: "5", Unit: "m"}, + Tags: nil, + APMServiceName: "test-service-tcp", + Timeout: json.Number("30"), + Locations: []kbapi.MonitorLocationConfig{ + {Label: "test private location", IsServiceManaged: false}, + }, + Origin: "origin", + Params: kbapi.JsonObject{"param1": "value1"}, + MaxAttempts: 3, + Revision: 1, + Ui: kbapi.JsonObject{"is_tls_enabled": false}, + Type: kbapi.Tcp, + SslVerificationMode: "full", + SslSupportedProtocols: []string{"TLSv1.2", "TLSv1.3"}, + ProxyUrl: "http://proxy.com", + Host: "example.com:9200", + CheckSend: "hello", + CheckReceive: "world", + ProxyUseLocalResolver: tBool, + }, + expected: tfModelV0{ + ID: types.StringValue("default/test-id-tcp"), + Name: types.StringValue("test-name-tcp"), + SpaceID: types.StringValue("default"), + Schedule: types.Int64Value(5), + Locations: nil, + PrivateLocations: []types.String{types.StringValue("test private location")}, + Enabled: types.BoolPointerValue(tBool), + Tags: nil, + Alert: &tfAlertConfigV0{Status: &tfStatusConfigV0{Enabled: types.BoolPointerValue(tBool)}}, + APMServiceName: types.StringValue("test-service-tcp"), + TimeoutSeconds: types.Int64Value(30), + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + TCP: &tfTCPMonitorFieldsV0{ + Host: types.StringValue("example.com:9200"), + SslVerificationMode: types.StringValue("full"), + SslSupportedProtocols: []types.String{types.StringValue("TLSv1.2"), types.StringValue("TLSv1.3")}, + CheckSend: types.StringValue("hello"), + CheckReceive: types.StringValue("world"), + ProxyURL: types.StringValue("http://proxy.com"), + ProxyUseLocalResolver: types.BoolPointerValue(tBool), + }, + }, + }, + } + + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + model, err := tt.expected.toModelV0(&tt.input) + assert.NoError(t, err) + assert.Equal(t, &tt.expected, model) + }) + } +} + +func TestToKibanaAPIRequest(t *testing.T) { + testcases := []struct { + name string + input tfModelV0 + expected kibanaAPIRequest + }{ + { + name: "Empty HTTP monitor", + input: tfModelV0{ + HTTP: &tfHTTPMonitorFieldsV0{}, + }, + expected: kibanaAPIRequest{ + fields: kbapi.HTTPMonitorFields{}, + config: kbapi.SyntheticsMonitorConfig{}, + }, + }, + { + name: "Empty TCP monitor", + input: tfModelV0{ + TCP: &tfTCPMonitorFieldsV0{}, + }, + expected: kibanaAPIRequest{ + fields: kbapi.TCPMonitorFields{}, + config: kbapi.SyntheticsMonitorConfig{}, + }, + }, + { + name: "HTTP monitor", + input: tfModelV0{ + ID: types.StringValue("test-id-http"), + Name: types.StringValue("test-name-http"), + SpaceID: types.StringValue("default"), + Schedule: types.Int64Value(5), + Locations: []types.String{types.StringValue("us_east")}, + PrivateLocations: []types.String{types.StringValue("test private location")}, + Enabled: types.BoolPointerValue(tBool), + Tags: []types.String{types.StringValue("tag1"), types.StringValue("tag2")}, + Alert: &tfAlertConfigV0{Status: &tfStatusConfigV0{Enabled: types.BoolPointerValue(tBool)}, TLS: &tfStatusConfigV0{Enabled: types.BoolPointerValue(fBool)}}, + APMServiceName: types.StringValue("test-service-http"), + TimeoutSeconds: types.Int64Value(30), + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + HTTP: &tfHTTPMonitorFieldsV0{ + URL: types.StringValue("https://example.com"), + SslVerificationMode: types.StringValue("full"), + SslSupportedProtocols: []types.String{types.StringValue("TLSv1.2"), types.StringValue("TLSv1.3")}, + MaxRedirects: types.Int64Value(5), + Mode: types.StringValue("all"), + IPv4: types.BoolPointerValue(tBool), + IPv6: types.BoolPointerValue(fBool), + Username: types.StringValue("user"), + Password: types.StringValue("pass"), + ProxyHeader: jsontypes.NewNormalizedValue(`{"header1":"value1"}`), + ProxyURL: types.StringValue("https://proxy.com"), + Response: jsontypes.NewNormalizedValue(`{"response1":"value1"}`), + Check: jsontypes.NewNormalizedValue(`{"check1":"value1"}`), + }, + }, + expected: kibanaAPIRequest{ + config: kbapi.SyntheticsMonitorConfig{ + Name: "test-name-http", + Schedule: kbapi.MonitorSchedule(5), + Locations: []kbapi.MonitorLocation{"us_east"}, + PrivateLocations: []string{"test private location"}, + Enabled: tBool, + Tags: []string{"tag1", "tag2"}, + Alert: &kbapi.MonitorAlertConfig{Status: &kbapi.SyntheticsStatusConfig{Enabled: tBool}, Tls: &kbapi.SyntheticsStatusConfig{Enabled: fBool}}, + APMServiceName: "test-service-http", + Namespace: "default", + TimeoutSeconds: 30, + Params: kbapi.JsonObject{"param1": "value1"}, + }, + fields: kbapi.HTTPMonitorFields{ + Url: "https://example.com", + SslVerificationMode: "full", + SslSupportedProtocols: []string{"TLSv1.2", "TLSv1.3"}, + MaxRedirects: "5", + Mode: "all", + Ipv4: tBool, + Ipv6: fBool, + Username: "user", + Password: "pass", + ProxyHeader: kbapi.JsonObject{"header1": "value1"}, + ProxyUrl: "https://proxy.com", + Response: kbapi.JsonObject{"response1": "value1"}, + Check: kbapi.JsonObject{"check1": "value1"}, + }, + }, + }, + { + name: "TCP monitor", + input: tfModelV0{ + ID: types.StringValue("test-id-tcp"), + Name: types.StringValue("test-name-tcp"), + SpaceID: types.StringValue("default"), + Schedule: types.Int64Value(5), + Locations: []types.String{types.StringValue("us_east")}, + PrivateLocations: nil, + Enabled: types.BoolPointerValue(tBool), + Tags: []types.String{types.StringValue("tag1"), types.StringValue("tag2")}, + Alert: &tfAlertConfigV0{Status: &tfStatusConfigV0{Enabled: types.BoolPointerValue(tBool)}}, + APMServiceName: types.StringValue("test-service-tcp"), + TimeoutSeconds: types.Int64Value(30), + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + TCP: &tfTCPMonitorFieldsV0{ + Host: types.StringValue("example.com:9200"), + SslVerificationMode: types.StringValue("full"), + SslSupportedProtocols: []types.String{types.StringValue("TLSv1.2"), types.StringValue("TLSv1.3")}, + CheckSend: types.StringValue("hello"), + CheckReceive: types.StringValue("world"), + ProxyURL: types.StringValue("http://proxy.com"), + ProxyUseLocalResolver: types.BoolPointerValue(tBool), + }, + }, + expected: kibanaAPIRequest{ + config: kbapi.SyntheticsMonitorConfig{ + Name: "test-name-tcp", + Schedule: kbapi.MonitorSchedule(5), + Locations: []kbapi.MonitorLocation{"us_east"}, + PrivateLocations: nil, + Enabled: tBool, + Tags: []string{"tag1", "tag2"}, + Alert: &kbapi.MonitorAlertConfig{Status: &kbapi.SyntheticsStatusConfig{Enabled: tBool}}, + APMServiceName: "test-service-tcp", + Namespace: "default", + TimeoutSeconds: 30, + Params: kbapi.JsonObject{"param1": "value1"}, + }, + fields: kbapi.TCPMonitorFields{ + Host: "example.com:9200", + SslVerificationMode: "full", + SslSupportedProtocols: []string{"TLSv1.2", "TLSv1.3"}, + CheckSend: "hello", + CheckReceive: "world", + ProxyUrl: "http://proxy.com", + ProxyUseLocalResolver: tBool, + }, + }, + }, + } + + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + apiRequest, dg := tt.input.toKibanaAPIRequest() + assert.False(t, dg.HasError(), dg.Errors()) + assert.Equal(t, &tt.expected, apiRequest) + }) + } +} + +func TestToModelV0MergeAttributes(t *testing.T) { + + testcases := []struct { + name string + input kbapi.SyntheticsMonitor + state tfModelV0 + expected tfModelV0 + }{ + { + name: "HTTP monitor", + state: tfModelV0{ + HTTP: &tfHTTPMonitorFieldsV0{ + ProxyHeader: jsontypes.NewNormalizedValue(`{"header1":"value1"}`), + Username: types.StringValue("test"), + Password: types.StringValue("password"), + Check: jsontypes.NewNormalizedValue(`{"check1":"value1"}`), + Response: jsontypes.NewNormalizedValue(`{"response1":"value1"}`), + }, + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + RetestOnFailure: types.BoolValue(true), + }, + input: kbapi.SyntheticsMonitor{ + Type: kbapi.Http, + }, + expected: tfModelV0{ + ID: types.StringValue("/"), + Name: types.StringValue(""), + SpaceID: types.StringValue(""), + Schedule: types.Int64Value(0), + APMServiceName: types.StringValue(""), + TimeoutSeconds: types.Int64Value(0), + Params: jsontypes.NewNormalizedValue(`{"param1":"value1"}`), + RetestOnFailure: types.BoolValue(true), + HTTP: &tfHTTPMonitorFieldsV0{ + URL: types.StringValue(""), + SslVerificationMode: types.StringValue(""), + MaxRedirects: types.Int64Value(0), + Mode: types.StringValue(""), + ProxyURL: types.StringValue(""), + ProxyHeader: jsontypes.NewNormalizedValue(`{"header1":"value1"}`), + Username: types.StringValue("test"), + Password: types.StringValue("password"), + Check: jsontypes.NewNormalizedValue(`{"check1":"value1"}`), + Response: jsontypes.NewNormalizedValue(`{"response1":"value1"}`), + }, + }, + }, + { + name: "TCP monitor", + state: tfModelV0{ + TCP: &tfTCPMonitorFieldsV0{ + CheckSend: types.StringValue("hello"), + CheckReceive: types.StringValue("world"), + }, + }, + input: kbapi.SyntheticsMonitor{ + Type: kbapi.Tcp, + }, + expected: tfModelV0{ + ID: types.StringValue("/"), + Name: types.StringValue(""), + SpaceID: types.StringValue(""), + Schedule: types.Int64Value(0), + APMServiceName: types.StringValue(""), + TimeoutSeconds: types.Int64Value(0), + TCP: &tfTCPMonitorFieldsV0{ + Host: types.StringValue(""), + SslVerificationMode: types.StringValue(""), + CheckSend: types.StringValue("hello"), + CheckReceive: types.StringValue("world"), + ProxyURL: types.StringValue(""), + }, + }, + }, + } + + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + actual, err := tt.state.toModelV0(&tt.input) + assert.NoError(t, err) + assert.NotNil(t, actual) + assert.Equal(t, &tt.expected, actual) + }) + } +} diff --git a/internal/kibana/synthetics/update.go b/internal/kibana/synthetics/update.go new file mode 100644 index 000000000..bcd66b914 --- /dev/null +++ b/internal/kibana/synthetics/update.go @@ -0,0 +1,54 @@ +package synthetics + +import ( + "context" + "fmt" + "github.com/disaster37/go-kibana-rest/v8/kbapi" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func (r *Resource) Update(ctx context.Context, request resource.UpdateRequest, response *resource.UpdateResponse) { + + kibanaClient := GetKibanaClient(r, response.Diagnostics) + if kibanaClient == nil { + return + } + + plan := new(tfModelV0) + diags := request.Plan.Get(ctx, plan) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + input, diags := plan.toKibanaAPIRequest() + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } + + monitorId, dg := GetCompositeId(plan.ID.ValueString()) + response.Diagnostics.Append(dg...) + if response.Diagnostics.HasError() { + return + } + + namespace := plan.SpaceID.ValueString() + result, err := kibanaClient.KibanaSynthetics.Monitor.Update(ctx, kbapi.MonitorID(monitorId.ResourceId), input.config, input.fields, namespace) + if err != nil { + response.Diagnostics.AddError(fmt.Sprintf("Failed to update Kibana monitor `%s`, namespace %s", input.config.Name, namespace), err.Error()) + return + } + + plan, err = plan.toModelV0(result) + if err != nil { + response.Diagnostics.AddError("Failed to convert Kibana monitor API to TF state", err.Error()) + return + } + + diags = response.State.Set(ctx, plan) + response.Diagnostics.Append(diags...) + if response.Diagnostics.HasError() { + return + } +} diff --git a/libs/go-kibana-rest/docker-compose.yml b/libs/go-kibana-rest/docker-compose.yml index 0f12cb3e1..e0c6ac37b 100644 --- a/libs/go-kibana-rest/docker-compose.yml +++ b/libs/go-kibana-rest/docker-compose.yml @@ -4,10 +4,10 @@ services: environment: cluster.name: test discovery.type: single-node - ELASTIC_PASSWORD: changeme - xpack.security.enabled: "true" + xpack.security.enabled: true xpack.security.http.ssl.enabled: false xpack.license.self_generated.type: trial + ELASTIC_PASSWORD: changeme ports: - "9200:9200/tcp" set-kibana-password: @@ -24,11 +24,10 @@ services: kibana: image: docker.elastic.co/kibana/kibana:8.15.0 environment: + SERVER_NAME: kibana ELASTICSEARCH_HOSTS: http://es:9200 ELASTICSEARCH_USERNAME: kibana_system ELASTICSEARCH_PASSWORD: changeme - xpack.security.http.ssl.enabled: false - xpack.license.self_generated.type: trial XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: min-32-byte-long-strong-encryption-key links: - elasticsearch:es @@ -36,4 +35,4 @@ services: - "5601:5601/tcp" depends_on: set-kibana-password: - condition: service_completed_successfully \ No newline at end of file + condition: service_completed_successfully diff --git a/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go b/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go index f141d8bed..44193dede 100644 --- a/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go +++ b/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go @@ -1,11 +1,13 @@ package kbapi import ( + "context" "encoding/json" "fmt" + "time" + "github.com/go-resty/resty/v2" log "github.com/sirupsen/logrus" - "time" ) const ( @@ -45,6 +47,10 @@ const ( ModeAny = "any" ) +type MonitorFields interface { + APIRequest(cfg SyntheticsMonitorConfig) interface{} +} + type KibanaError struct { Code int `json:"statusCode,omitempty"` Error string `json:"error,omitempty"` @@ -81,19 +87,30 @@ type MonitorAlertConfig struct { Tls *SyntheticsStatusConfig `json:"tls,omitempty"` } +type TCPMonitorFields struct { + Host string `json:"host"` + SslVerificationMode string `json:"ssl.verification_mode,omitempty"` + SslSupportedProtocols []string `json:"ssl.supported_protocols,omitempty"` + CheckSend string `json:"check.send,omitempty"` + CheckReceive string `json:"check.receive,omitempty"` + ProxyUrl string `json:"proxy_url,omitempty"` + ProxyUseLocalResolver *bool `json:"proxy_use_local_resolver,omitempty"` +} + type HTTPMonitorFields struct { - Url string `json:"url"` - SslSetting JsonObject `json:"ssl,omitempty"` //https://www.elastic.co/guide/en/beats/heartbeat/current/configuration-ssl.html - MaxRedirects string `json:"max_redirects,omitempty"` - Mode HttpMonitorMode `json:"mode,omitempty"` - Ipv4 *bool `json:"ipv4,omitempty"` - Ipv6 *bool `json:"ipv6,omitempty"` - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - ProxyHeader JsonObject `json:"proxy_headers,omitempty"` - ProxyUrl string `json:"proxy_url,omitempty"` - Response JsonObject `json:"response,omitempty"` - Check JsonObject `json:"check,omitempty"` + Url string `json:"url"` + SslVerificationMode string `json:"ssl.verification_mode,omitempty"` + SslSupportedProtocols []string `json:"ssl.supported_protocols,omitempty"` + MaxRedirects string `json:"max_redirects,omitempty"` + Mode HttpMonitorMode `json:"mode,omitempty"` + Ipv4 *bool `json:"ipv4,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + ProxyHeader JsonObject `json:"proxy_headers,omitempty"` + ProxyUrl string `json:"proxy_url,omitempty"` + Response JsonObject `json:"response,omitempty"` + Check JsonObject `json:"check,omitempty"` } type SyntheticsMonitorConfig struct { @@ -147,56 +164,103 @@ type MonitorDeleteStatus struct { } type SyntheticsMonitor struct { - Name string `json:"name"` - Type MonitorType `json:"type"` - ConfigId MonitorID `json:"config_id"` - Id MonitorID `json:"id"` - Mode HttpMonitorMode `json:"mode"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` - Namespace string `json:"namespace"` - Enabled *bool `json:"enabled,omitempty"` - Alert *MonitorAlertConfig `json:"alert,omitempty"` - Schedule *MonitorScheduleConfig `json:"schedule,omitempty"` - Tags []string `json:"tags,omitempty"` - APMServiceName string `json:"service.name,omitempty"` - Timeout json.Number `json:"timeout,omitempty"` - Locations []MonitorLocationConfig `json:"locations,omitempty"` - Origin string `json:"origin,omitempty"` - Params JsonObject `json:"params,omitempty"` - MaxAttempts int `json:"max_attempts"` - MaxRedirects string `json:"max_redirects"` - ResponseIncludeBody string `json:"response.include_body"` - ResponseIncludeHeaders bool `json:"response.include_headers"` - CheckRequestMethod string `json:"check.request.method"` - ResponseIncludeBodyMaxBytes string `json:"response.include_body_max_bytes,omitempty"` - Ipv4 bool `json:"ipv4,omitempty"` - Ipv6 bool `json:"ipv6,omitempty"` - SslVerificationMode string `json:"ssl.verification_mode,omitempty"` - SslSupportedProtocols []string `json:"ssl.supported_protocols,omitempty"` - Revision int `json:"revision,omitempty"` - Url string `json:"url,omitempty"` - Ui struct { - IsTlsEnabled bool `json:"is_tls_enabled"` - } `json:"__ui,omitempty"` + Name string `json:"name"` + Type MonitorType `json:"type"` + ConfigId MonitorID `json:"config_id"` + Id MonitorID `json:"id"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Namespace string `json:"namespace"` + Enabled *bool `json:"enabled,omitempty"` + Alert *MonitorAlertConfig `json:"alert,omitempty"` + Schedule *MonitorScheduleConfig `json:"schedule,omitempty"` + Tags []string `json:"tags,omitempty"` + APMServiceName string `json:"service.name,omitempty"` + Timeout json.Number `json:"timeout,omitempty"` + Locations []MonitorLocationConfig `json:"locations,omitempty"` + Origin string `json:"origin,omitempty"` + Params JsonObject `json:"params,omitempty"` + MaxAttempts int `json:"max_attempts"` + Revision int `json:"revision,omitempty"` + Ui JsonObject `json:"__ui,omitempty"` + //http + Url string `json:"url,omitempty"` + Mode HttpMonitorMode `json:"mode"` + MaxRedirects string `json:"max_redirects"` + Ipv4 *bool `json:"ipv4,omitempty"` + Ipv6 *bool `json:"ipv6,omitempty"` + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + ProxyHeaders JsonObject `json:"proxy_headers,omitempty"` + CheckResponseBodyPositive []string `json:"check.response.body.positive,omitempty"` + CheckResponseStatus []string `json:"check.response.status,omitempty"` + ResponseIncludeBody string `json:"response.include_body,omitempty"` + ResponseIncludeHeaders bool `json:"response.include_headers,omitempty"` + ResponseIncludeBodyMaxBytes string `json:"response.include_body_max_bytes,omitempty"` + CheckRequestBody JsonObject `json:"check.request.body,omitempty"` + CheckRequestHeaders JsonObject `json:"check.request.headers,omitempty"` + CheckRequestMethod string `json:"check.request.method,omitempty"` + //http and tcp + ProxyUrl string `json:"proxy_url,omitempty"` + SslVerificationMode string `json:"ssl.verification_mode"` + SslSupportedProtocols []string `json:"ssl.supported_protocols"` + //tcp + Host string `json:"host,omitempty"` + ProxyUseLocalResolver *bool `json:"proxy_use_local_resolver,omitempty"` + CheckSend string `json:"check.send,omitempty"` + CheckReceive string `json:"check.receive,omitempty"` +} + +type MonitorTypeConfig struct { + Type MonitorType `json:"type"` +} + +func (f HTTPMonitorFields) APIRequest(config SyntheticsMonitorConfig) interface{} { + + mType := MonitorTypeConfig{Type: Http} + + return struct { + SyntheticsMonitorConfig + MonitorTypeConfig + HTTPMonitorFields + }{ + config, + mType, + f, + } +} + +func (f TCPMonitorFields) APIRequest(config SyntheticsMonitorConfig) interface{} { + + mType := MonitorTypeConfig{Type: Tcp} + + return struct { + SyntheticsMonitorConfig + MonitorTypeConfig + TCPMonitorFields + }{ + config, + mType, + f, + } } -type KibanaSyntheticsMonitorAdd func(config SyntheticsMonitorConfig, fields HTTPMonitorFields, namespace string) (*SyntheticsMonitor, error) +type KibanaSyntheticsMonitorAdd func(ctx context.Context, config SyntheticsMonitorConfig, fields MonitorFields, namespace string) (*SyntheticsMonitor, error) -type KibanaSyntheticsMonitorUpdate func(id MonitorID, config SyntheticsMonitorConfig, fields HTTPMonitorFields, namespace string) (*SyntheticsMonitor, error) +type KibanaSyntheticsMonitorUpdate func(ctx context.Context, id MonitorID, config SyntheticsMonitorConfig, fields MonitorFields, namespace string) (*SyntheticsMonitor, error) -type KibanaSyntheticsMonitorGet func(id MonitorID, namespace string) (*SyntheticsMonitor, error) +type KibanaSyntheticsMonitorGet func(ctx context.Context, id MonitorID, namespace string) (*SyntheticsMonitor, error) -type KibanaSyntheticsMonitorDelete func(namespace string, ids ...MonitorID) ([]MonitorDeleteStatus, error) +type KibanaSyntheticsMonitorDelete func(ctx context.Context, namespace string, ids ...MonitorID) ([]MonitorDeleteStatus, error) -type KibanaSyntheticsPrivateLocationCreate func(pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) +type KibanaSyntheticsPrivateLocationCreate func(ctx context.Context, pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) -type KibanaSyntheticsPrivateLocationGet func(idOrLabel string, namespace string) (*PrivateLocation, error) +type KibanaSyntheticsPrivateLocationGet func(ctx context.Context, idOrLabel string, namespace string) (*PrivateLocation, error) -type KibanaSyntheticsPrivateLocationDelete func(id string, namespace string) error +type KibanaSyntheticsPrivateLocationDelete func(ctx context.Context, id string, namespace string) error func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSyntheticsPrivateLocationGet { - return func(idOrLabel string, namespace string) (*PrivateLocation, error) { + return func(ctx context.Context, idOrLabel string, namespace string) (*PrivateLocation, error) { if idOrLabel == "" { return nil, APIError{ @@ -207,7 +271,7 @@ func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSynthetics path := basePathWithId(namespace, privateLocationsSuffix, idOrLabel) log.Debugf("URL to get private locations: %s", path) - resp, err := c.R().Get(path) + resp, err := c.R().SetContext(ctx).Get(path) if err = handleKibanaError(err, resp); err != nil { return nil, err } @@ -216,21 +280,21 @@ func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSynthetics } func newKibanaSyntheticsPrivateLocationDeleteFunc(c *resty.Client) KibanaSyntheticsPrivateLocationDelete { - return func(id string, namespace string) error { + return func(ctx context.Context, id string, namespace string) error { path := basePathWithId(namespace, privateLocationsSuffix, id) log.Debugf("URL to delete private locations: %s", path) - resp, err := c.R().Delete(path) + resp, err := c.R().SetContext(ctx).Delete(path) err = handleKibanaError(err, resp) return err } } func newKibanaSyntheticsMonitorGetFunc(c *resty.Client) KibanaSyntheticsMonitorGet { - return func(id MonitorID, namespace string) (*SyntheticsMonitor, error) { + return func(ctx context.Context, id MonitorID, namespace string) (*SyntheticsMonitor, error) { path := basePathWithId(namespace, monitorsSuffix, id) log.Debugf("URL to get monitor: %s", path) - resp, err := c.R().Get(path) + resp, err := c.R().SetContext(ctx).Get(path) if err := handleKibanaError(err, resp); err != nil { return nil, err } @@ -239,11 +303,11 @@ func newKibanaSyntheticsMonitorGetFunc(c *resty.Client) KibanaSyntheticsMonitorG } func newKibanaSyntheticsMonitorDeleteFunc(c *resty.Client) KibanaSyntheticsMonitorDelete { - return func(namespace string, ids ...MonitorID) ([]MonitorDeleteStatus, error) { + return func(ctx context.Context, namespace string, ids ...MonitorID) ([]MonitorDeleteStatus, error) { path := basePath(namespace, monitorsSuffix) log.Debugf("URL to delete monitors: %s", path) - resp, err := c.R().SetBody(map[string]interface{}{ + resp, err := c.R().SetContext(ctx).SetBody(map[string]interface{}{ "ids": ids, }).Delete(path) if err = handleKibanaError(err, resp); err != nil { @@ -256,11 +320,11 @@ func newKibanaSyntheticsMonitorDeleteFunc(c *resty.Client) KibanaSyntheticsMonit } func newKibanaSyntheticsPrivateLocationCreateFunc(c *resty.Client) KibanaSyntheticsPrivateLocationCreate { - return func(pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) { + return func(ctx context.Context, pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) { path := basePath(namespace, privateLocationsSuffix) log.Debugf("URL to create private locations: %s", path) - resp, err := c.R().SetBody(pLoc).Post(path) + resp, err := c.R().SetContext(ctx).SetBody(pLoc).Post(path) if err = handleKibanaError(err, resp); err != nil { return nil, err } @@ -269,12 +333,12 @@ func newKibanaSyntheticsPrivateLocationCreateFunc(c *resty.Client) KibanaSynthet } func newKibanaSyntheticsMonitorUpdateFunc(c *resty.Client) KibanaSyntheticsMonitorUpdate { - return func(id MonitorID, config SyntheticsMonitorConfig, fields HTTPMonitorFields, namespace string) (*SyntheticsMonitor, error) { + return func(ctx context.Context, id MonitorID, config SyntheticsMonitorConfig, fields MonitorFields, namespace string) (*SyntheticsMonitor, error) { path := basePathWithId(namespace, monitorsSuffix, id) log.Debugf("URL to update monitor: %s", path) - data := buildMonitorJson(config, fields) - resp, err := c.R().SetBody(data).Put(path) + data := fields.APIRequest(config) + resp, err := c.R().SetContext(ctx).SetBody(data).Put(path) if err := handleKibanaError(err, resp); err != nil { return nil, err } @@ -283,12 +347,12 @@ func newKibanaSyntheticsMonitorUpdateFunc(c *resty.Client) KibanaSyntheticsMonit } func newKibanaSyntheticsMonitorAddFunc(c *resty.Client) KibanaSyntheticsMonitorAdd { - return func(config SyntheticsMonitorConfig, fields HTTPMonitorFields, namespace string) (*SyntheticsMonitor, error) { + return func(ctx context.Context, config SyntheticsMonitorConfig, fields MonitorFields, namespace string) (*SyntheticsMonitor, error) { path := basePath(namespace, monitorsSuffix) log.Debugf("URL to create monitor: %s", path) - data := buildMonitorJson(config, fields) - resp, err := c.R().SetBody(data).Post(path) + data := fields.APIRequest(config) + resp, err := c.R().SetContext(ctx).SetBody(data).Post(path) if err := handleKibanaError(err, resp); err != nil { return nil, err } @@ -296,27 +360,6 @@ func newKibanaSyntheticsMonitorAddFunc(c *resty.Client) KibanaSyntheticsMonitorA } } -// current idea here is to switch fields HTTPMonitorFields to interface{} and to -// type switch in the function for future monitor types -func buildMonitorJson(config SyntheticsMonitorConfig, fields HTTPMonitorFields) interface{} { - - type MonitorTypeConfig struct { - Type MonitorType `json:"type"` - } - - mType := MonitorTypeConfig{Type: Http} - - return struct { - SyntheticsMonitorConfig - MonitorTypeConfig - HTTPMonitorFields - }{ - config, - mType, - fields, - } -} - func unmarshal[T interface{}](resp *resty.Response, result T) (*T, error) { respBody := resp.Body() err := json.Unmarshal(respBody, &result) diff --git a/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go b/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go index b3341653d..22df4891b 100644 --- a/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go +++ b/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go @@ -1,6 +1,7 @@ package kbapi import ( + "context" "encoding/json" "fmt" "testing" @@ -50,13 +51,17 @@ func testWithPolicy(t *testing.T, client *resty.Client, namespace string, f func f(policy.Item.Id) } +// TODO: test update method when set an optional parameter to `null` + func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { type TestConfig struct { config SyntheticsMonitorConfig - fields HTTPMonitorFields + fields MonitorFields } + ctx := context.Background() + for _, n := range namespaces { testUuid := uuid.New().String() space := n @@ -67,10 +72,10 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { Label: fmt.Sprintf("TestKibanaSyntheticsMonitorAdd %s", testUuid), AgentPolicyId: policyId, } - location, err := syntheticsAPI.PrivateLocation.Create(locationConfig, space) + location, err := syntheticsAPI.PrivateLocation.Create(ctx, locationConfig, space) assert.NoError(s.T(), err) defer func(id string) { - syntheticsAPI.PrivateLocation.Delete(id, space) + syntheticsAPI.PrivateLocation.Delete(ctx, id, space) }(location.Id) f := new(bool) @@ -101,6 +106,24 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { }, }, }, + { + name: "bare minimum tcp monitor", + input: TestConfig{ + config: SyntheticsMonitorConfig{ + Name: fmt.Sprintf("test synthetics tcp monitor %s", testUuid), + PrivateLocations: []string{location.Label}, + }, + fields: TCPMonitorFields{ + Host: "localhost:5601", + }, + }, + update: TestConfig{ + config: SyntheticsMonitorConfig{}, + fields: TCPMonitorFields{ + Host: "localhost:9200", + }, + }, + }, { name: "all fields http monitor", input: TestConfig{ @@ -124,16 +147,15 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { RetestOnFailure: f, }, fields: HTTPMonitorFields{ - Url: "http://localhost:5601", - SslSetting: map[string]interface{}{ - "supported_protocols": []string{"TLSv1.0", "TLSv1.1", "TLSv1.2"}, - }, - MaxRedirects: "2", - Mode: ModeAny, - Ipv4: t, - Ipv6: f, - Username: "test-user-name", - Password: "test-password", + Url: "http://localhost:5601", + SslSupportedProtocols: []string{"TLSv1.0", "TLSv1.1", "TLSv1.2"}, + SslVerificationMode: "full", + MaxRedirects: "2", + Mode: ModeAny, + Ipv4: t, + Ipv6: f, + Username: "test-user-name", + Password: "test-password", ProxyHeader: map[string]interface{}{ "User-Agent": "test", }, @@ -170,6 +192,50 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { }, }, }, + { + name: "all fields tcp monitor", + input: TestConfig{ + config: SyntheticsMonitorConfig{ + Name: fmt.Sprintf("test all fields tcp monitor %s", testUuid), + Schedule: Every10Minutes, + PrivateLocations: []string{location.Label}, + Enabled: f, + Tags: []string{"aaa", "bbb"}, + Alert: &MonitorAlertConfig{ + Status: &SyntheticsStatusConfig{Enabled: t}, + Tls: &SyntheticsStatusConfig{Enabled: f}, + }, + APMServiceName: "APMServiceName", + TimeoutSeconds: 42, + Namespace: space, + Params: map[string]interface{}{ + "param1": "some-params", + "my_url": "http://localhost:8080", + }, + RetestOnFailure: f, + }, + fields: TCPMonitorFields{ + Host: "localhost:5601", + SslSupportedProtocols: []string{"TLSv1.0", "TLSv1.1", "TLSv1.2"}, + SslVerificationMode: "full", + ProxyUseLocalResolver: t, + ProxyUrl: "http://localhost", + CheckSend: "Hello World", + CheckReceive: "Hello", + }, + }, + update: TestConfig{ + config: SyntheticsMonitorConfig{ + Name: fmt.Sprintf("update all fields tcp monitor %s", testUuid), + Schedule: Every30Minutes, + }, + fields: TCPMonitorFields{ + Host: "localhost:9200", + ProxyUrl: "http://127.0.0.1", + ProxyUseLocalResolver: f, + }, + }, + }, } for _, tc := range testCases { @@ -177,48 +243,67 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsMonitorAPI() { config := tc.input.config fields := tc.input.fields - monitor, err := syntheticsAPI.Monitor.Add(config, fields, space) + monitor, err := syntheticsAPI.Monitor.Add(ctx, config, fields, space) assert.NoError(s.T(), err) assert.NotNil(s.T(), monitor) - monitor.Params = nil //kibana API doesn't return params for GET request + updateDueToKibanaAPIDiff(monitor) - get, err := syntheticsAPI.Monitor.Get(monitor.Id, space) + get, err := syntheticsAPI.Monitor.Get(ctx, monitor.Id, space) assert.NoError(s.T(), err) assert.Equal(s.T(), monitor, get) - get, err = syntheticsAPI.Monitor.Get(monitor.ConfigId, space) + get, err = syntheticsAPI.Monitor.Get(ctx, monitor.ConfigId, space) assert.NoError(s.T(), err) assert.Equal(s.T(), monitor, get) - update, err := syntheticsAPI.Monitor.Update(monitor.Id, tc.update.config, tc.update.fields, space) + update, err := syntheticsAPI.Monitor.Update(ctx, monitor.Id, tc.update.config, tc.update.fields, space) assert.NoError(s.T(), err) assert.NotNil(s.T(), update) - update.Params = nil //kibana API doesn't return params for GET request + updateDueToKibanaAPIDiff(update) - get, err = syntheticsAPI.Monitor.Get(monitor.ConfigId, space) + get, err = syntheticsAPI.Monitor.Get(ctx, monitor.ConfigId, space) assert.NoError(s.T(), err) get.CreatedAt = time.Time{} // update response doesn't have created_at field assert.Equal(s.T(), update, get) - deleted, err := syntheticsAPI.Monitor.Delete(space, monitor.ConfigId) + deleted, err := syntheticsAPI.Monitor.Delete(ctx, space, monitor.ConfigId) assert.NoError(s.T(), err) for _, d := range deleted { assert.True(s.T(), d.Deleted) } - deleted, err = syntheticsAPI.Monitor.Delete(space, monitor.Id) + deleted, err = syntheticsAPI.Monitor.Delete(ctx, space, monitor.Id) assert.NoError(s.T(), err) for _, d := range deleted { assert.False(s.T(), d.Deleted) } + _, err = syntheticsAPI.Monitor.Get(ctx, monitor.Id, space) + assert.Error(s.T(), err) + assert.IsType(s.T(), APIError{}, err) + assert.Equal(s.T(), 404, err.(APIError).Code) }) } }) } } +// see https://github.com/elastic/kibana/issues/189906 +func updateDueToKibanaAPIDiff(m *SyntheticsMonitor) { + m.Params = nil + m.Username = "" + m.Password = "" + m.ProxyHeaders = nil + m.CheckResponseBodyPositive = nil + m.CheckRequestBody = nil + m.CheckRequestHeaders = nil + m.CheckSend = "" + m.CheckReceive = "" +} + func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationAPI() { + ctx := context.Background() + for _, n := range namespaces { testUuid := uuid.New().String() space := n @@ -236,23 +321,23 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationAPI() { Lon: -42.42, }, } - created, err := pAPI.Create(cfg, space) + created, err := pAPI.Create(ctx, cfg, space) assert.NoError(s.T(), err) assert.Equal(s.T(), created.Label, cfg.Label) assert.Equal(s.T(), created.AgentPolicyId, cfg.AgentPolicyId) - get, err := pAPI.Get(created.Id, space) + get, err := pAPI.Get(ctx, created.Id, space) assert.NoError(s.T(), err) assert.Equal(s.T(), created, get) - get, err = pAPI.Get(created.Label, space) + get, err = pAPI.Get(ctx, created.Label, space) assert.NoError(s.T(), err) assert.Equal(s.T(), created, get) - err = pAPI.Delete(created.Id, space) + err = pAPI.Delete(ctx, created.Id, space) assert.NoError(s.T(), err) - _, err = pAPI.Get(created.Id, space) + _, err = pAPI.Get(ctx, created.Id, space) assert.Error(s.T(), err) }) }) @@ -266,10 +351,11 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationNotFound() { pAPI := s.API.KibanaSynthetics.PrivateLocation ids := []string{"", "not-found", testUuid} + ctx := context.Background() for _, id := range ids { s.Run(fmt.Sprintf("TestKibanaSyntheticsPrivateLocationNotFound - %s - %s", n, id), func() { - _, err := pAPI.Get(id, space) + _, err := pAPI.Get(ctx, id, space) assert.Error(s.T(), err) assert.IsType(s.T(), APIError{}, err) assert.Equal(s.T(), 404, err.(APIError).Code) diff --git a/provider/plugin_framework.go b/provider/plugin_framework.go index dceb73adf..305d81324 100644 --- a/provider/plugin_framework.go +++ b/provider/plugin_framework.go @@ -8,6 +8,7 @@ import ( "github.com/elastic/terraform-provider-elasticstack/internal/kibana/data_view" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/import_saved_objects" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/spaces" + "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics" "github.com/elastic/terraform-provider-elasticstack/internal/kibana/synthetics/private_location" "github.com/elastic/terraform-provider-elasticstack/internal/schema" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -76,5 +77,6 @@ func (p *Provider) Resources(ctx context.Context) []func() resource.Resource { func() resource.Resource { return &import_saved_objects.Resource{} }, func() resource.Resource { return &data_view.Resource{} }, func() resource.Resource { return &private_location.Resource{} }, + func() resource.Resource { return &synthetics.Resource{} }, } } diff --git a/templates/resources/kibana_synthetics_monitor.md.tmpl b/templates/resources/kibana_synthetics_monitor.md.tmpl new file mode 100644 index 000000000..8700aa561 --- /dev/null +++ b/templates/resources/kibana_synthetics_monitor.md.tmpl @@ -0,0 +1,37 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_synthetics_monitor Resource" +description: |- + Creates or updates a Kibana synthetics monitor. +--- + +# Resource: elasticstack_kibana_synthetics_monitor + +Creates or updates a Kibana synthetics monitor. +See [API docs](https://www.elastic.co/guide/en/kibana/current/add-monitor-api.html) + +## Supported monitor types + * `http` + * `tcp` + +**NOTE:** Due-to nature of partial update API, reset values to defaults is not supported. +In case you would like to reset an optional monitor value, please set it explicitly or delete and create new monitor. + + +## Example Usage + +{{ tffile "examples/resources/elasticstack_kibana_synthetics_monitor/resource.tf" }} + +{{ .SchemaMarkdown | trimspace }} + +## Import + +Import is supported using the following syntax: + +{{ codefile "shell" "examples/resources/elasticstack_kibana_synthetics_monitor/import.sh" }} + +**NOTE:** Not all monitor fields are supported during the import due-to API limitation. +Full field support could be implemented after this [kibana issue](https://github.com/elastic/kibana/issues/189906) is resolved. + +Currently not supported fields during the import: `params`, `retest_on_failure`, `http.proxy_header`, `http.username`, `http.password`, `http.check`, `http.response`, `tcp.check_send`, `tcp.check_receive` From 23cbdee5f8c0ba004ee95d249547311c1171a600 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:41:31 +1000 Subject: [PATCH 10/17] Bump github.com/hashicorp/terraform-plugin-framework (#705) Bumps [github.com/hashicorp/terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework) from 1.10.0 to 1.11.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-framework/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-framework/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-framework/compare/v1.10.0...v1.11.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 5 ++--- go.sum | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 53aba661f..8169e9de7 100644 --- a/go.mod +++ b/go.mod @@ -11,13 +11,13 @@ require ( github.com/google/uuid v1.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/terraform-plugin-framework v1.10.0 + github.com/hashicorp/terraform-plugin-framework v1.11.0 + github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-mux v0.16.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 - github.com/hashicorp/terraform-plugin-testing v1.9.0 github.com/mitchellh/mapstructure v1.5.0 github.com/oapi-codegen/runtime v1.1.1 github.com/stretchr/testify v1.9.0 @@ -49,7 +49,6 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.21.0 // indirect github.com/hashicorp/terraform-json v0.22.1 // indirect - github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/go.sum b/go.sum index 414f5829d..3e97cd920 100644 --- a/go.sum +++ b/go.sum @@ -88,8 +88,8 @@ github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVW github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg= github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec= github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A= -github.com/hashicorp/terraform-plugin-framework v1.10.0 h1:xXhICE2Fns1RYZxEQebwkB2+kXouLC932Li9qelozrc= -github.com/hashicorp/terraform-plugin-framework v1.10.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM= +github.com/hashicorp/terraform-plugin-framework v1.11.0 h1:M7+9zBArexHFXDx/pKTxjE6n/2UCXY6b8FIq9ZYhwfE= +github.com/hashicorp/terraform-plugin-framework v1.11.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM= github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0 h1:b8vZYB/SkXJT4YPbT3trzE6oJ7dPyMy68+9dEDKsJjE= github.com/hashicorp/terraform-plugin-framework-jsontypes v0.1.0/go.mod h1:tP9BC3icoXBz72evMS5UTFvi98CiKhPdXF6yLs1wS8A= github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E= @@ -102,8 +102,6 @@ github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQs github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 h1:kJiWGx2kiQVo97Y5IOGR4EMcZ8DtMswHhUuFibsCQQE= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= -github.com/hashicorp/terraform-plugin-testing v1.9.0 h1:xOsQRqqlHKXpFq6etTxih3ubdK3HVDtfE1IY7Rpd37o= -github.com/hashicorp/terraform-plugin-testing v1.9.0/go.mod h1:fhhVx/8+XNJZTD5o3b4stfZ6+q7z9+lIWigIYdT6/44= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= From 4017bd8b12af96375163b0c13a5db75524100354 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 19:41:59 +1000 Subject: [PATCH 11/17] Bump github.com/goreleaser/goreleaser from 1.26.1 to 1.26.2 in /tools (#642) Bumps [github.com/goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) from 1.26.1 to 1.26.2. - [Release notes](https://github.com/goreleaser/goreleaser/releases) - [Changelog](https://github.com/goreleaser/goreleaser/blob/main/.goreleaser.yaml) - [Commits](https://github.com/goreleaser/goreleaser/compare/v1.26.1...v1.26.2) --- updated-dependencies: - dependency-name: github.com/goreleaser/goreleaser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 47 +++++++++++----------- tools/go.sum | 107 +++++++++++++++++++++++---------------------------- 2 files changed, 72 insertions(+), 82 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 275d46503..201e2c356 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -8,7 +8,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/deepmap/oapi-codegen/v2 v2.1.0 github.com/golangci/golangci-lint v1.59.1 - github.com/goreleaser/goreleaser v1.26.1 + github.com/goreleaser/goreleaser v1.26.2 github.com/hashicorp/terraform-plugin-docs v0.18.0 go.uber.org/mock v0.4.0 ) @@ -73,29 +73,29 @@ require ( github.com/ashanbrown/makezero v1.1.1 // indirect github.com/atc0005/go-teams-notify/v2 v2.10.0 // indirect github.com/aws/aws-sdk-go v1.53.0 // indirect - github.com/aws/aws-sdk-go-v2 v1.26.0 // indirect + github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect - github.com/aws/aws-sdk-go-v2/config v1.27.9 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect + github.com/aws/aws-sdk-go-v2/config v1.27.13 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.13 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.9 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.18.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.28.0 // indirect + github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.5 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.3 // indirect github.com/aws/aws-sdk-go-v2/service/kms v1.30.0 // indirect github.com/aws/aws-sdk-go-v2/service/s3 v1.51.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect - github.com/aws/smithy-go v1.20.1 // indirect - github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 // indirect + github.com/aws/smithy-go v1.20.2 // indirect + github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240514230400-03fa26f5508f // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -113,7 +113,7 @@ require ( github.com/butuzov/ireturn v0.3.0 // indirect github.com/butuzov/mirror v1.2.0 // indirect github.com/caarlos0/ctrlc v1.2.0 // indirect - github.com/caarlos0/env/v11 v11.0.0 // indirect + github.com/caarlos0/env/v11 v11.0.1 // indirect github.com/caarlos0/go-reddit/v3 v3.0.1 // indirect github.com/caarlos0/go-shellwords v1.0.12 // indirect github.com/caarlos0/go-version v0.1.1 // indirect @@ -148,8 +148,8 @@ require ( github.com/distribution/reference v0.5.0 // indirect github.com/docker/cli v25.0.4+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v25.0.6+incompatible // indirect - github.com/docker/docker-credential-helpers v0.8.0 // indirect + github.com/docker/docker v26.1.3+incompatible // indirect + github.com/docker/docker-credential-helpers v0.8.1 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -213,7 +213,7 @@ require ( github.com/google/go-containerregistry v0.19.1 // indirect github.com/google/go-github/v62 v62.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/ko v0.15.2 // indirect + github.com/google/ko v0.15.4 // indirect github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect @@ -297,7 +297,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-mastodon v0.0.6 // indirect + github.com/mattn/go-mastodon v0.0.8 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mgechev/revive v1.3.7 // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -305,6 +305,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -373,7 +374,7 @@ require ( github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/tenv v1.7.1 // indirect github.com/skeema/knownhosts v1.2.2 // indirect - github.com/slack-go/slack v0.12.5 // indirect + github.com/slack-go/slack v0.13.0 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect @@ -462,7 +463,7 @@ require ( lukechampine.com/blake3 v1.2.1 // indirect mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect - sigs.k8s.io/kind v0.22.0 // indirect + sigs.k8s.io/kind v0.23.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect software.sslmate.com/src/go-pkcs12 v0.4.0 // indirect ) diff --git a/tools/go.sum b/tools/go.sum index c184f84ef..c1565dc23 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -75,7 +75,6 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= @@ -151,56 +150,52 @@ github.com/atc0005/go-teams-notify/v2 v2.10.0 h1:eQvRIkyESQgBvlUdQ/iPol/lj3QcRyr github.com/atc0005/go-teams-notify/v2 v2.10.0/go.mod h1:SIeE1UfCcVRYMqP5b+r1ZteHyA/2UAjzWF5COnZ8q0w= github.com/aws/aws-sdk-go v1.53.0 h1:MMo1x1ggPPxDfHMXJnQudTbGXYlD4UigUAud1DJxPVo= github.com/aws/aws-sdk-go v1.53.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= -github.com/aws/aws-sdk-go-v2 v1.26.0 h1:/Ce4OCiM3EkpW7Y+xUnfAFpchU78K7/Ug01sZni9PgA= -github.com/aws/aws-sdk-go-v2 v1.26.0/go.mod h1:35hUlJVYd+M++iLI3ALmVwMOyRYMmRqUXpTtRGW+K9I= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 h1:gTK2uhtAPtFcdRRJilZPx8uJLL2J85xK11nKtWL0wfU= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1/go.mod h1:sxpLb+nZk7tIfCWChfd+h4QwHNUR57d8hA1cleTkjJo= -github.com/aws/aws-sdk-go-v2/config v1.27.9 h1:gRx/NwpNEFSk+yQlgmk1bmxxvQ5TyJ76CWXs9XScTqg= -github.com/aws/aws-sdk-go-v2/config v1.27.9/go.mod h1:dK1FQfpwpql83kbD873E9vz4FyAxuJtR22wzoXn3qq0= -github.com/aws/aws-sdk-go-v2/credentials v1.17.9 h1:N8s0/7yW+h8qR8WaRlPQeJ6czVMNQVNtNdUqf6cItao= -github.com/aws/aws-sdk-go-v2/credentials v1.17.9/go.mod h1:446YhIdmSV0Jf/SLafGZalQo+xr2iw7/fzXGDPTU1yQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 h1:af5YzcLf80tv4Em4jWVD75lpnOHSBkPUZxZfGkrI3HI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0/go.mod h1:nQ3how7DMnFMWiU1SpECohgC82fpn4cKZ875NDMmwtA= +github.com/aws/aws-sdk-go-v2/config v1.27.13 h1:WbKW8hOzrWoOA/+35S5okqO/2Ap8hkkFUzoW8Hzq24A= +github.com/aws/aws-sdk-go-v2/config v1.27.13/go.mod h1:XLiyiTMnguytjRER7u5RIkhIqS8Nyz41SwAWb4xEjxs= +github.com/aws/aws-sdk-go-v2/credentials v1.17.13 h1:XDCJDzk/u5cN7Aple7D/MiAhx1Rjo/0nueJ0La8mRuE= +github.com/aws/aws-sdk-go-v2/credentials v1.17.13/go.mod h1:FMNcjQrmuBYvOTZDtOLCIu0esmxjF7RuA/89iSXWzQI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.9 h1:vXY/Hq1XdxHBIYgBUmug/AbMyIe1AKulPYS2/VE1X70= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.9/go.mod h1:GyJJTZoHVuENM4TeJEl5Ffs4W9m19u+4wKJcDi/GZ4A= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 h1:0ScVK/4qZ8CIW0k8jOeFVsyS/sAiXpYxRBLolMkuLQM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4/go.mod h1:84KyjNZdHC6QZW08nfHI6yZgPd+qRgaWcYsyLUo3QY8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 h1:sHmMWWX5E7guWEFQ9SVo6A3S4xpPrWnd77a6y4WM6PU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4/go.mod h1:WjpDrhWisWOIoS9n3nk67A3Ll1vfULJ9Kq6h29HTD48= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.3 h1:mDnFOE2sVkyphMWtTH+stv0eW3k0OTx94K63xpxHty4= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.3/go.mod h1:V8MuRVcCRt5h1S+Fwu8KbC7l/gBGo3yBAyUbJM2IJOk= -github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 h1:y6LX9GUoEA3mO0qpFl1ZQHj1rFyPWVphlzebiSt2tKE= -github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2/go.mod h1:Q0LcmaN/Qr8+4aSBrdrXXePqoX0eOuYpJLbYpilmWnA= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.18.2 h1:PpbXaecV3sLAS6rjQiaKw4/jyq3Z8gNzmoJupHAoBp0= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.18.2/go.mod h1:fUHpGXr4DrXkEDpGAjClPsviWf+Bszeb0daKE0blxv8= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= +github.com/aws/aws-sdk-go-v2/service/ecr v1.28.0 h1:rdPrcOZmqT2F+yzmKEImrx5XUs7Hpf4V9Rp6E8mhsxQ= +github.com/aws/aws-sdk-go-v2/service/ecr v1.28.0/go.mod h1:if7ybzzjOmDB8pat9FE35AHTY6ZxlYSy3YviSmFZv8c= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.5 h1:452e/nFuqPvwPg+1OD2CG/v29R9MH8egJSJKh2Qduv8= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.5/go.mod h1:8pvvNAklmq+hKmqyvFoMRg0bwg9sdGOvdwximmKiKP0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.5 h1:mbWNpfRUTT6bnacmvOTKXZjR/HycibdWzNpfbrbLDIs= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.5/go.mod h1:FCOPWGjsshkkICJIn9hq9xr6dLKtyaWpuUojiN3W1/8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 h1:b+E7zIUHMmcB4Dckjpkapoy47W6C9QBv/zoUP+Hn8Kc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6/go.mod h1:S2fNV0rxrP78NhPbCZeQgY8H9jdDMeGtwcfZIRxzBqU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/gxJBcSWDMZlgyFUM962F51A5CRhDLbxLdmo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.3 h1:4t+QEX7BsXz98W8W1lNvMAG+NX8qHz2CjLBxQKku40g= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.3/go.mod h1:oFcjjUq5Hm09N9rpxTdeMeLeQcxS7mIkBkL8qUKng+A= github.com/aws/aws-sdk-go-v2/service/kms v1.30.0 h1:yS0JkEdV6h9JOo8sy2JSpjX+i7vsKifU8SIeHrqiDhU= github.com/aws/aws-sdk-go-v2/service/kms v1.30.0/go.mod h1:+I8VUUSVD4p5ISQtzpgSva4I8cJ4SQ4b1dcBcof7O+g= github.com/aws/aws-sdk-go-v2/service/s3 v1.51.4 h1:lW5xUzOPGAMY7HPuNF4FdyBwRc3UJ/e8KsapbesVeNU= github.com/aws/aws-sdk-go-v2/service/s3 v1.51.4/go.mod h1:MGTaf3x/+z7ZGugCGvepnx2DS6+caCYYqKhzVoLNYPk= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 h1:mnbuWHOcM70/OFUlZZ5rcdfA8PflGXXiefU/O+1S3+8= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.3/go.mod h1:5HFu51Elk+4oRBZVxmHrSds5jFXmFj8C3w7DVF2gnrs= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 h1:uLq0BKatTmDzWa/Nu4WO0M1AaQDaPpwTKAeByEc6WFM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3/go.mod h1:b+qdhjnxj8GSR6t5YfphOffeoQSQ1KmpoVVuBn+PWxs= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 h1:J/PpTf/hllOjx8Xu9DMflff3FajfLxqM5+tepvVXmxg= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.5/go.mod h1:0ih0Z83YDH/QeQ6Ori2yGE2XvWYv/Xm+cZc01LC6oK0= -github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8 h1:SoFYaT9UyGkR0+nogNyD/Lj+bsixB+SNuAS4ABlEs6M= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8/go.mod h1:2JF49jcDOrLStIXN/j/K1EKRq8a8R2qRnlZA6/o/c7c= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 h1:Qe0r0lVURDDeBQJ4yP+BOrJkvkiCo/3FH/t+wY11dmw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 h1:et3Ta53gotFR4ERLXXHIHl/Uuk1qYpP5uU7cvNql8ns= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240514230400-03fa26f5508f h1:Z0kS9pJDQgCg3u2lH6+CdYaFbyQtyukVTiUCG6re0E4= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240514230400-03fa26f5508f/go.mod h1:rAE739ssmE5O5fLuQ2y8uHdmOJaelE5I0Es3SxV0y1A= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= @@ -237,8 +232,8 @@ github.com/butuzov/mirror v1.2.0/go.mod h1:DqZZDtzm42wIAIyHXeN8W/qb1EPlb9Qn/if9i github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/caarlos0/ctrlc v1.2.0 h1:AtbThhmbeYx1WW3WXdWrd94EHKi+0NPRGS4/4pzrjwk= github.com/caarlos0/ctrlc v1.2.0/go.mod h1:n3gDlSjsXZ7rbD9/RprIR040b7oaLfNStikPd4gFago= -github.com/caarlos0/env/v11 v11.0.0 h1:ZIlkOjuL3xoZS0kmUJlF74j2Qj8GMOq3CDLX/Viak8Q= -github.com/caarlos0/env/v11 v11.0.0/go.mod h1:2RC3HQu8BQqtEK3V4iHPxj0jOdWdbPpWJ6pOueeU1xM= +github.com/caarlos0/env/v11 v11.0.1 h1:A8dDt9Ub9ybqRSUF3fQc/TA/gTam2bKT4Pit+cwrsPs= +github.com/caarlos0/env/v11 v11.0.1/go.mod h1:2RC3HQu8BQqtEK3V4iHPxj0jOdWdbPpWJ6pOueeU1xM= github.com/caarlos0/go-reddit/v3 v3.0.1 h1:w8ugvsrHhaE/m4ez0BO/sTBOBWI9WZTjG7VTecHnql4= github.com/caarlos0/go-reddit/v3 v3.0.1/go.mod h1:QlwgmG5SAqxMeQvg/A2dD1x9cIZCO56BMnMdjXLoisI= github.com/caarlos0/go-shellwords v1.0.12 h1:HWrUnu6lGbWfrDcFiHcZiwOLzHWjjrPVehULaTFgPp8= @@ -296,7 +291,6 @@ github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3 github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= @@ -331,10 +325,10 @@ github.com/docker/cli v25.0.4+incompatible h1:DatRkJ+nrFoYL2HZUzjM5Z5sAmcA5XGp+A github.com/docker/cli v25.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg= -github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= -github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= +github.com/docker/docker v26.1.3+incompatible h1:lLCzRbrVZrljpVNobJu1J2FHk8V0s4BawoZippkc+xo= +github.com/docker/docker v26.1.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= +github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= @@ -523,8 +517,8 @@ github.com/google/go-replayers/grpcreplay v1.1.0 h1:S5+I3zYyZ+GQz68OfbURDdt/+cSM github.com/google/go-replayers/grpcreplay v1.1.0/go.mod h1:qzAvJ8/wi57zq7gWqaE6AwLM6miiXUQwP1S+I9icmhk= github.com/google/go-replayers/httpreplay v1.2.0 h1:VM1wEyyjaoU53BwrOnaf9VhAyQQEEioJvFYxYcLRKzk= github.com/google/go-replayers/httpreplay v1.2.0/go.mod h1:WahEFFZZ7a1P4VM1qEeHy+tME4bwyqPcwWbNlUI1Mcg= -github.com/google/ko v0.15.2 h1:+M1yxpUGPaynwHn26BELF57eDGyt8MUHM7iV/W28kss= -github.com/google/ko v0.15.2/go.mod h1:7a7U0AvWS9MbZdEHcrN8QjJgbafoRqU29WS/azE8cw8= +github.com/google/ko v0.15.4 h1:0blRbIdPmSy6v4LvedGxbI/8krdJYQgbSih3v6Y8V1c= +github.com/google/ko v0.15.4/go.mod h1:ZkcmfV91Xt6ZzOBHc/cXXGYnqWdNWDVy/gHoUU9sjag= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= @@ -559,14 +553,13 @@ github.com/goreleaser/chglog v0.6.1 h1:NZKiX8l0FTQPRzBgKST7knvNZmZ04f7PEGkN2wInf github.com/goreleaser/chglog v0.6.1/go.mod h1:Bnnfo07jMZkaAb0uRNASMZyOsX6ROW6X1qbXqN3guUo= github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+k+7I= github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU= -github.com/goreleaser/goreleaser v1.26.1 h1:ELoLHf6Sb8X7pCj8Cy0g+jBhaTYZMNUdk1dhUiHebtI= -github.com/goreleaser/goreleaser v1.26.1/go.mod h1:ZMSJ2IaYmwx1/69ZErolb51Yta7dwxWyJYZ0SItBCLQ= +github.com/goreleaser/goreleaser v1.26.2 h1:1iY1HaXtRiMTrwy6KE1sNjkRjsjMi+9l0k6WUX8GpWw= +github.com/goreleaser/goreleaser v1.26.2/go.mod h1:mHi6zr6fuuOh5eHdWWgyo/N8BWED5WEVtb/4GETc9jQ= github.com/goreleaser/nfpm/v2 v2.37.1 h1:RUmeEt8OlEVeSzKRrO5Vl5qVWCtUwx4j9uivGuRo5fw= github.com/goreleaser/nfpm/v2 v2.37.1/go.mod h1:q8+sZXFqn106/eGw+9V+I8+izFxZ/sJjrhwmEUxXhUg= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -627,7 +620,6 @@ github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= @@ -756,8 +748,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= -github.com/mattn/go-mastodon v0.0.6 h1:lqU1sOeeIapaDsDUL6udDZIzMb2Wqapo347VZlaOzf0= -github.com/mattn/go-mastodon v0.0.6/go.mod h1:cg7RFk2pcUfHZw/IvKe1FUzmlq5KnLFqs7eV2PHplV8= +github.com/mattn/go-mastodon v0.0.8 h1:UgKs4SmQ5JeawxMIPP7NQ9xncmOXA+5q6jYk4erR7vk= +github.com/mattn/go-mastodon v0.0.8/go.mod h1:8YkqetHoAVEktRkK15qeiv/aaIMfJ/Gc89etisPZtHU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -779,6 +771,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg= github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= @@ -821,7 +815,6 @@ github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/n github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhKRf3Swg= github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= @@ -854,7 +847,6 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6 github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pborman/getopt v0.0.0-20180811024354-2b5b3bfb099b/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= @@ -960,8 +952,8 @@ github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= -github.com/slack-go/slack v0.12.5 h1:ddZ6uz6XVaB+3MTDhoW04gG+Vc/M/X1ctC+wssy2cqs= -github.com/slack-go/slack v0.12.5/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/slack-go/slack v0.13.0 h1:7my/pR2ubZJ9912p9FtvALYpbt0cQPAqkRy2jaSI1PQ= +github.com/slack-go/slack v0.13.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= @@ -981,7 +973,6 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1372,7 +1363,6 @@ gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1408,9 +1398,8 @@ mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= -sigs.k8s.io/kind v0.22.0 h1:z/+yr/azoOfzsfooqRsPw1wjJlqT/ukXP0ShkHwNlsI= -sigs.k8s.io/kind v0.22.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sigs.k8s.io/kind v0.23.0 h1:8fyDGWbWTeCcCTwA04v4Nfr45KKxbSPH1WO9K+jVrBg= +sigs.k8s.io/kind v0.23.0/go.mod h1:ZQ1iZuJLh3T+O8fzhdi3VWcFTzsdXtNv2ppsHc8JQ7s= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k= From ae975fa0fa95bea2e1bc11e75549bb14eab25b63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:47:43 +0000 Subject: [PATCH 12/17] Bump github.com/docker/docker in /tools (#718) Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.1.3+incompatible to 26.1.5+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v26.1.3...v26.1.5) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 201e2c356..2738b663e 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -148,7 +148,7 @@ require ( github.com/distribution/reference v0.5.0 // indirect github.com/docker/cli v25.0.4+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v26.1.3+incompatible // indirect + github.com/docker/docker v26.1.5+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.1 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index c1565dc23..ba6ce89d4 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -325,8 +325,8 @@ github.com/docker/cli v25.0.4+incompatible h1:DatRkJ+nrFoYL2HZUzjM5Z5sAmcA5XGp+A github.com/docker/cli v25.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v26.1.3+incompatible h1:lLCzRbrVZrljpVNobJu1J2FHk8V0s4BawoZippkc+xo= -github.com/docker/docker v26.1.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= +github.com/docker/docker v26.1.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= From 1c23072930f15b03c8548a4ba215e6d16bf98b24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 09:51:12 +1000 Subject: [PATCH 13/17] Bump github.com/golangci/golangci-lint from 1.59.1 to 1.60.1 in /tools (#714) * Bump github.com/golangci/golangci-lint from 1.59.1 to 1.60.1 in /tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.59.1 to 1.60.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.59.1...v1.60.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * go mod tidy * lint --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Toby Brain --- internal/fleet/agent_policy_resource_test.go | 7 +- .../fleet/fleet_server_host_resource_test.go | 3 +- .../fleet/integration_policy_resource_test.go | 9 +- internal/fleet/output_resource_test.go | 3 +- tools/go.mod | 59 +++++---- tools/go.sum | 112 +++++++++--------- 6 files changed, 96 insertions(+), 97 deletions(-) diff --git a/internal/fleet/agent_policy_resource_test.go b/internal/fleet/agent_policy_resource_test.go index cd08bc8d9..42995d60b 100644 --- a/internal/fleet/agent_policy_resource_test.go +++ b/internal/fleet/agent_policy_resource_test.go @@ -2,6 +2,7 @@ package fleet_test import ( "context" + "errors" "fmt" "testing" @@ -139,7 +140,7 @@ func checkResourceAgentPolicyDestroy(s *terraform.State) error { } packagePolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if packagePolicy != nil { return fmt.Errorf("agent policy id=%v still exists, but it should have been removed", rs.Primary.ID) @@ -165,14 +166,14 @@ func checkResourceAgentPolicySkipDestroy(s *terraform.State) error { } packagePolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if packagePolicy == nil { return fmt.Errorf("agent policy id=%v does not exist, but should still exist when skip_destroy is true", rs.Primary.ID) } if diag = fleet.DeleteAgentPolicy(context.Background(), fleetClient, rs.Primary.ID); diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } } return nil diff --git a/internal/fleet/fleet_server_host_resource_test.go b/internal/fleet/fleet_server_host_resource_test.go index f08d4aa12..3717e3186 100644 --- a/internal/fleet/fleet_server_host_resource_test.go +++ b/internal/fleet/fleet_server_host_resource_test.go @@ -2,6 +2,7 @@ package fleet_test import ( "context" + "errors" "fmt" "testing" @@ -103,7 +104,7 @@ func checkResourceFleetServerHostDestroy(s *terraform.State) error { } packagePolicy, diag := fleet.ReadFleetServerHost(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if packagePolicy != nil { return fmt.Errorf("FleetServerHost id=%v still exists, but it should have been removed", rs.Primary.ID) diff --git a/internal/fleet/integration_policy_resource_test.go b/internal/fleet/integration_policy_resource_test.go index b1ad68a52..00e06ad5a 100644 --- a/internal/fleet/integration_policy_resource_test.go +++ b/internal/fleet/integration_policy_resource_test.go @@ -2,6 +2,7 @@ package fleet_test import ( "context" + "errors" "fmt" "testing" @@ -72,7 +73,7 @@ func checkResourceIntegrationPolicyDestroy(s *terraform.State) error { case "elasticstack_fleet_integration_policy": integrationPolicy, diag := fleet.ReadPackagePolicy(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if integrationPolicy != nil { return fmt.Errorf("integration policy id=%v still exists, but it should have been removed", rs.Primary.ID) @@ -80,7 +81,7 @@ func checkResourceIntegrationPolicyDestroy(s *terraform.State) error { case "elasticstack_fleet_agent_policy": agentPolicy, diag := fleet.ReadAgentPolicy(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if agentPolicy != nil { return fmt.Errorf("agent policy id=%v still exists, but it should have been removed", rs.Primary.ID) @@ -134,7 +135,7 @@ resource "elasticstack_fleet_integration_policy" "test_policy" { "enabled": true, "vars": { "listen_address": "localhost", - "listen_port": 8080, + "listen_port": 8080, "data_stream.dataset": "tcp.generic", "tags": [], "syslog_options": "field: message\n#format: auto\n#timezone: Local\n", @@ -189,7 +190,7 @@ resource "elasticstack_fleet_integration_policy" "test_policy" { "enabled": true, "vars": { "listen_address": "localhost", - "listen_port": 8085, + "listen_port": 8085, "data_stream.dataset": "tcp.generic", "tags": [], "syslog_options": "field: message\n#format: auto\n#timezone: Local\n", diff --git a/internal/fleet/output_resource_test.go b/internal/fleet/output_resource_test.go index 52cc10c3a..dc1c3cea0 100644 --- a/internal/fleet/output_resource_test.go +++ b/internal/fleet/output_resource_test.go @@ -2,6 +2,7 @@ package fleet_test import ( "context" + "errors" "fmt" "testing" @@ -226,7 +227,7 @@ func checkResourceOutputDestroy(s *terraform.State) error { } packagePolicy, diag := fleet.ReadOutput(context.Background(), fleetClient, rs.Primary.ID) if diag.HasError() { - return fmt.Errorf(diag[0].Summary) + return errors.New(diag[0].Summary) } if packagePolicy != nil { return fmt.Errorf("output id=%v still exists, but it should have been removed", rs.Primary.ID) diff --git a/tools/go.mod b/tools/go.mod index 2738b663e..9d3a9b9d7 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,13 +1,13 @@ module github.com/elastic/terraform-provider-elasticstack/tools -go 1.22 +go 1.22.1 -toolchain go1.22.2 +toolchain go1.22.5 require ( github.com/client9/misspell v0.3.4 github.com/deepmap/oapi-codegen/v2 v2.1.0 - github.com/golangci/golangci-lint v1.59.1 + github.com/golangci/golangci-lint v1.60.1 github.com/goreleaser/goreleaser v1.26.2 github.com/hashicorp/terraform-plugin-docs v0.18.0 go.uber.org/mock v0.4.0 @@ -28,7 +28,7 @@ require ( github.com/AlekSi/pointer v1.2.0 // indirect github.com/Antonboom/errname v0.1.13 // indirect github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/Antonboom/testifylint v1.3.1 // indirect + github.com/Antonboom/testifylint v1.4.3 // indirect github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect @@ -46,10 +46,10 @@ require ( github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/BurntSushi/toml v1.4.0 // indirect - github.com/Crocmagnon/fatcontext v0.2.2 // indirect + github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect + github.com/Crocmagnon/fatcontext v0.4.0 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect @@ -106,7 +106,7 @@ require ( github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bluesky-social/indigo v0.0.0-20240411170459-440932307e0d // indirect - github.com/bombsimon/wsl/v4 v4.2.1 // indirect + github.com/bombsimon/wsl/v4 v4.4.1 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect github.com/buger/jsonparser v1.1.1 // indirect @@ -134,7 +134,7 @@ require ( github.com/cloudflare/circl v1.3.8 // indirect github.com/containerd/console v1.0.4 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/daixiang0/gci v0.13.4 // indirect @@ -196,7 +196,7 @@ require ( github.com/go-viper/mapstructure/v2 v2.0.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/gofrs/flock v0.8.1 // indirect + github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect @@ -266,7 +266,7 @@ require ( github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect - github.com/jjti/go-spancheck v0.6.1 // indirect + github.com/jjti/go-spancheck v0.6.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect @@ -299,7 +299,7 @@ require ( github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-mastodon v0.0.8 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/mgechev/revive v1.3.7 // indirect + github.com/mgechev/revive v1.3.9 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -307,7 +307,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect - github.com/moricho/tparallel v0.3.1 // indirect + github.com/moricho/tparallel v0.3.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect github.com/muesli/cancelreader v0.2.2 // indirect @@ -339,7 +339,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f // indirect - github.com/polyfloyd/go-errorlint v1.5.2 // indirect + github.com/polyfloyd/go-errorlint v1.6.0 // indirect github.com/posener/complete v1.2.3 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect @@ -353,14 +353,14 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday v1.6.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/ryancurrah/gomodguard v1.3.2 // indirect + github.com/ryancurrah/gomodguard v1.3.3 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.26.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e // indirect github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect @@ -372,7 +372,7 @@ require ( github.com/sigstore/sigstore v1.8.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.7.1 // indirect + github.com/sivchari/tenv v1.10.0 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/slack-go/slack v0.13.0 // indirect github.com/sonatard/noctx v0.0.2 // indirect @@ -381,7 +381,7 @@ require ( github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.18.2 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect @@ -389,7 +389,6 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.16 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect @@ -401,7 +400,7 @@ require ( github.com/ulikunitz/xz v0.5.12 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect - github.com/uudashr/gocognit v1.1.2 // indirect + github.com/uudashr/gocognit v1.1.3 // indirect github.com/vbatts/tar-split v0.11.5 // indirect github.com/wagoodman/go-partybus v0.0.0-20230516145632-8ccac152c651 // indirect github.com/wagoodman/go-progress v0.0.0-20220614130704-4b1c25a33c7c // indirect @@ -419,7 +418,7 @@ require ( gitlab.com/bosi/decorder v0.4.2 // indirect gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect go-simpler.org/musttag v0.12.2 // indirect - go-simpler.org/sloglint v0.7.1 // indirect + go-simpler.org/sloglint v0.7.2 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect @@ -432,18 +431,18 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gocloud.dev v0.37.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect - golang.org/x/mod v0.18.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.22.0 // indirect + golang.org/x/tools v0.24.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.172.0 // indirect google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect @@ -459,7 +458,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.1.0 // indirect - honnef.co/go/tools v0.4.7 // indirect + honnef.co/go/tools v0.5.0 // indirect lukechampine.com/blake3 v1.2.1 // indirect mvdan.cc/gofumpt v0.6.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect diff --git a/tools/go.sum b/tools/go.sum index ba6ce89d4..a8db10ab2 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -27,8 +27,8 @@ github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHO github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.3.1 h1:Uam4q1Q+2b6H7gvk9RQFw6jyVDdpzIirFOOrbs14eG4= -github.com/Antonboom/testifylint v1.3.1/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM= +github.com/Antonboom/testifylint v1.4.3 h1:ohMt6AHuHgttaQ1xb6SSnxCeK4/rnK7KKzbvs7DmEck= +github.com/Antonboom/testifylint v1.4.3/go.mod h1:+8Q9+AOLsz5ZiQiiYujJKs9mNz398+M6UgslP4qgJLA= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= @@ -75,16 +75,16 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.2.2 h1:OrFlsDdOj9hW/oBEJBNSuH7QWf+E9WPVHw+x52bXVbk= -github.com/Crocmagnon/fatcontext v0.2.2/go.mod h1:WSn/c/+MMNiD8Pri0ahRj0o9jVpeowzavOQplBJw6u0= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= +github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= +github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 h1:sATXp1x6/axKxz2Gjxv8MALP0bXaNRfQinEwyfMcx8c= -github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0/go.mod h1:Nl76DrGNJTA1KJ0LePKBw/vznBX1EHbAZX8mwjR82nI= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -217,8 +217,8 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bluesky-social/indigo v0.0.0-20240411170459-440932307e0d h1:xxPhzCOpmOntzVe8S6tqsMdFgaB8B4NXSV54lG4B1qk= github.com/bluesky-social/indigo v0.0.0-20240411170459-440932307e0d/go.mod h1:ysMQ0a4RYWjgyvKrl5ME352oHA6QgK900g5sB9XXgPE= -github.com/bombsimon/wsl/v4 v4.2.1 h1:Cxg6u+XDWff75SIFFmNsqnIOgob+Q9hG6y/ioKbRFiM= -github.com/bombsimon/wsl/v4 v4.2.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= +github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= +github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= @@ -291,8 +291,8 @@ github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3 github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= @@ -449,8 +449,8 @@ github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6C github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= -github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -479,8 +479,8 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks= -github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= +github.com/golangci/golangci-lint v1.60.1 h1:DRKNqNTQRLBJZ1il5u4fvgLQCjQc7QFs0DbhksJtVJE= +github.com/golangci/golangci-lint v1.60.1/go.mod h1:jDIPN1rYaIA+ijp9OZcUmUCoQOtZ76pOlFbi15FlLJY= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -667,8 +667,8 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jjti/go-spancheck v0.6.1 h1:ZK/wE5Kyi1VX3PJpUO2oEgeoI4FWOUm7Shb2Gbv5obI= -github.com/jjti/go-spancheck v0.6.1/go.mod h1:vF1QkOO159prdo6mHRxak2CpzDpHAfKiPUDP/NeRnX8= +github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= +github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -755,8 +755,8 @@ github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mgechev/revive v1.3.7 h1:502QY0vQGe9KtYJ9FpxMz9rL+Fc/P13CI5POL4uHCcE= -github.com/mgechev/revive v1.3.7/go.mod h1:RJ16jUbF0OWC3co/+XTxmFNgEpUPwnnA0BRllX2aDNA= +github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= +github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= @@ -779,8 +779,8 @@ github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= -github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/moricho/tparallel v0.3.2 h1:odr8aZVFA3NZrNybggMkYO3rgPRcqjeQUlBBFVxKHTI= +github.com/moricho/tparallel v0.3.2/go.mod h1:OQ+K3b4Ln3l2TZveGCywybl68glfLEwFGqvnjok8b+U= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -865,8 +865,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f h1:VXTQfuJj9vKR4TCkEuWIckKvdHFeJH/huIFJ9/cXOB0= github.com/polydawn/refmt v0.89.1-0.20221221234430-40501e09de1f/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= -github.com/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA= -github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= +github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= +github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= @@ -902,8 +902,8 @@ github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNl github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.3.2 h1:CuG27ulzEB1Gu5Dk5gP8PFxSOZ3ptSdP5iI/3IXxM18= -github.com/ryancurrah/gomodguard v1.3.2/go.mod h1:LqdemiFomEjcxOqirbQCb3JFvSxH2JUYMerTFd3sF2o= +github.com/ryancurrah/gomodguard v1.3.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= +github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= @@ -916,8 +916,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE= -github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= +github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= +github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/sassoftware/go-rpmutils v0.4.0 h1:ojND82NYBxgwrV+mX1CWsd5QJvvEZTKddtCdFLPWhpg= github.com/sassoftware/go-rpmutils v0.4.0/go.mod h1:3goNWi7PGAT3/dlql2lv3+MSN5jNYPjT5mVcQcIsYzI= github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e h1:7q6NSFZDeGfvvtIRwBrU/aegEYJYmvev0cHAwo17zZQ= @@ -948,8 +948,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= -github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= +github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/slack-go/slack v0.13.0 h1:7my/pR2ubZJ9912p9FtvALYpbt0cQPAqkRy2jaSI1PQ= @@ -973,8 +973,8 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -1003,8 +1003,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= -github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -1034,8 +1032,8 @@ github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqD github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/Gk8VQ= github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= -github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= +github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= +github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/wagoodman/go-partybus v0.0.0-20230516145632-8ccac152c651 h1:jIVmlAFIqV3d+DOxazTR9v+zgj8+VYuQBzPgBZvWBHA= @@ -1089,8 +1087,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= -go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU= -go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c= +go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= +go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= @@ -1152,8 +1150,8 @@ golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58 golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= @@ -1180,8 +1178,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= -golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1205,8 +1203,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -1221,8 +1219,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1241,7 +1239,6 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1254,8 +1251,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1266,8 +1263,8 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -1280,8 +1277,8 @@ golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1311,7 +1308,6 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= @@ -1319,8 +1315,8 @@ golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1390,8 +1386,8 @@ gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= -honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= +honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE= +honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= From 192094646f452012da1f119b0afd7da6e29da2cd Mon Sep 17 00:00:00 2001 From: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:07:58 +0200 Subject: [PATCH 14/17] fix: move all resources in one namespace for tcp monitor acc tests (#717) * fix: move all resources in one namespace for tcp monitor acc tests * add mutex in kibana API client and move tests to same package to run test in single golang process due-to https://github.com/elastic/kibana/issues/190801 --- .../acc_test.go => acc_pl_test.go} | 21 +++++----- internal/kibana/synthetics/acc_test.go | 10 ++--- libs/go-kibana-rest/docker-compose.yml | 1 + .../kbapi/api.kibana_synthetics.go | 39 +++++++++++-------- .../kbapi/api.kibana_synthetics_test.go | 3 +- 5 files changed, 43 insertions(+), 31 deletions(-) rename internal/kibana/synthetics/{private_location/acc_test.go => acc_pl_test.go} (92%) diff --git a/internal/kibana/synthetics/private_location/acc_test.go b/internal/kibana/synthetics/acc_pl_test.go similarity index 92% rename from internal/kibana/synthetics/private_location/acc_test.go rename to internal/kibana/synthetics/acc_pl_test.go index 57995d7f5..f4279a525 100644 --- a/internal/kibana/synthetics/private_location/acc_test.go +++ b/internal/kibana/synthetics/acc_pl_test.go @@ -1,4 +1,7 @@ -package private_location_test +package synthetics_test + +// this test is in synthetics_test package, because of https://github.com/elastic/kibana/issues/190801 +// having both tests in same package allows to use mutex in kibana API client and workaround the issue import ( "fmt" @@ -21,10 +24,10 @@ provider "elasticstack" { ) var ( - minKibanaVersion = version.Must(version.NewVersion("8.12.0")) + minKibanaPrivateLocationAPIVersion = version.Must(version.NewVersion("8.12.0")) ) -func TestPrivateLocationResource(t *testing.T) { +func TestSyntheticPrivateLocationResource(t *testing.T) { resourceId := "elasticstack_kibana_synthetics_private_location.test" resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -32,7 +35,7 @@ func TestPrivateLocationResource(t *testing.T) { Steps: []resource.TestStep{ // Create and Read testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), Config: testConfig("testacc", "test_policy") + ` resource "elasticstack_kibana_synthetics_private_location" "test" { label = "pl-test-label" @@ -58,7 +61,7 @@ resource "elasticstack_kibana_synthetics_private_location" "test" { }, // ImportState testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), ResourceName: resourceId, ImportState: true, ImportStateVerify: true, @@ -77,7 +80,7 @@ resource "elasticstack_kibana_synthetics_private_location" "test" { }, // Update and Read testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), Config: testConfig("default", "test_policy_default") + ` resource "elasticstack_kibana_synthetics_private_location" "test" { label = "pl-test-label-2" @@ -104,7 +107,7 @@ resource "elasticstack_kibana_synthetics_private_location" "test" { }, // Update and Read testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), Config: testConfig("default", "test_policy_default") + ` resource "elasticstack_kibana_synthetics_private_location" "test" { label = "pl-test-label-2" @@ -122,7 +125,7 @@ resource "elasticstack_kibana_synthetics_private_location" "test" { }, // Update and Read testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), Config: testConfig("default", "test_policy_default") + ` resource "elasticstack_kibana_synthetics_private_location" "test" { label = "pl-test-label-2" @@ -144,7 +147,7 @@ resource "elasticstack_kibana_synthetics_private_location" "test" { }, // Update and Read testing { - SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaVersion), + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minKibanaPrivateLocationAPIVersion), Config: testConfig("default", "test_policy_default") + ` resource "elasticstack_kibana_synthetics_private_location" "test" { label = "pl-test-label-2" diff --git a/internal/kibana/synthetics/acc_test.go b/internal/kibana/synthetics/acc_test.go index 264ba04c4..dce29e5fb 100644 --- a/internal/kibana/synthetics/acc_test.go +++ b/internal/kibana/synthetics/acc_test.go @@ -112,7 +112,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" { resource "elasticstack_kibana_synthetics_monitor" "%s" { name = "TestTcpMonitorResource - %s" - space_id = "default" + space_id = "testacc" schedule = 5 private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] enabled = true @@ -140,7 +140,7 @@ resource "elasticstack_kibana_synthetics_monitor" "%s" { tcpMonitorUpdated = ` resource "elasticstack_kibana_synthetics_monitor" "%s" { name = "TestTcpMonitorResource Updated - %s" - space_id = "default" + space_id = "testacc" schedule = 10 private_locations = [elasticstack_kibana_synthetics_private_location.%s.label] enabled = false @@ -285,7 +285,7 @@ func TestSyntheticMonitorTCPResource(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(tcpMonitorId, "id"), resource.TestCheckResourceAttr(tcpMonitorId, "name", "TestTcpMonitorResource - "+name), - resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "default"), + resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "testacc"), resource.TestCheckResourceAttr(tcpMonitorId, "schedule", "5"), resource.TestCheckResourceAttr(tcpMonitorId, "private_locations.#", "1"), resource.TestCheckResourceAttrSet(tcpMonitorId, "private_locations.0"), @@ -323,7 +323,7 @@ func TestSyntheticMonitorTCPResource(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(tcpMonitorId, "id"), resource.TestCheckResourceAttr(tcpMonitorId, "name", "TestTcpMonitorResource Updated - "+name), - resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "default"), + resource.TestCheckResourceAttr(tcpMonitorId, "space_id", "testacc"), resource.TestCheckResourceAttr(tcpMonitorId, "schedule", "10"), resource.TestCheckResourceAttr(tcpMonitorId, "private_locations.#", "1"), resource.TestCheckResourceAttrSet(tcpMonitorId, "private_locations.0"), @@ -377,7 +377,7 @@ resource "elasticstack_fleet_agent_policy" "%s" { } resource "elasticstack_kibana_synthetics_private_location" "%s" { - label = "TestMonitorResource-label-%s" + label = "monitor-pll-%s" space_id = "testacc" agent_policy_id = elasticstack_fleet_agent_policy.%s.policy_id } diff --git a/libs/go-kibana-rest/docker-compose.yml b/libs/go-kibana-rest/docker-compose.yml index e0c6ac37b..1f14ad454 100644 --- a/libs/go-kibana-rest/docker-compose.yml +++ b/libs/go-kibana-rest/docker-compose.yml @@ -29,6 +29,7 @@ services: ELASTICSEARCH_USERNAME: kibana_system ELASTICSEARCH_PASSWORD: changeme XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: min-32-byte-long-strong-encryption-key +# LOGGING_ROOT_LEVEL: debug links: - elasticsearch:es ports: diff --git a/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go b/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go index 44193dede..578cae340 100644 --- a/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go +++ b/libs/go-kibana-rest/kbapi/api.kibana_synthetics.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "sync" "time" "github.com/go-resty/resty/v2" @@ -47,6 +48,8 @@ const ( ModeAny = "any" ) +var plMu sync.Mutex + type MonitorFields interface { APIRequest(cfg SyntheticsMonitorConfig) interface{} } @@ -260,8 +263,7 @@ type KibanaSyntheticsPrivateLocationGet func(ctx context.Context, idOrLabel stri type KibanaSyntheticsPrivateLocationDelete func(ctx context.Context, id string, namespace string) error func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSyntheticsPrivateLocationGet { - return func(ctx context.Context, idOrLabel string, namespace string) (*PrivateLocation, error) { - + return func(ctx context.Context, idOrLabel string, _ string) (*PrivateLocation, error) { if idOrLabel == "" { return nil, APIError{ Code: 404, @@ -269,7 +271,7 @@ func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSynthetics } } - path := basePathWithId(namespace, privateLocationsSuffix, idOrLabel) + path := basePathWithId("", privateLocationsSuffix, idOrLabel) log.Debugf("URL to get private locations: %s", path) resp, err := c.R().SetContext(ctx).Get(path) if err = handleKibanaError(err, resp); err != nil { @@ -279,8 +281,26 @@ func newKibanaSyntheticsPrivateLocationGetFunc(c *resty.Client) KibanaSynthetics } } +func newKibanaSyntheticsPrivateLocationCreateFunc(c *resty.Client) KibanaSyntheticsPrivateLocationCreate { + return func(ctx context.Context, pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) { + plMu.Lock() + defer plMu.Unlock() + + path := basePath(namespace, privateLocationsSuffix) + log.Debugf("URL to create private locations: %s", path) + resp, err := c.R().SetContext(ctx).SetBody(pLoc).Post(path) + if err = handleKibanaError(err, resp); err != nil { + return nil, err + } + return unmarshal(resp, PrivateLocation{}) + } +} + func newKibanaSyntheticsPrivateLocationDeleteFunc(c *resty.Client) KibanaSyntheticsPrivateLocationDelete { return func(ctx context.Context, id string, namespace string) error { + plMu.Lock() + defer plMu.Unlock() + path := basePathWithId(namespace, privateLocationsSuffix, id) log.Debugf("URL to delete private locations: %s", path) resp, err := c.R().SetContext(ctx).Delete(path) @@ -319,19 +339,6 @@ func newKibanaSyntheticsMonitorDeleteFunc(c *resty.Client) KibanaSyntheticsMonit } } -func newKibanaSyntheticsPrivateLocationCreateFunc(c *resty.Client) KibanaSyntheticsPrivateLocationCreate { - return func(ctx context.Context, pLoc PrivateLocationConfig, namespace string) (*PrivateLocation, error) { - - path := basePath(namespace, privateLocationsSuffix) - log.Debugf("URL to create private locations: %s", path) - resp, err := c.R().SetContext(ctx).SetBody(pLoc).Post(path) - if err = handleKibanaError(err, resp); err != nil { - return nil, err - } - return unmarshal(resp, PrivateLocation{}) - } -} - func newKibanaSyntheticsMonitorUpdateFunc(c *resty.Client) KibanaSyntheticsMonitorUpdate { return func(ctx context.Context, id MonitorID, config SyntheticsMonitorConfig, fields MonitorFields, namespace string) (*SyntheticsMonitor, error) { diff --git a/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go b/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go index 22df4891b..265057a8a 100644 --- a/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go +++ b/libs/go-kibana-rest/kbapi/api.kibana_synthetics_test.go @@ -313,7 +313,7 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationAPI() { testWithPolicy(s.T(), s.client, space, func(policyId string) { cfg := PrivateLocationConfig{ - Label: fmt.Sprintf("TestKibanaSyntheticsPrivateLocationAPI %s", testUuid), + Label: fmt.Sprintf("TestKibanaSyntheticsPrivateLocationAPI-%s", testUuid), AgentPolicyId: policyId, Tags: []string{"a", "b"}, Geo: &SyntheticGeoConfig{ @@ -322,6 +322,7 @@ func (s *KBAPITestSuite) TestKibanaSyntheticsPrivateLocationAPI() { }, } created, err := pAPI.Create(ctx, cfg, space) + assert.NoError(s.T(), err) assert.Equal(s.T(), created.Label, cfg.Label) assert.Equal(s.T(), created.AgentPolicyId, cfg.AgentPolicyId) From 890e65dff809b47805ae1195c1ec837409db9120 Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Wed, 21 Aug 2024 19:15:33 +1000 Subject: [PATCH 15/17] Validate that mappings are a JSON object, not just valid json (#719) * Validate that mappings are a JSON object, not just valid json * Docs * Changelog * Update internal/elasticsearch/index/validation_test.go Co-authored-by: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> --------- Co-authored-by: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> --- CHANGELOG.md | 3 +- .../elasticsearch_component_template.md | 2 +- .../resources/elasticsearch_index_template.md | 2 +- .../elasticsearch/index/component_template.go | 10 ++-- internal/elasticsearch/index/index.go | 6 ++- internal/elasticsearch/index/template.go | 10 ++-- internal/elasticsearch/index/validation.go | 22 ++++++++ .../elasticsearch/index/validation_test.go | 51 +++++++++++++++++++ 8 files changed, 95 insertions(+), 11 deletions(-) create mode 100644 internal/elasticsearch/index/validation.go create mode 100644 internal/elasticsearch/index/validation_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2b99897..2aa9f468e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [Unreleased] -- Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699)) +- Improve validation for index settings and mappings ([#719](https://github.com/elastic/terraform-provider-elasticstack/pull/719)) +- Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699)) - Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682)) ## [0.11.5] - 2024-08-12 diff --git a/docs/resources/elasticsearch_component_template.md b/docs/resources/elasticsearch_component_template.md index 5908917ba..0e150b797 100644 --- a/docs/resources/elasticsearch_component_template.md +++ b/docs/resources/elasticsearch_component_template.md @@ -63,7 +63,7 @@ resource "elasticstack_elasticsearch_index_template" "my_template" { Optional: - `alias` (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias)) -- `mappings` (String) Mapping for fields in the index. +- `mappings` (String) Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details - `settings` (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings diff --git a/docs/resources/elasticsearch_index_template.md b/docs/resources/elasticsearch_index_template.md index 4eae1398e..f93dfbe6f 100644 --- a/docs/resources/elasticsearch_index_template.md +++ b/docs/resources/elasticsearch_index_template.md @@ -102,7 +102,7 @@ Optional: Optional: - `alias` (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias)) -- `mappings` (String) Mapping for fields in the index. +- `mappings` (String) Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details - `settings` (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings diff --git a/internal/elasticsearch/index/component_template.go b/internal/elasticsearch/index/component_template.go index 52f419e44..f129d6fa6 100644 --- a/internal/elasticsearch/index/component_template.go +++ b/internal/elasticsearch/index/component_template.go @@ -93,18 +93,22 @@ func ResourceComponentTemplate() *schema.Resource { }, }, "mappings": { - Description: "Mapping for fields in the index.", + Description: "Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details", Type: schema.TypeString, Optional: true, DiffSuppressFunc: utils.DiffJsonSuppress, - ValidateFunc: validation.StringIsJSON, + ValidateFunc: validation.All( + validation.StringIsJSON, stringIsJSONObject, + ), }, "settings": { Description: "Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings", Type: schema.TypeString, Optional: true, DiffSuppressFunc: utils.DiffIndexSettingSuppress, - ValidateFunc: validation.StringIsJSON, + ValidateFunc: validation.All( + validation.StringIsJSON, stringIsJSONObject, + ), }, }, }, diff --git a/internal/elasticsearch/index/index.go b/internal/elasticsearch/index/index.go index 5a861a03e..27591e4c2 100644 --- a/internal/elasticsearch/index/index.go +++ b/internal/elasticsearch/index/index.go @@ -489,8 +489,10 @@ If specified, this mapping can include: field names, [field data types](https:// Type: schema.TypeString, Optional: true, DiffSuppressFunc: utils.DiffJsonSuppress, - ValidateFunc: validation.StringIsJSON, - Default: "{}", + ValidateFunc: validation.All( + validation.StringIsJSON, stringIsJSONObject, + ), + Default: "{}", }, // Deprecated: individual setting field should be used instead "settings": { diff --git a/internal/elasticsearch/index/template.go b/internal/elasticsearch/index/template.go index 3d079dcd1..834565096 100644 --- a/internal/elasticsearch/index/template.go +++ b/internal/elasticsearch/index/template.go @@ -140,18 +140,22 @@ func ResourceTemplate() *schema.Resource { }, }, "mappings": { - Description: "Mapping for fields in the index.", + Description: "Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details", Type: schema.TypeString, Optional: true, DiffSuppressFunc: utils.DiffJsonSuppress, - ValidateFunc: validation.StringIsJSON, + ValidateFunc: validation.All( + validation.StringIsJSON, stringIsJSONObject, + ), }, "settings": { Description: "Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings", Type: schema.TypeString, Optional: true, DiffSuppressFunc: utils.DiffIndexSettingSuppress, - ValidateFunc: validation.StringIsJSON, + ValidateFunc: validation.All( + validation.StringIsJSON, stringIsJSONObject, + ), }, }, }, diff --git a/internal/elasticsearch/index/validation.go b/internal/elasticsearch/index/validation.go new file mode 100644 index 000000000..0d5d8601f --- /dev/null +++ b/internal/elasticsearch/index/validation.go @@ -0,0 +1,22 @@ +package index + +import ( + "encoding/json" + "fmt" +) + +func stringIsJSONObject(i interface{}, s string) (warnings []string, errors []error) { + iStr, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", s)) + return warnings, errors + } + + m := map[string]interface{}{} + if err := json.Unmarshal([]byte(iStr), &m); err != nil { + errors = append(errors, fmt.Errorf("expected %s to be a JSON object. Check the documentation for the expected format. %w", s, err)) + return + } + + return +} diff --git a/internal/elasticsearch/index/validation_test.go b/internal/elasticsearch/index/validation_test.go new file mode 100644 index 000000000..2637f3cd9 --- /dev/null +++ b/internal/elasticsearch/index/validation_test.go @@ -0,0 +1,51 @@ +package index + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_stringIsJSONObject(t *testing.T) { + tests := []struct { + name string + fieldVal interface{} + expectedErrsToContain []string + }{ + { + name: "should not return an error for a valid json object", + fieldVal: "{}", + }, + { + name: "should not return an error for a null", + fieldVal: "null", + }, + + { + name: "should return an error if the field is not a string", + fieldVal: true, + expectedErrsToContain: []string{ + "expected type of field-name to be string", + }, + }, + { + name: "should return an error if the field is valid json, but not an object", + fieldVal: "[]", + expectedErrsToContain: []string{ + "expected field-name to be a JSON object. Check the documentation for the expected format.", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + warnings, errors := stringIsJSONObject(tt.fieldVal, "field-name") + require.Empty(t, warnings) + + require.Equal(t, len(tt.expectedErrsToContain), len(errors)) + for i, err := range errors { + require.ErrorContains(t, err, tt.expectedErrsToContain[i]) + } + }) + } +} From 0118d48ecf7015bc6b441c144c29a70072b58dfc Mon Sep 17 00:00:00 2001 From: Boris Ilyushonak <57406418+biscout42@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:59:48 +0200 Subject: [PATCH 16/17] chore: prepare release v0.11.6 (#716) --- CHANGELOG.md | 4 +++- Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aa9f468e..7ec27bcdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [Unreleased] +## [0.11.6] - 2024-08-20 - Improve validation for index settings and mappings ([#719](https://github.com/elastic/terraform-provider-elasticstack/pull/719)) - Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699)) - Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682)) @@ -319,7 +320,8 @@ - Initial set of docs - CI integration -[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.5...HEAD +[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.6...HEAD +[0.11.6]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.5...v0.11.6 [0.11.5]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...v0.11.5 [0.11.4]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.3...v0.11.4 [0.11.3]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.2...v0.11.3 diff --git a/Makefile b/Makefile index 32ca0af18..6cace2caa 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL := /bin/bash -VERSION ?= 0.11.5 +VERSION ?= 0.11.6 NAME = elasticstack BINARY = terraform-provider-${NAME} From ffa5f172778016cf8f6d955be216b50adad1bb52 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 22 Aug 2024 10:07:31 +0100 Subject: [PATCH 17/17] Add support for the `alert_delay` param in the Create Rule API (#715) * Initial commit. * Small change * Fix docs. * Add version check * Updated tests * more tests and version checks * Improve error message. Co-authored-by: Toby Brain * Update version check Co-authored-by: Toby Brain * PR comments * Changelog * Final changes --------- Co-authored-by: Toby Brain --- CHANGELOG.md | 9 +- Makefile | 1 + docs/resources/kibana_alerting_rule.md | 1 + generated/alerting/.openapi-generator/FILES | 41 +- generated/alerting/README.md | 199 +- generated/alerting/api/openapi.yaml | 3507 ++++++++++------- generated/alerting/api_alerting.go | 619 ++- generated/alerting/api_alerting_mocks.go | 121 +- generated/alerting/bundled.yaml | 1906 ++++++--- generated/alerting/client.go | 4 +- generated/alerting/configuration.go | 165 +- generated/alerting/docs/ActionsInner.md | 71 +- .../alerting/docs/ActionsInnerAlertsFilter.md | 82 + .../docs/ActionsInnerAlertsFilterQuery.md | 82 + .../docs/ActionsInnerAlertsFilterTimeframe.md | 108 + .../ActionsInnerAlertsFilterTimeframeHours.md | 82 + .../alerting/docs/ActionsInnerFrequency.md | 12 +- generated/alerting/docs/AlertDelay.md | 51 + .../alerting/docs/AlertResponseProperties.md | 10 - generated/alerting/docs/AlertingApi.md | 441 ++- generated/alerting/docs/CreateRuleRequest.md | 42 +- generated/alerting/docs/FieldmapProperties.md | 300 ++ .../docs/FieldmapPropertiesPropertiesValue.md | 56 + generated/alerting/docs/Filter.md | 108 + generated/alerting/docs/FilterMeta.md | 352 ++ .../docs/FindRulesHasReferenceParameter.md | 24 +- .../docs/GetAlertingHealth200Response.md | 26 - .../docs/GetRuleTypes200ResponseInner.md | 106 +- ...eTypes200ResponseInnerActionGroupsInner.md | 24 +- ...uleTypes200ResponseInnerActionVariables.md | 8 +- ...esponseInnerActionVariablesContextInner.md | 24 +- ...ResponseInnerActionVariablesParamsInner.md | 24 +- ...0ResponseInnerActionVariablesStateInner.md | 82 + .../GetRuleTypes200ResponseInnerAlerts.md | 238 ++ ...RuleTypes200ResponseInnerAlertsMappings.md | 66 + ...ypes200ResponseInnerAuthorizedConsumers.md | 26 + ...ypes200ResponseInnerRecoveryActionGroup.md | 24 +- .../LegacyCreateAlertRequestProperties.md | 12 +- .../LegacyFindAlertsHasReferenceParameter.md | 82 + .../LegacyGetAlertTypes200ResponseInner.md | 8 +- ...tTypes200ResponseInnerActionGroupsInner.md | 82 + ...ertTypes200ResponseInnerActionVariables.md | 44 +- ...ypes200ResponseInnerRecoveryActionGroup.md | 24 +- .../LegacyUpdateAlertRequestProperties.md | 8 +- generated/alerting/docs/Model400Response.md | 93 + generated/alerting/docs/NotifyWhenAction.md | 15 + .../alerting/docs/RuleResponseProperties.md | 116 +- .../docs/RuleResponsePropertiesLastRun.md | 36 +- generated/alerting/docs/UpdateRuleRequest.md | 34 +- generated/alerting/model_400_response.go | 169 + generated/alerting/model_401_response.go | 2 +- generated/alerting/model_404_response.go | 2 +- generated/alerting/model_actions_inner.go | 164 +- .../model_actions_inner_alerts_filter.go | 160 + ...model_actions_inner_alerts_filter_query.go | 161 + ...l_actions_inner_alerts_filter_timeframe.go | 197 + ...ons_inner_alerts_filter_timeframe_hours.go | 162 + .../alerting/model_actions_inner_frequency.go | 6 +- generated/alerting/model_alert_delay.go | 116 + .../model_alert_response_properties.go | 11 +- ...rt_response_properties_execution_status.go | 2 +- ...odel_alert_response_properties_schedule.go | 2 +- .../alerting/model_create_rule_request.go | 64 +- .../alerting/model_fieldmap_properties.go | 459 +++ ...el_fieldmap_properties_properties_value.go | 125 + generated/alerting/model_filter.go | 196 + generated/alerting/model_filter_meta.go | 531 +++ .../alerting/model_find_rules_200_response.go | 2 +- ...odel_find_rules_has_reference_parameter.go | 68 +- .../model_get_alerting_health_200_response.go | 42 +- ..._200_response_alerting_framework_health.go | 2 +- ...ting_framework_health_decryption_health.go | 2 +- ...rting_framework_health_execution_health.go | 2 +- ...e_alerting_framework_health_read_health.go | 2 +- ...model_get_rule_types_200_response_inner.go | 149 +- ..._200_response_inner_action_groups_inner.go | 68 +- ...pes_200_response_inner_action_variables.go | 14 +- ...se_inner_action_variables_context_inner.go | 70 +- ...nse_inner_action_variables_params_inner.go | 68 +- ...onse_inner_action_variables_state_inner.go | 160 + ...et_rule_types_200_response_inner_alerts.go | 387 ++ ...ypes_200_response_inner_alerts_mappings.go | 126 + ...200_response_inner_authorized_consumers.go | 38 +- ...ponse_inner_authorized_consumers_alerts.go | 2 +- ...00_response_inner_recovery_action_group.go | 68 +- ..._legacy_create_alert_request_properties.go | 17 +- .../model_legacy_find_alerts_200_response.go | 2 +- ...acy_find_alerts_has_reference_parameter.go | 160 + ...gacy_get_alert_types_200_response_inner.go | 17 +- ..._200_response_inner_action_groups_inner.go | 160 + ...pes_200_response_inner_action_variables.go | 60 +- ...00_response_inner_recovery_action_group.go | 68 +- ...legacy_get_alerting_health_200_response.go | 2 +- ..._200_response_alerting_framework_health.go | 2 +- ...ting_framework_health_decryption_health.go | 2 +- ...rting_framework_health_execution_health.go | 2 +- ...e_alerting_framework_health_read_health.go | 2 +- ..._legacy_update_alert_request_properties.go | 15 +- ..._alert_request_properties_actions_inner.go | 2 +- ...pdate_alert_request_properties_schedule.go | 2 +- generated/alerting/model_notify_when.go | 4 +- .../model_rule_response_properties.go | 184 +- ...le_response_properties_execution_status.go | 2 +- ...model_rule_response_properties_last_run.go | 77 +- ...sponse_properties_last_run_alerts_count.go | 2 +- generated/alerting/model_schedule.go | 2 +- .../alerting/model_update_rule_request.go | 64 +- generated/alerting/response.go | 2 +- generated/alerting/utils.go | 2 +- internal/clients/kibana/alerting.go | 54 +- internal/clients/kibana/alerting_test.go | 28 +- internal/kibana/alerting.go | 44 +- internal/kibana/alerting_test.go | 98 + internal/models/alert_rule.go | 3 +- 114 files changed, 11413 insertions(+), 3061 deletions(-) create mode 100644 generated/alerting/docs/ActionsInnerAlertsFilter.md create mode 100644 generated/alerting/docs/ActionsInnerAlertsFilterQuery.md create mode 100644 generated/alerting/docs/ActionsInnerAlertsFilterTimeframe.md create mode 100644 generated/alerting/docs/ActionsInnerAlertsFilterTimeframeHours.md create mode 100644 generated/alerting/docs/AlertDelay.md create mode 100644 generated/alerting/docs/FieldmapProperties.md create mode 100644 generated/alerting/docs/FieldmapPropertiesPropertiesValue.md create mode 100644 generated/alerting/docs/Filter.md create mode 100644 generated/alerting/docs/FilterMeta.md create mode 100644 generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md create mode 100644 generated/alerting/docs/GetRuleTypes200ResponseInnerAlerts.md create mode 100644 generated/alerting/docs/GetRuleTypes200ResponseInnerAlertsMappings.md create mode 100644 generated/alerting/docs/LegacyFindAlertsHasReferenceParameter.md create mode 100644 generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md create mode 100644 generated/alerting/docs/Model400Response.md create mode 100644 generated/alerting/docs/NotifyWhenAction.md create mode 100644 generated/alerting/model_400_response.go create mode 100644 generated/alerting/model_actions_inner_alerts_filter.go create mode 100644 generated/alerting/model_actions_inner_alerts_filter_query.go create mode 100644 generated/alerting/model_actions_inner_alerts_filter_timeframe.go create mode 100644 generated/alerting/model_actions_inner_alerts_filter_timeframe_hours.go create mode 100644 generated/alerting/model_alert_delay.go create mode 100644 generated/alerting/model_fieldmap_properties.go create mode 100644 generated/alerting/model_fieldmap_properties_properties_value.go create mode 100644 generated/alerting/model_filter.go create mode 100644 generated/alerting/model_filter_meta.go create mode 100644 generated/alerting/model_get_rule_types_200_response_inner_action_variables_state_inner.go create mode 100644 generated/alerting/model_get_rule_types_200_response_inner_alerts.go create mode 100644 generated/alerting/model_get_rule_types_200_response_inner_alerts_mappings.go create mode 100644 generated/alerting/model_legacy_find_alerts_has_reference_parameter.go create mode 100644 generated/alerting/model_legacy_get_alert_types_200_response_inner_action_groups_inner.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ec27bcdd..a8ec9806d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## [Unreleased] +- Add the `alert_delay` field to the Create Rule API ([#715](https://github.com/elastic/terraform-provider-elasticstack/pull/715)) + ## [0.11.6] - 2024-08-20 + - Improve validation for index settings and mappings ([#719](https://github.com/elastic/terraform-provider-elasticstack/pull/719)) - Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699)) - Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682)) @@ -16,6 +19,7 @@ ## [0.11.4] - 2024-06-13 ### Breaking changes + - The `title` attribute is now required in the elasticstack_kibana_data_view resource. In practice the resource didn't work without this set, the schema now enforces it's correctly configured. ### Fixed @@ -40,7 +44,7 @@ ### Added -- Added datasource for alerting connectors. ([#607](https://github.com/elastic/terraform-provider-elasticstack/pull/607)) +- Added datasource for alerting connectors. ([#607](https://github.com/elastic/terraform-provider-elasticstack/pull/607)) ## [0.11.2] - 2024-03-13 @@ -152,6 +156,7 @@ - Add 'min\_\*' conditions to ILM rollover ([#250](https://github.com/elastic/terraform-provider-elasticstack/pull/250)) - Add support for Kibana connections ([#226](https://github.com/elastic/terraform-provider-elasticstack/pull/226)) - **[Breaking Change] Add 'deletion_protection' field to index resource** to avoid unintentional deletion. ([#167](https://github.com/elastic/terraform-provider-elasticstack/pull/167)) + - To delete index resource, you'll need to explicitly set `deletion_protection = false` as follows. ```terraform @@ -186,6 +191,7 @@ - Correctly handle empty logstash pipeline metadata in plan diffs ([#256](https://github.com/elastic/terraform-provider-elasticstack/pull/256)) - Fix error when logging API requests in debug mode ([#259](https://github.com/elastic/terraform-provider-elasticstack/pull/259)) - **[Breaking Change] Change `pipeline_metadata` type from schema.TypeMap to schema.TypeString**. This is to fix an error caused by updates to Logstash Pipelines outside of TF ([#278](https://github.com/elastic/terraform-provider-elasticstack/issues/278)) + - To use the updated `pipeline_metadata` field, you'll need to encapsulate any Terraform configuration with **jsonencode{}** as follows: ```terraform @@ -211,6 +217,7 @@ - run `terraform apply` - OR - reimport the resources into state using `terraform import` () + - Fix order of `indices` field in SLM ([#326](https://github.com/elastic/terraform-provider-elasticstack/pull/326)) ## [0.5.0] - 2022-12-07 diff --git a/Makefile b/Makefile index 6cace2caa..8bc3eeb3b 100644 --- a/Makefile +++ b/Makefile @@ -216,6 +216,7 @@ tools: $(GOBIN) ## Install useful tools for linting, docs generation and develop @ cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint @ cd tools && go install github.com/goreleaser/goreleaser @ cd tools && go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen + @ cd tools && go install go.uber.org/mock/mockgen .PHONY: misspell misspell: diff --git a/docs/resources/kibana_alerting_rule.md b/docs/resources/kibana_alerting_rule.md index 66dcb1aa6..496ad077d 100644 --- a/docs/resources/kibana_alerting_rule.md +++ b/docs/resources/kibana_alerting_rule.md @@ -62,6 +62,7 @@ Could not create API key - Unsupported scheme "ApiKey" for granting API Key ### Optional - `actions` (Block List) An action that runs under defined conditions. (see [below for nested schema](#nestedblock--actions)) +- `alert_delay` (Number) A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur. - `enabled` (Boolean) Indicates if you want to run the rule on an interval basis. - `rule_id` (String) A UUID v1 or v4 to use instead of a randomly generated ID. - `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used. diff --git a/generated/alerting/.openapi-generator/FILES b/generated/alerting/.openapi-generator/FILES index 07ea4bbb3..33e02dee5 100644 --- a/generated/alerting/.openapi-generator/FILES +++ b/generated/alerting/.openapi-generator/FILES @@ -6,36 +6,45 @@ api_alerting.go client.go configuration.go docs/ActionsInner.md +docs/ActionsInnerAlertsFilter.md +docs/ActionsInnerAlertsFilterQuery.md +docs/ActionsInnerAlertsFilterTimeframe.md +docs/ActionsInnerAlertsFilterTimeframeHours.md docs/ActionsInnerFrequency.md +docs/AlertDelay.md docs/AlertResponseProperties.md docs/AlertResponsePropertiesExecutionStatus.md docs/AlertResponsePropertiesSchedule.md docs/AlertingAPI.md docs/CreateRuleRequest.md +docs/FieldmapProperties.md +docs/FieldmapPropertiesPropertiesValue.md +docs/Filter.md +docs/FilterMeta.md docs/FindRules200Response.md docs/FindRulesHasReferenceParameter.md -docs/FindRulesSearchFieldsParameter.md docs/GetAlertingHealth200Response.md docs/GetAlertingHealth200ResponseAlertingFrameworkHealth.md docs/GetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth.md docs/GetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth.md docs/GetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md -docs/GetAlertingHealth200ResponseAlertingFrameworkHeath.md -docs/GetAlertingHealth200ResponseAlertingFrameworkHeathDecryptionHealth.md docs/GetRuleTypes200ResponseInner.md docs/GetRuleTypes200ResponseInnerActionGroupsInner.md docs/GetRuleTypes200ResponseInnerActionVariables.md docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md +docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md +docs/GetRuleTypes200ResponseInnerAlerts.md +docs/GetRuleTypes200ResponseInnerAlertsMappings.md docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md docs/GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md docs/LegacyCreateAlertRequestProperties.md -docs/LegacyCreateAlertRequestPropertiesSchedule.md docs/LegacyFindAlerts200Response.md +docs/LegacyFindAlertsHasReferenceParameter.md docs/LegacyGetAlertTypes200ResponseInner.md +docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md -docs/LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner.md docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md docs/LegacyGetAlertingHealth200Response.md docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealth.md @@ -45,6 +54,7 @@ docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md docs/LegacyUpdateAlertRequestProperties.md docs/LegacyUpdateAlertRequestPropertiesActionsInner.md docs/LegacyUpdateAlertRequestPropertiesSchedule.md +docs/Model400Response.md docs/Model401Response.md docs/Model404Response.md docs/NotifyWhen.md @@ -57,38 +67,48 @@ docs/UpdateRuleRequest.md git_push.sh go.mod go.sum +model_400_response.go model_401_response.go model_404_response.go model_actions_inner.go +model_actions_inner_alerts_filter.go +model_actions_inner_alerts_filter_query.go +model_actions_inner_alerts_filter_timeframe.go +model_actions_inner_alerts_filter_timeframe_hours.go model_actions_inner_frequency.go +model_alert_delay.go model_alert_response_properties.go model_alert_response_properties_execution_status.go model_alert_response_properties_schedule.go model_create_rule_request.go +model_fieldmap_properties.go +model_fieldmap_properties_properties_value.go +model_filter.go +model_filter_meta.go model_find_rules_200_response.go model_find_rules_has_reference_parameter.go -model_find_rules_search_fields_parameter.go model_get_alerting_health_200_response.go model_get_alerting_health_200_response_alerting_framework_health.go model_get_alerting_health_200_response_alerting_framework_health_decryption_health.go model_get_alerting_health_200_response_alerting_framework_health_execution_health.go model_get_alerting_health_200_response_alerting_framework_health_read_health.go -model_get_alerting_health_200_response_alerting_framework_heath.go -model_get_alerting_health_200_response_alerting_framework_heath_decryption_health.go model_get_rule_types_200_response_inner.go model_get_rule_types_200_response_inner_action_groups_inner.go model_get_rule_types_200_response_inner_action_variables.go model_get_rule_types_200_response_inner_action_variables_context_inner.go model_get_rule_types_200_response_inner_action_variables_params_inner.go +model_get_rule_types_200_response_inner_action_variables_state_inner.go +model_get_rule_types_200_response_inner_alerts.go +model_get_rule_types_200_response_inner_alerts_mappings.go model_get_rule_types_200_response_inner_authorized_consumers.go model_get_rule_types_200_response_inner_authorized_consumers_alerts.go model_get_rule_types_200_response_inner_recovery_action_group.go model_legacy_create_alert_request_properties.go -model_legacy_create_alert_request_properties_schedule.go model_legacy_find_alerts_200_response.go +model_legacy_find_alerts_has_reference_parameter.go model_legacy_get_alert_types_200_response_inner.go +model_legacy_get_alert_types_200_response_inner_action_groups_inner.go model_legacy_get_alert_types_200_response_inner_action_variables.go -model_legacy_get_alert_types_200_response_inner_action_variables_context_inner.go model_legacy_get_alert_types_200_response_inner_recovery_action_group.go model_legacy_get_alerting_health_200_response.go model_legacy_get_alerting_health_200_response_alerting_framework_health.go @@ -99,6 +119,7 @@ model_legacy_update_alert_request_properties.go model_legacy_update_alert_request_properties_actions_inner.go model_legacy_update_alert_request_properties_schedule.go model_notify_when.go +model_notify_when_action.go model_rule_response_properties.go model_rule_response_properties_execution_status.go model_rule_response_properties_last_run.go diff --git a/generated/alerting/README.md b/generated/alerting/README.md index 2688d437c..434adaeee 100644 --- a/generated/alerting/README.md +++ b/generated/alerting/README.md @@ -3,9 +3,10 @@ OpenAPI schema for alerting endpoints ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 0.1 +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.2 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen @@ -73,94 +74,104 @@ ctx = context.WithValue(context.Background(), alerting.ContextOperationServerVar ## Documentation for API Endpoints -All URIs are relative to *http://localhost:5601* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AlertingAPI* | [**CreateRule**](docs/AlertingAPI.md#createrule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule. -*AlertingAPI* | [**DeleteRule**](docs/AlertingAPI.md#deleterule) | **Delete** /s/{spaceId}/api/alerting/rule/{ruleId} | Deletes a rule. -*AlertingAPI* | [**DisableRule**](docs/AlertingAPI.md#disablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_disable | Disables a rule. -*AlertingAPI* | [**EnableRule**](docs/AlertingAPI.md#enablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_enable | Enables a rule. -*AlertingAPI* | [**FindRules**](docs/AlertingAPI.md#findrules) | **Get** /s/{spaceId}/api/alerting/rules/_find | Retrieves information about rules. -*AlertingAPI* | [**GetAlertingHealth**](docs/AlertingAPI.md#getalertinghealth) | **Get** /s/{spaceId}/api/alerting/_health | Retrieves the health status of the alerting framework. -*AlertingAPI* | [**GetRule**](docs/AlertingAPI.md#getrule) | **Get** /s/{spaceId}/api/alerting/rule/{ruleId} | Retrieves a rule by its identifier. -*AlertingAPI* | [**GetRuleTypes**](docs/AlertingAPI.md#getruletypes) | **Get** /s/{spaceId}/api/alerting/rule_types | Retrieves a list of rule types. -*AlertingAPI* | [**LegacyCreateAlert**](docs/AlertingAPI.md#legacycreatealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId} | Create an alert. -*AlertingAPI* | [**LegacyDisableAlert**](docs/AlertingAPI.md#legacydisablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_disable | Disables an alert. -*AlertingAPI* | [**LegacyEnableAlert**](docs/AlertingAPI.md#legacyenablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_enable | Enables an alert. -*AlertingAPI* | [**LegacyFindAlerts**](docs/AlertingAPI.md#legacyfindalerts) | **Get** /s/{spaceId}/api/alerts/alerts/_find | Retrieves a paginated set of alerts. -*AlertingAPI* | [**LegacyGetAlert**](docs/AlertingAPI.md#legacygetalert) | **Get** /s/{spaceId}/api/alerts/alert/{alertId} | Retrieves an alert by its identifier. -*AlertingAPI* | [**LegacyGetAlertTypes**](docs/AlertingAPI.md#legacygetalerttypes) | **Get** /s/{spaceId}/api/alerts/alerts/list_alert_types | Retrieves a list of alert types. -*AlertingAPI* | [**LegacyGetAlertingHealth**](docs/AlertingAPI.md#legacygetalertinghealth) | **Get** /s/{spaceId}/api/alerts/alerts/_health | Retrieves the health status of the alerting framework. -*AlertingAPI* | [**LegacyMuteAlertInstance**](docs/AlertingAPI.md#legacymutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute | Mutes an alert instance. -*AlertingAPI* | [**LegacyMuteAllAlertInstances**](docs/AlertingAPI.md#legacymuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_mute_all | Mutes all alert instances. -*AlertingAPI* | [**LegacyUnmuteAlertInstance**](docs/AlertingAPI.md#legacyunmutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute | Unmutes an alert instance. -*AlertingAPI* | [**LegacyUnmuteAllAlertInstances**](docs/AlertingAPI.md#legacyunmuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/_unmute_all | Unmutes all alert instances. -*AlertingAPI* | [**LegacyUpdateAlert**](docs/AlertingAPI.md#legacyupdatealert) | **Put** /s/{spaceId}/api/alerts/alert/{alertId} | Updates the attributes for an alert. -*AlertingAPI* | [**LegaryDeleteAlert**](docs/AlertingAPI.md#legarydeletealert) | **Delete** /s/{spaceId}/api/alerts/alert/{alertId} | Permanently removes an alert. -*AlertingAPI* | [**MuteAlert**](docs/AlertingAPI.md#mutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute | Mutes an alert. -*AlertingAPI* | [**MuteAllAlerts**](docs/AlertingAPI.md#muteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all | Mutes all alerts. -*AlertingAPI* | [**UnmuteAlert**](docs/AlertingAPI.md#unmutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute | Unmutes an alert. -*AlertingAPI* | [**UnmuteAllAlerts**](docs/AlertingAPI.md#unmuteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all | Unmutes all alerts. -*AlertingAPI* | [**UpdateRule**](docs/AlertingAPI.md#updaterule) | **Put** /s/{spaceId}/api/alerting/rule/{ruleId} | Updates the attributes for a rule. - +All URIs are relative to _http://localhost_ + +| Class | Method | HTTP request | Description | +| ------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------- | +| _AlertingAPI_ | [**CreateRule**](docs/AlertingAPI.md#createrule) | **Post** /s/{spaceId}/api/alerting/rule | Creates a rule with a randomly generated rule identifier. | +| _AlertingAPI_ | [**CreateRuleId**](docs/AlertingAPI.md#createruleid) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule with a specific rule identifier. | +| _AlertingAPI_ | [**DeleteRule**](docs/AlertingAPI.md#deleterule) | **Delete** /s/{spaceId}/api/alerting/rule/{ruleId} | Deletes a rule. | +| _AlertingAPI_ | [**DisableRule**](docs/AlertingAPI.md#disablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/\_disable | Disables a rule. | +| _AlertingAPI_ | [**EnableRule**](docs/AlertingAPI.md#enablerule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/\_enable | Enables a rule. | +| _AlertingAPI_ | [**FindRules**](docs/AlertingAPI.md#findrules) | **Get** /s/{spaceId}/api/alerting/rules/\_find | Retrieves information about rules. | +| _AlertingAPI_ | [**GetAlertingHealth**](docs/AlertingAPI.md#getalertinghealth) | **Get** /s/{spaceId}/api/alerting/\_health | Retrieves the health status of the alerting framework. | +| _AlertingAPI_ | [**GetRule**](docs/AlertingAPI.md#getrule) | **Get** /s/{spaceId}/api/alerting/rule/{ruleId} | Retrieves a rule by its identifier. | +| _AlertingAPI_ | [**GetRuleTypes**](docs/AlertingAPI.md#getruletypes) | **Get** /s/{spaceId}/api/alerting/rule_types | Retrieves a list of rule types. | +| _AlertingAPI_ | [**LegacyCreateAlert**](docs/AlertingAPI.md#legacycreatealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId} | Create an alert. | +| _AlertingAPI_ | [**LegacyDisableAlert**](docs/AlertingAPI.md#legacydisablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/\_disable | Disables an alert. | +| _AlertingAPI_ | [**LegacyEnableAlert**](docs/AlertingAPI.md#legacyenablealert) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/\_enable | Enables an alert. | +| _AlertingAPI_ | [**LegacyFindAlerts**](docs/AlertingAPI.md#legacyfindalerts) | **Get** /s/{spaceId}/api/alerts/alerts/\_find | Retrieves a paginated set of alerts. | +| _AlertingAPI_ | [**LegacyGetAlert**](docs/AlertingAPI.md#legacygetalert) | **Get** /s/{spaceId}/api/alerts/alert/{alertId} | Retrieves an alert by its identifier. | +| _AlertingAPI_ | [**LegacyGetAlertTypes**](docs/AlertingAPI.md#legacygetalerttypes) | **Get** /s/{spaceId}/api/alerts/alerts/list_alert_types | Retrieves a list of alert types. | +| _AlertingAPI_ | [**LegacyGetAlertingHealth**](docs/AlertingAPI.md#legacygetalertinghealth) | **Get** /s/{spaceId}/api/alerts/alerts/\_health | Retrieves the health status of the alerting framework. | +| _AlertingAPI_ | [**LegacyMuteAlertInstance**](docs/AlertingAPI.md#legacymutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/\_mute | Mutes an alert instance. | +| _AlertingAPI_ | [**LegacyMuteAllAlertInstances**](docs/AlertingAPI.md#legacymuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/\_mute_all | Mutes all alert instances. | +| _AlertingAPI_ | [**LegacyUnmuteAlertInstance**](docs/AlertingAPI.md#legacyunmutealertinstance) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/\_unmute | Unmutes an alert instance. | +| _AlertingAPI_ | [**LegacyUnmuteAllAlertInstances**](docs/AlertingAPI.md#legacyunmuteallalertinstances) | **Post** /s/{spaceId}/api/alerts/alert/{alertId}/\_unmute_all | Unmutes all alert instances. | +| _AlertingAPI_ | [**LegacyUpdateAlert**](docs/AlertingAPI.md#legacyupdatealert) | **Put** /s/{spaceId}/api/alerts/alert/{alertId} | Updates the attributes for an alert. | +| _AlertingAPI_ | [**LegaryDeleteAlert**](docs/AlertingAPI.md#legarydeletealert) | **Delete** /s/{spaceId}/api/alerts/alert/{alertId} | Permanently removes an alert. | +| _AlertingAPI_ | [**MuteAlert**](docs/AlertingAPI.md#mutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/\_mute | Mutes an alert. | +| _AlertingAPI_ | [**MuteAllAlerts**](docs/AlertingAPI.md#muteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/\_mute_all | Mutes all alerts. | +| _AlertingAPI_ | [**UnmuteAlert**](docs/AlertingAPI.md#unmutealert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/\_unmute | Unmutes an alert. | +| _AlertingAPI_ | [**UnmuteAllAlerts**](docs/AlertingAPI.md#unmuteallalerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/\_unmute_all | Unmutes all alerts. | +| _AlertingAPI_ | [**UpdateRule**](docs/AlertingAPI.md#updaterule) | **Put** /s/{spaceId}/api/alerting/rule/{ruleId} | Updates the attributes for a rule. | +| _AlertingAPI_ | [**UpdateRuleAPIKey**](docs/AlertingAPI.md#updateruleapikey) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/\_update_api_key | Updates the API key for a rule. | ## Documentation For Models - - [ActionsInner](docs/ActionsInner.md) - - [ActionsInnerFrequency](docs/ActionsInnerFrequency.md) - - [AlertResponseProperties](docs/AlertResponseProperties.md) - - [AlertResponsePropertiesExecutionStatus](docs/AlertResponsePropertiesExecutionStatus.md) - - [AlertResponsePropertiesSchedule](docs/AlertResponsePropertiesSchedule.md) - - [CreateRuleRequest](docs/CreateRuleRequest.md) - - [FindRules200Response](docs/FindRules200Response.md) - - [FindRulesHasReferenceParameter](docs/FindRulesHasReferenceParameter.md) - - [FindRulesSearchFieldsParameter](docs/FindRulesSearchFieldsParameter.md) - - [GetAlertingHealth200Response](docs/GetAlertingHealth200Response.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealth.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHeath](docs/GetAlertingHealth200ResponseAlertingFrameworkHeath.md) - - [GetAlertingHealth200ResponseAlertingFrameworkHeathDecryptionHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHeathDecryptionHealth.md) - - [GetRuleTypes200ResponseInner](docs/GetRuleTypes200ResponseInner.md) - - [GetRuleTypes200ResponseInnerActionGroupsInner](docs/GetRuleTypes200ResponseInnerActionGroupsInner.md) - - [GetRuleTypes200ResponseInnerActionVariables](docs/GetRuleTypes200ResponseInnerActionVariables.md) - - [GetRuleTypes200ResponseInnerActionVariablesContextInner](docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md) - - [GetRuleTypes200ResponseInnerActionVariablesParamsInner](docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) - - [GetRuleTypes200ResponseInnerAuthorizedConsumers](docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md) - - [GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts](docs/GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) - - [GetRuleTypes200ResponseInnerRecoveryActionGroup](docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md) - - [LegacyCreateAlertRequestProperties](docs/LegacyCreateAlertRequestProperties.md) - - [LegacyCreateAlertRequestPropertiesSchedule](docs/LegacyCreateAlertRequestPropertiesSchedule.md) - - [LegacyFindAlerts200Response](docs/LegacyFindAlerts200Response.md) - - [LegacyGetAlertTypes200ResponseInner](docs/LegacyGetAlertTypes200ResponseInner.md) - - [LegacyGetAlertTypes200ResponseInnerActionVariables](docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md) - - [LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner](docs/LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner.md) - - [LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup](docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md) - - [LegacyGetAlertingHealth200Response](docs/LegacyGetAlertingHealth200Response.md) - - [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealth.md) - - [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth.md) - - [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth.md) - - [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md) - - [LegacyUpdateAlertRequestProperties](docs/LegacyUpdateAlertRequestProperties.md) - - [LegacyUpdateAlertRequestPropertiesActionsInner](docs/LegacyUpdateAlertRequestPropertiesActionsInner.md) - - [LegacyUpdateAlertRequestPropertiesSchedule](docs/LegacyUpdateAlertRequestPropertiesSchedule.md) - - [Model401Response](docs/Model401Response.md) - - [Model404Response](docs/Model404Response.md) - - [NotifyWhen](docs/NotifyWhen.md) - - [RuleResponseProperties](docs/RuleResponseProperties.md) - - [RuleResponsePropertiesExecutionStatus](docs/RuleResponsePropertiesExecutionStatus.md) - - [RuleResponsePropertiesLastRun](docs/RuleResponsePropertiesLastRun.md) - - [RuleResponsePropertiesLastRunAlertsCount](docs/RuleResponsePropertiesLastRunAlertsCount.md) - - [Schedule](docs/Schedule.md) - - [UpdateRuleRequest](docs/UpdateRuleRequest.md) - +- [ActionsInner](docs/ActionsInner.md) +- [ActionsInnerAlertsFilter](docs/ActionsInnerAlertsFilter.md) +- [ActionsInnerAlertsFilterQuery](docs/ActionsInnerAlertsFilterQuery.md) +- [ActionsInnerAlertsFilterTimeframe](docs/ActionsInnerAlertsFilterTimeframe.md) +- [ActionsInnerAlertsFilterTimeframeHours](docs/ActionsInnerAlertsFilterTimeframeHours.md) +- [ActionsInnerFrequency](docs/ActionsInnerFrequency.md) +- [AlertDelay](docs/AlertDelay.md) +- [AlertResponseProperties](docs/AlertResponseProperties.md) +- [AlertResponsePropertiesExecutionStatus](docs/AlertResponsePropertiesExecutionStatus.md) +- [AlertResponsePropertiesSchedule](docs/AlertResponsePropertiesSchedule.md) +- [CreateRuleRequest](docs/CreateRuleRequest.md) +- [FieldmapProperties](docs/FieldmapProperties.md) +- [FieldmapPropertiesPropertiesValue](docs/FieldmapPropertiesPropertiesValue.md) +- [Filter](docs/Filter.md) +- [FilterMeta](docs/FilterMeta.md) +- [FindRules200Response](docs/FindRules200Response.md) +- [FindRulesHasReferenceParameter](docs/FindRulesHasReferenceParameter.md) +- [GetAlertingHealth200Response](docs/GetAlertingHealth200Response.md) +- [GetAlertingHealth200ResponseAlertingFrameworkHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealth.md) +- [GetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth.md) +- [GetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth.md) +- [GetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth](docs/GetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md) +- [GetRuleTypes200ResponseInner](docs/GetRuleTypes200ResponseInner.md) +- [GetRuleTypes200ResponseInnerActionGroupsInner](docs/GetRuleTypes200ResponseInnerActionGroupsInner.md) +- [GetRuleTypes200ResponseInnerActionVariables](docs/GetRuleTypes200ResponseInnerActionVariables.md) +- [GetRuleTypes200ResponseInnerActionVariablesContextInner](docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md) +- [GetRuleTypes200ResponseInnerActionVariablesParamsInner](docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) +- [GetRuleTypes200ResponseInnerActionVariablesStateInner](docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md) +- [GetRuleTypes200ResponseInnerAlerts](docs/GetRuleTypes200ResponseInnerAlerts.md) +- [GetRuleTypes200ResponseInnerAlertsMappings](docs/GetRuleTypes200ResponseInnerAlertsMappings.md) +- [GetRuleTypes200ResponseInnerAuthorizedConsumers](docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md) +- [GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts](docs/GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) +- [GetRuleTypes200ResponseInnerRecoveryActionGroup](docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md) +- [LegacyCreateAlertRequestProperties](docs/LegacyCreateAlertRequestProperties.md) +- [LegacyFindAlerts200Response](docs/LegacyFindAlerts200Response.md) +- [LegacyFindAlertsHasReferenceParameter](docs/LegacyFindAlertsHasReferenceParameter.md) +- [LegacyGetAlertTypes200ResponseInner](docs/LegacyGetAlertTypes200ResponseInner.md) +- [LegacyGetAlertTypes200ResponseInnerActionGroupsInner](docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md) +- [LegacyGetAlertTypes200ResponseInnerActionVariables](docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md) +- [LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup](docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md) +- [LegacyGetAlertingHealth200Response](docs/LegacyGetAlertingHealth200Response.md) +- [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealth.md) +- [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthDecryptionHealth.md) +- [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthExecutionHealth.md) +- [LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth](docs/LegacyGetAlertingHealth200ResponseAlertingFrameworkHealthReadHealth.md) +- [LegacyUpdateAlertRequestProperties](docs/LegacyUpdateAlertRequestProperties.md) +- [LegacyUpdateAlertRequestPropertiesActionsInner](docs/LegacyUpdateAlertRequestPropertiesActionsInner.md) +- [LegacyUpdateAlertRequestPropertiesSchedule](docs/LegacyUpdateAlertRequestPropertiesSchedule.md) +- [Model400Response](docs/Model400Response.md) +- [Model401Response](docs/Model401Response.md) +- [Model404Response](docs/Model404Response.md) +- [NotifyWhen](docs/NotifyWhen.md) +- [RuleResponseProperties](docs/RuleResponseProperties.md) +- [RuleResponsePropertiesExecutionStatus](docs/RuleResponsePropertiesExecutionStatus.md) +- [RuleResponsePropertiesLastRun](docs/RuleResponsePropertiesLastRun.md) +- [RuleResponsePropertiesLastRunAlertsCount](docs/RuleResponsePropertiesLastRunAlertsCount.md) +- [Schedule](docs/Schedule.md) +- [UpdateRuleRequest](docs/UpdateRuleRequest.md) ## Documentation For Authorization - Authentication schemes defined for the API: + ### basicAuth - **Type**: HTTP basic authentication @@ -196,24 +207,20 @@ auth := context.WithValue( r, err := client.Service.Operation(auth, args) ``` - ## Documentation for Utility Methods Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it: -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` +- `PtrBool` +- `PtrInt` +- `PtrInt32` +- `PtrInt64` +- `PtrFloat` +- `PtrFloat32` +- `PtrFloat64` +- `PtrString` +- `PtrTime` ## Author - - - diff --git a/generated/alerting/api/openapi.yaml b/generated/alerting/api/openapi.yaml index 653895aae..81becda9d 100644 --- a/generated/alerting/api/openapi.yaml +++ b/generated/alerting/api/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.1.0 info: contact: name: Alerting Team @@ -7,10 +7,9 @@ info: name: Elastic License 2.0 url: https://www.elastic.co/licensing/elastic-license title: Alerting - version: "0.1" + version: "0.2" servers: -- description: local - url: http://localhost:5601 +- url: / security: - basicAuth: [] - apiKeyAuth: [] @@ -18,39 +17,73 @@ tags: - description: Alerting APIs enable you to create and manage rules and alerts. name: alerting paths: + /s/{spaceId}/api/alerting/rule: + post: + description: | + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. + operationId: createRule + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + content: + application/json: + examples: + createEsQueryEsqlRuleRequest: + $ref: '#/components/examples/create_es_query_esql_rule_request' + createEsQueryRuleRequest: + $ref: '#/components/examples/create_es_query_rule_request' + createEsQueryKqlRuleRequest: + $ref: '#/components/examples/create_es_query_kql_rule_request' + createIndexThresholdRuleRequest: + $ref: '#/components/examples/create_index_threshold_rule_request' + createTrackingContainmentRuleRequest: + $ref: '#/components/examples/create_tracking_containment_rule_request' + schema: + $ref: '#/components/schemas/create_rule_request' + required: true + responses: + "200": + content: + application/json: + examples: + createEsQueryEsqlRuleResponse: + $ref: '#/components/examples/create_es_query_esql_rule_response' + createEsQueryRuleResponse: + $ref: '#/components/examples/create_es_query_rule_response' + createEsQueryKqlRuleResponse: + $ref: '#/components/examples/create_es_query_kql_rule_response' + createIndexThresholdRuleResponse: + $ref: '#/components/examples/create_index_threshold_rule_response' + createTrackingContainmentRuleResponse: + $ref: '#/components/examples/create_tracking_containment_rule_response' + schema: + $ref: '#/components/schemas/rule_response_properties' + description: Indicates a successful call. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Authorization information is missing or invalid. + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Object is not found. + summary: Creates a rule with a randomly generated rule identifier. + tags: + - alerting /s/{spaceId}/api/alerting/rule/{ruleId}: delete: description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. + To delete a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. If the API key that is used by the rule was created automatically, it is deleted. operationId: deleteRule parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -66,8 +99,6 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Object is not found. - servers: - - url: https://localhost:5601 summary: Deletes a rule. tags: - alerting @@ -76,25 +107,8 @@ paths: You must have `read` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rules you're seeking. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. To get rules associated with the **Stack Monitoring** feature, use the `monitoring_user` built-in role. operationId: getRule parameters: - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "200": content: @@ -117,34 +131,16 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Object is not found. - servers: - - url: https://localhost:5601 summary: Retrieves a rule by its identifier. tags: - alerting post: description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you create a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If a user with different privileges updates the rule, its behavior might change. - operationId: createRule + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. + operationId: createRuleId parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: | An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. explode: false @@ -152,15 +148,20 @@ paths: name: ruleId required: true schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 type: string style: simple requestBody: content: application/json: examples: - createCaseRequest: - $ref: '#/components/examples/create_rule_request' + createEsQueryEsqlRuleIdRequest: + $ref: '#/components/examples/create_es_query_esql_rule_request' + createEsQueryRuleIdRequest: + $ref: '#/components/examples/create_es_query_rule_request' + createEsQueryKqlRuleIdRequest: + $ref: '#/components/examples/create_es_query_kql_rule_request' + createIndexThreholdRuleIdRequest: + $ref: '#/components/examples/create_index_threshold_rule_request' schema: $ref: '#/components/schemas/create_rule_request' required: true @@ -169,8 +170,14 @@ paths: content: application/json: examples: - createRuleResponse: - $ref: '#/components/examples/create_rule_response' + createEsQueryEsqlRuleIdResponse: + $ref: '#/components/examples/create_es_query_esql_rule_response' + createEsQueryRuleIdResponse: + $ref: '#/components/examples/create_es_query_rule_response' + createEsQueryKqlRuleIdResponse: + $ref: '#/components/examples/create_es_query_kql_rule_response' + createIndexThresholdRuleIdResponse: + $ref: '#/components/examples/create_index_threshold_rule_response' schema: $ref: '#/components/schemas/rule_response_properties' description: Indicates a successful call. @@ -186,48 +193,22 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Object is not found. - servers: - - url: https://localhost:5601 - summary: Creates a rule. + summary: Creates a rule with a specific rule identifier. tags: - alerting put: description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. + To update a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. NOTE: If the API key has different privileges than the key that created or most recently updated the rule, the rule behavior might change. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. operationId: updateRule parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' requestBody: content: application/json: examples: - updateCaseRequest: + updateRuleRequest: $ref: '#/components/examples/update_rule_request' schema: $ref: '#/components/schemas/update_rule_request' @@ -254,46 +235,18 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Object is not found. - servers: - - url: https://localhost:5601 summary: Updates the attributes for a rule. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_disable: post: description: | You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. operationId: disableRule parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -309,46 +262,18 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Object is not found. - servers: - - url: https://localhost:5601 summary: Disables a rule. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_enable: post: description: | - This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. + To enable a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. operationId: enableRule parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -364,31 +289,17 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Object is not found. - servers: - - url: https://localhost:5601 summary: Enables a rule. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rules/_find: get: description: | You must have `read` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rules you're seeking. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. To find rules associated with the **Stack Monitoring** feature, use the `monitoring_user` built-in role. operationId: findRules parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' - description: The default operator to use for the simple_query_string. - example: OR explode: true in: query name: default_search_operator @@ -404,6 +315,7 @@ paths: required: false schema: items: + nullable: true type: string type: array style: form @@ -414,6 +326,7 @@ paths: name: filter required: false schema: + nullable: true type: string style: form - description: Filters the rules that have a relation with the reference objects @@ -426,7 +339,6 @@ paths: $ref: '#/components/schemas/findRules_has_reference_parameter' style: form - description: The page number to return. - example: 1 explode: true in: query name: page @@ -436,7 +348,6 @@ paths: type: integer style: form - description: The number of rules to return per page. - example: 20 explode: true in: query name: per_page @@ -460,7 +371,8 @@ paths: name: search_fields required: false schema: - $ref: '#/components/schemas/findRules_search_fields_parameter' + nullable: true + type: string style: form - description: | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. @@ -469,10 +381,10 @@ paths: name: sort_field required: false schema: + nullable: true type: string style: form - description: Determines the sort order. - example: asc explode: true in: query name: sort_order @@ -491,6 +403,8 @@ paths: examples: findRulesResponse: $ref: '#/components/examples/find_rules_response' + findConditionalActionRulesResponse: + $ref: '#/components/examples/find_rules_response_conditional_action' schema: $ref: '#/components/schemas/findRules_200_response' description: Indicates a successful call. @@ -500,29 +414,16 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Retrieves information about rules. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/_health: get: description: | You must have `read` privileges for the **Management > Stack Rules** feature or for at least one of the **Analytics > Discover**, **Analytics > Machine Learning**, **Observability**, or **Security** features. operationId: getAlertingHealth parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' responses: "200": content: @@ -542,24 +443,13 @@ paths: summary: Retrieves the health status of the alerting framework. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule_types: get: description: | If you have `read` privileges for one or more Kibana features, the API response contains information about the appropriate rule types. For example, there are rule types associated with the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, and **Security** features. To get rule types associated with the **Stack Monitoring** feature, use the `monitoring_user` built-in role. operationId: getRuleTypes parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' responses: "200": content: @@ -581,41 +471,15 @@ paths: summary: Retrieves a list of rule types. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all: post: description: | This API snoozes the notifications for the rule indefinitely. The rule checks continue to occur but alerts will not trigger any actions. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. operationId: muteAllAlerts parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -625,46 +489,18 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Mutes all alerts. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all: post: description: | If the rule has its notifications snoozed indefinitely, this API cancels the snooze. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. operationId: unmuteAllAlerts parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -674,60 +510,40 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Unmutes all alerts. tags: - alerting - servers: - - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_update_api_key: + post: + description: The new API key has the credentials of the user that submits the + request. + operationId: updateRuleAPIKey + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + "200": + description: Indicates a successful call. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + summary: Updates the API key for a rule. + tags: + - alerting /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute: post: - description: "You must have `all` privileges for the appropriate Kibana features,\ - \ depending on the `consumer` and `rule_type_id` of the rule. For example,\ - \ the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine\ - \ Learning** features, **Observability**, and **Security** features. If the\ - \ rule has actions, you must also have `read` privileges for the **Management\ - \ > Actions and Connectors** feature. \n" + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. operationId: muteAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the alert. The identifier is generated by the - rule and might be any arbitrary string. - explode: false - in: path - name: alertId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/alert_id' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -737,60 +553,19 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Mutes an alert. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute: post: - description: "You must have `all` privileges for the appropriate Kibana features,\ - \ depending on the `consumer` and `rule_type_id` of the rule. For example,\ - \ the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine\ - \ Learning** features, **Observability**, and **Security** features. If the\ - \ rule has actions, you must also have `read` privileges for the **Management\ - \ > Actions and Connectors** feature. \n" + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. operationId: unmuteAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: An identifier for the alert. The identifier is generated by the - rule and might be any arbitrary string. - explode: false - in: path - name: alertId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: An identifier for the rule. - explode: false - in: path - name: ruleId - required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/alert_id' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' responses: "204": description: Indicates a successful call. @@ -800,13 +575,9 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Unmutes an alert. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}: delete: deprecated: true @@ -814,33 +585,16 @@ paths: Deprecated in 7.13.0. Use the delete rule API instead. WARNING: After you delete an alert, you cannot recover it. operationId: legaryDeleteAlert parameters: - - description: Cross-site request forgery protection + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + - description: The identifier for the alert. explode: false - in: header - name: kbn-xsrf + in: path + name: alertId required: true schema: type: string style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple - - description: The identifier for the alert. - explode: false - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - style: simple responses: "204": description: Indicates a successful call. @@ -850,8 +604,6 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Permanently removes an alert. tags: - alerting @@ -860,23 +612,13 @@ paths: description: Deprecated in 7.13.0. Use the get rule API instead. operationId: legacyGetAlert parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple responses: @@ -892,8 +634,6 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Retrieves an alert by its identifier. tags: - alerting @@ -902,14 +642,7 @@ paths: description: Deprecated in 7.13.0. Use the create rule API instead. operationId: legacyCreateAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' - description: "An UUID v1 or v4 identifier for the alert. If this parameter\ \ is omitted, the identifier is randomly generated." explode: false @@ -917,19 +650,9 @@ paths: name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default type: string style: simple + - $ref: '#/components/parameters/space_id' requestBody: content: application/json: @@ -949,8 +672,6 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Create an alert. tags: - alerting @@ -959,31 +680,14 @@ paths: description: Deprecated in 7.13.0. Use the update rule API instead. operationId: legacyUpdateAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple requestBody: @@ -1005,44 +709,23 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Updates the attributes for an alert. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_disable: post: deprecated: true description: Deprecated in 7.13.0. Use the disable rule API instead. operationId: legacyDisableAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple responses: @@ -1054,44 +737,23 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Disables an alert. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_enable: post: deprecated: true description: Deprecated in 7.13.0. Use the enable rule API instead. operationId: legacyEnableAlert parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple responses: @@ -1103,44 +765,23 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Enables an alert. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_mute_all: post: deprecated: true description: Deprecated in 7.13.0. Use the mute all alerts API instead. operationId: legacyMuteAllAlertInstances parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple responses: @@ -1152,44 +793,23 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Mutes all alert instances. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_unmute_all: post: deprecated: true description: Deprecated in 7.13.0. Use the unmute all alerts API instead. operationId: legacyUnmuteAllAlertInstances parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: The identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple responses: @@ -1201,13 +821,9 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Unmutes all alert instances. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/_find: get: deprecated: true @@ -1215,18 +831,8 @@ paths: Deprecated in 7.13.0. Use the find rules API instead. NOTE: Alert `params` are stored as a flattened field type and analyzed as keywords. As alerts change in Kibana, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data. operationId: legacyFindAlerts parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' - description: The default operator to use for the `simple_query_string`. - example: OR explode: true in: query name: default_search_operator @@ -1261,10 +867,9 @@ paths: name: has_reference required: false schema: - $ref: '#/components/schemas/findRules_has_reference_parameter' + $ref: '#/components/schemas/legacyFindAlerts_has_reference_parameter' style: form - description: The page number to return. - example: 1 explode: true in: query name: page @@ -1274,7 +879,6 @@ paths: type: integer style: form - description: The number of alerts to return per page. - example: 20 explode: true in: query name: per_page @@ -1290,6 +894,7 @@ paths: name: search required: false schema: + nullable: true type: string style: form - description: The fields to perform the `simple_query_string` parsed query @@ -1299,7 +904,8 @@ paths: name: search_fields required: false schema: - $ref: '#/components/schemas/findRules_search_fields_parameter' + nullable: true + type: string style: form - description: | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. @@ -1311,7 +917,6 @@ paths: type: string style: form - description: Determines the sort order. - example: asc explode: true in: query name: sort_order @@ -1336,13 +941,9 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Retrieves a paginated set of alerts. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/_health: get: deprecated: true @@ -1350,16 +951,7 @@ paths: instead. operationId: legacyGetAlertingHealth parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' responses: "200": content: @@ -1376,24 +968,13 @@ paths: summary: Retrieves the health status of the alerting framework. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/list_alert_types: get: deprecated: true description: Deprecated in 7.13.0. Use the get rule types API instead. operationId: legacyGetAlertTypes parameters: - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/space_id' responses: "200": content: @@ -1412,39 +993,20 @@ paths: summary: Retrieves a list of alert types. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute: post: deprecated: true description: Deprecated in 7.13.0. Use the mute alert API instead. operationId: legacyMuteAlertInstance parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: An identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple - description: An identifier for the alert instance. @@ -1453,7 +1015,6 @@ paths: name: alertInstanceId required: true schema: - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 type: string style: simple responses: @@ -1465,44 +1026,23 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Mutes an alert instance. tags: - alerting - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute: post: deprecated: true description: Deprecated in 7.13.0. Use the unmute alert API instead. operationId: legacyUnmuteAlertInstance parameters: - - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - - description: "An identifier for the space. If `/s/` and the identifier are\ - \ omitted from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - description: An identifier for the alert. explode: false in: path name: alertId required: true schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 type: string style: simple - description: An identifier for the alert instance. @@ -1511,7 +1051,6 @@ paths: name: alertInstanceId required: true schema: - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 type: string style: simple responses: @@ -1523,225 +1062,347 @@ paths: schema: $ref: '#/components/schemas/401_response' description: Authorization information is missing or invalid. - servers: - - url: https://localhost:5601 summary: Unmutes an alert instance. tags: - alerting - servers: - - url: https://localhost:5601 components: examples: - get_rule_response: - summary: The get rule API returns a JSON object that contains details about - the rule. + create_es_query_esql_rule_request: + summary: Create an Elasticsearch query rule that uses Elasticsearch Query Language + (ES|QL). value: - id: 31697a40-7b36-11ed-aa79-f742c05329b2 - consumer: alerts - tags: - - cpu - name: my alert - enabled: true - throttle: null - schedule: - interval: 1m + name: my Elasticsearch query ESQL rule params: - aggType: avg - termSize: 6 + searchType: esqlQuery + esqlQuery: + esql: "FROM kibana_sample_data_logs | KEEP bytes, clientip, host, geo.dest\ + \ | where geo.dest != \"GB\" | STATS sumbytes = sum(bytes) by clientip,\ + \ host | WHERE sumbytes > 5000 | SORT sumbytes desc | LIMIT 10" + timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + size: 0 thresholdComparator: '>' - timeWindowSize: 5 - timeWindowUnit: m - groupBy: top threshold: - - 1000 - index: - - test-index - timeField: '@timestamp' - aggField: sheet.version - termField: name.keyword - rule_type_id: .index-threshold - created_by: elastic - updated_by: elastic - created_at: 2022-12-13T22:33:41.163Z - updated_at: 2022-12-13T22:33:41.163Z - api_key_owner: elastic - notify_when: onActionGroupChange - muted_alert_ids: [] - mute_all: false - scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2 - execution_status: - status: ok - last_execution_date: 2022-12-13T22:33:44.388Z - last_duration: 83 + - 0 + consumer: stackAlerts + rule_type_id: .es-query + schedule: + interval: 1d actions: - - group: threshold met - id: 1007a0c0-7a6e-11ed-89d5-abec321c0def + - group: query matched + id: d0db1fe0-78d6-11ee-9177-f7d404c8c945 params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date} - connector_type_id: .server-log - last_run: - alerts_count: - new: 0 - ignored: 0 - recovered: 0 - active: 0 - outcome_msg: null - warning: null - outcome: succeeded - next_run: 2022-12-13T22:34:44.314Z - update_rule_request: - summary: Update an index threshold rule. + Elasticsearch query rule '{{rule.name}}' is active: + - Value: {{context.value}} - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} - Link: {{context.link}} + frequency: + summary: false + notify_when: onActiveAlert + create_es_query_rule_request: + summary: Create an Elasticsearch query rule that uses Elasticsearch query domain + specific language (DSL) to define its query and a server log connector to + send notifications. value: actions: - - frequency: - summary: false - notify_when: onActionGroupChange - group: threshold met - id: 96b668d0-a1b6-11ed-afdf-d39a49596974 + - group: query matched params: level: info - message: |- - alert {{alertName}} is active for group {{context.group}}: - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date}} + message: "The system has detected {{alerts.new.count}} new, {{alerts.ongoing.count}}\ + \ ongoing, and {{alerts.recovered.count}} recovered alerts." + id: fdbece50-406c-11ee-850e-c71febc4ca7f + frequency: + throttle: 1d + summary: true + notify_when: onThrottleInterval + - group: recovered + params: + level: info + message: Recovered + id: fdbece50-406c-11ee-850e-c71febc4ca7f + frequency: + summary: false + notify_when: onActionGroupChange + consumer: alerts + name: my Elasticsearch query rule params: - aggField: sheet.version - aggType: avg + esQuery: "\"\"\"{\"query\":{\"match_all\" : {}}}\"\"\"" index: - - .test-index - groupBy: top - termField: name.keyword - termSize: 6 + - kibana_sample_data_logs + size: 100 threshold: - - 1000 + - 100 thresholdComparator: '>' timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + rule_type_id: .es-query + schedule: + interval: 1d + create_es_query_kql_rule_request: + summary: Create an Elasticsearch query rule that uses Kibana query language + (KQL). + value: + consumer: alerts + name: my Elasticsearch query KQL rule + params: + aggType: count + excludeHitsFromPreviousRun: true + groupBy: all + searchConfiguration: + query: + query: "\"\"geo.src : \"US\" \"\"" + language: kuery + index: 90943e30-9a47-11e8-b64d-95841ca0b247 + searchType: searchSource + size: 100 + threshold: + - 1000 + thresholdComparator: '>' timeWindowSize: 5 timeWindowUnit: m - name: new name + rule_type_id: .es-query schedule: interval: 1m - tags: [] - throttle: null - update_rule_response: - summary: The update rule API returns a JSON object that contains details about - the rule. + create_index_threshold_rule_request: + summary: Create an index threshold rule. value: - id: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + actions: + - id: 48de3460-f401-11ed-9f8e-399c75a2deeb + frequency: + notify_when: onActionGroupChange + summary: false + group: threshold met + params: + level: info + message: |- + Rule '{{rule.name}}' is active for group '{{context.group}}': + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date}} + alert_delay: + active: 3 consumer: alerts - tags: [] - name: new name - enabled: true - throttle: null - running: false - schedule: - interval: 10m + name: my rule params: - index: - - .updated-index - timeField: '@timestamp' - groupBy: top aggType: avg + termSize: 6 + thresholdComparator: '>' timeWindowSize: 5 timeWindowUnit: m - thresholdComparator: '>' + groupBy: top threshold: - 1000 + index: + - .test-index + timeField: '@timestamp' aggField: sheet.version termField: name.keyword - termSize: 6 - api_key_owner: elastic - created_by: elastic - updated_by: elastic rule_type_id: .index-threshold - scheduled_task_id: 4c5eda00-e74f-11ec-b72f-5b18752ff9ea - created_at: 2023-01-31T23:03:33.127Z - updated_at: 2023-01-31T23:55:27.314Z - mute_all: false - muted_alert_ids: [] - execution_status: - status: ok - last_execution_date: 2023-01-31T23:48:42.499Z - last_duration: 52 + schedule: + interval: 1m + tags: + - cpu + create_tracking_containment_rule_request: + summary: Create a tracking containment rule. + value: + consumer: alerts + name: my tracking rule + params: + index: kibana_sample_data_logs + dateField": '@timestamp' + geoField: geo.coordinates + entity: agent.keyword + boundaryType: entireIndex + boundaryIndexTitle: boundary* + boundaryGeoField: location + boundaryNameField: name + indexId: 90943e30-9a47-11e8-b64d-95841ca0b247 + boundaryIndexId: 0cd90abf-abe7-44c7-909a-f621bbbcfefc + rule_type_id: .geo-containment + schedule: + interval: 1h + create_es_query_esql_rule_response: + summary: The create rule API returns a JSON object that contains details about + the rule. + value: + id: e0d62360-78e8-11ee-9177-f7d404c8c945 + enabled: true + name: my Elasticsearch query ESQL rule + tags: [] + rule_type_id: .es-query + consumer: stackAlerts + schedule: + interval: 1d actions: - - group: threshold met + - group: query matched + id: d0db1fe0-78d6-11ee-9177-f7d404c8c945 params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date} - id: 96b668d0-a1b6-11ed-afdf-d39a49596974 + Elasticsearch query rule '{{rule.name}}' is active: + - Value: {{context.value}} - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} - Link: {{context.link}} connector_type_id: .server-log frequency: summary: false + notify_when: onActiveAlert throttle: null - notify_when: onActionGroupChange - last_run: - alerts_count: - new: 0 - ignored: 0 - recovered: 0 - active: 0 - outcome_msg: null - warning: null - outcome: succeeded - next_run: 2023-01-31T23:49:42.432Z - create_rule_request: - summary: Create an index threshold rule. + uuid: bfe370a3-531b-4855-bbe6-ad739f578844 + params: + searchType: esqlQuery + esqlQuery: + esql: "FROM kibana_sample_data_logs | keep bytes, clientip, host, geo.dest\ + \ | WHERE geo.dest != \"GB\" | stats sumbytes = sum(bytes) by clientip,\ + \ host | WHERE sumbytes > 5000 | sort sumbytes desc | limit 10" + timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + size: 0 + thresholdComparator: '>' + threshold: + - 0 + excludeHitsFromPreviousRun": "true," + aggType: count + groupBy: all + scheduled_task_id: e0d62360-78e8-11ee-9177-f7d404c8c945 + created_by: elastic + updated_by: "elastic\"," + created_at: 2023-11-01T19:00:10.453Z + updated_at: 2023-11-01T19:00:10.453Z + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + mute_all: false + notify_when: null + muted_alert_ids: [] + execution_status: + status: pending + last_execution_date: 2023-11-01T19:00:10.453Z + revision: 0 + running: false + create_es_query_rule_response: + summary: The create rule API returns a JSON object that contains details about + the rule. value: + id: 58148c70-407f-11ee-850e-c71febc4ca7f + enabled: true + name: my Elasticsearch query rule + tags: [] + rule_type_id: .es-query + consumer: alerts + schedule: + interval: 1d actions: - - id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 + - group: query matched + id: fdbece50-406c-11ee-850e-c71febc4ca7f + params: + level: info + message: "The system has detected {{alerts.new.count}} new, {{alerts.ongoing.count}}\ + \ ongoing, and {{alerts.recovered.count}} recovered alerts." + connector_type_id: .server-log frequency: - notify_when: onActionGroupChange - summary: false - group: threshold met + summary: true + notify_when: onThrottleInterval + throttle: 1d + uuid: 53f3c2a3-e5d0-4cfa-af3b-6f0881385e78 + - group: recovered + id: fdbece50-406c-11ee-850e-c71febc4ca7f params: level: info - message: |- - alert '{{alertName}}' is active for group '{{context.group}}': - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date}} - consumer: alerts - name: my rule + message: Recovered + connector_type_id: .server-log + frequency: + summary: false + notify_when: onActionGroupChange + throttle: null + uuid: 2324e45b-c0df-45c7-9d70-4993e30be758 params: - aggType: avg - termSize: 6 thresholdComparator: '>' - timeWindowSize: 5 - timeWindowUnit: m - groupBy: top + timeWindowSize: 1 + timeWindowUnit: d threshold: - - 1000 - index: - - .test-index + - 100 + size: 100 timeField: '@timestamp' - aggField: sheet.version - termField: name.keyword - rule_type_id: .index-threshold + index: + - kibana_sample_data_logs + esQuery: "\"\"\"{\"query\":{\"match_all\" : {}}}\"\"\"" + excludeHitsFromPreviousRun: true + aggType: count + groupBy: all + searchType: esQuery + scheduled_task_id: 58148c70-407f-11ee-850e-c71febc4ca7f + created_by: elastic + updated_by: elastic + created_at: 2023-08-22T00:03:38.263Z + updated_at: 2023-08-22T00:03:38.263Z + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + mute_all: false + notify_when: null + muted_alert_ids: [] + execution_status: + status: pending + last_execution_date: 2023-08-22T00:03:38.263Z + revision: 0 + running: false + create_es_query_kql_rule_response: + summary: The create rule API returns a JSON object that contains details about + the rule. + value: + id: 7bd506d0-2284-11ee-8fad-6101956ced88 + enabled: true + name: my Elasticsearch query KQL rule" + tags: [] + rule_type_id: .es-query + consumer: alerts schedule: interval: 1m - tags: - - cpu - create_rule_response: + actions: [] + params: + searchConfiguration: + query: + query: "\"\"geo.src : \"US\" \"\"" + language: kuery + index: 90943e30-9a47-11e8-b64d-95841ca0b247 + searchType: searchSource + timeWindowSize: 5 + timeWindowUnit: m + threshold: + - 1000 + thresholdComparator: '>' + size: 100 + aggType: count + groupBy: all + excludeHitsFromPreviousRun: true + created_by: elastic + updated_by: elastic + created_at: 2023-07-14T20:24:50.729Z + updated_at: 2023-07-14T20:24:50.729Z + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: 7bd506d0-2284-11ee-8fad-6101956ced88 + execution_status: + status: pending + last_execution_date: 2023-07-14T20:24:50.729Z + revision: 0 + running: false + create_index_threshold_rule_response: summary: The create rule API returns a JSON object that contains details about the rule. value: actions: - group: threshold met id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 + uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d + connector_type_id: .server-log frequency: notify_when: onActionGroupChange summary: false @@ -1749,11 +1410,14 @@ components: params: level: info message: |- - alert {{alertName}} is active for group {{context.group} : + Rule {{rule.name}} is active for group {{context.group} : - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} + alert_delay: + active: 3 + api_key_created_by_user: false api_key_owner: elastic consumer: alerts created_at: 2022-06-08T17:20:31.632Z @@ -1766,7 +1430,7 @@ components: muted_alert_ids: [] mute_all: false name: my rule - notify_when: onActionGroupChange + notify_when: null params: aggType: avg termSize: 6 @@ -1781,6 +1445,7 @@ components: timeField: '@timestamp' aggField: sheet.version termField: name.keyword + revision: 0 rule_type_id: .index-threshold running: false schedule: @@ -1791,6 +1456,233 @@ components: throttle: null updated_at: 2022-06-08T17:20:31.632Z updated_by: elastic + create_tracking_containment_rule_response: + summary: The create rule API returns a JSON object that contains details about + the rule. + value: + id: b6883f9d-5f70-4758-a66e-369d7c26012f + name: my tracking rule + tags: [] + enabled: true + consumer: alerts + throttle: null + revision: 1 + running: false + schedule: + interval: 1h + params: + index: kibana_sample_data_logs + dateField: '@timestamp' + geoField: geo.coordinates + entity: agent.keyword + boundaryType: entireIndex + boundaryIndexTitle: boundary* + boundaryGeoField: location + boundaryNameField: name + indexId: 90943e30-9a47-11e8-b64d-95841ca0b247 + boundaryIndexId: 0cd90abf-abe7-44c7-909a-f621bbbcfefc + rule_type_id: .geo-containment + created_by: elastic + updated_by: elastic + created_at: 2024-02-14T19:52:55.920Z + updated_at: 2024-02-15T03:24:32.574Z + api_key_owner: elastic + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: b6883f9d-5f70-4758-a66e-369d7c26012f + execution_status: + status: ok + last_execution_date: 2024-02-15T03:25:38.125Z + last_duration: 74 + actions: [] + last_run: + alerts_count: + active: 0 + new: 0 + recovered: 0 + ignored: 0 + outcome_msg: null + outcome_order: 0 + outcome: succeeded + warning: null + next_run: 2024-02-15T03:26:38.033Z + api_key_created_by_user: false + get_rule_response: + summary: The get rule API returns a JSON object that contains details about + the rule. + value: + id: 31697a40-7b36-11ed-aa79-f742c05329b2 + consumer: alerts + tags: + - cpu + name: my alert + enabled: true + throttle: null + schedule: + interval: 1m + params: + aggType: avg + termSize: 6 + thresholdComparator: '>' + timeWindowSize: 5 + timeWindowUnit: m + groupBy: top + threshold: + - 1000 + index: + - test-index + timeField: '@timestamp' + aggField: sheet.version + termField: name.keyword + revision: 1 + rule_type_id: .index-threshold + created_by: elastic + updated_by: elastic + created_at: 2022-12-13T22:33:41.163Z + updated_at: 2022-12-13T22:33:41.163Z + api_key_owner: elastic + notify_when: null + muted_alert_ids: [] + mute_all: false + scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2 + execution_status: + status: ok + last_execution_date: 2022-12-13T22:33:44.388Z + last_duration: 83 + actions: + - group: threshold met + id: 1007a0c0-7a6e-11ed-89d5-abec321c0def + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 + params: + level: info + message: |- + Rule {{rule.name}} is active for group {{context.group}}: + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date} + connector_type_id: .server-log + connector_type_id: .server-log + frequency: + throttle: null + summary: false + notify_when: onActionGroupChange + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: 2022-12-13T22:34:44.314Z + api_key_created_by_user: false + update_rule_request: + summary: Update an index threshold rule. + value: + actions: + - frequency: + summary: false + notify_when: onActionGroupChange + group: threshold met + id: 96b668d0-a1b6-11ed-afdf-d39a49596974 + params: + level: info + message: |- + Rule {{rule.name}} is active for group {{context.group}}: + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date}} + params: + aggField: sheet.version + aggType: avg + index: + - .updated-index + groupBy: top + termField: name.keyword + termSize: 6 + threshold: + - 1000 + thresholdComparator: '>' + timeField: '@timestamp' + timeWindowSize: 5 + timeWindowUnit: m + name: new name + schedule: + interval: 1m + tags: [] + update_rule_response: + summary: The update rule API returns a JSON object that contains details about + the rule. + value: + id: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + consumer: alerts + tags: [] + name: new name + enabled: true + throttle: null + revision: 1 + running: false + schedule: + interval: 1m + params: + index: + - .updated-index + timeField: '@timestamp' + groupBy: top + aggType: avg + timeWindowSize: 5 + timeWindowUnit: m + thresholdComparator: '>' + threshold: + - 1000 + aggField: sheet.version + termField: name.keyword + termSize: 6 + api_key_owner: elastic + created_by: elastic + updated_by: elastic + rule_type_id: .index-threshold + scheduled_task_id: 4c5eda00-e74f-11ec-b72f-5b18752ff9ea + created_at: 2024-03-26T23:13:20.985Z + updated_at: 2024-03-26T23:22:59.949Z + mute_all: false + muted_alert_ids: [] + execution_status: + status: ok + last_execution_date: 2024-03-26T23:22:51.390Z + last_duration: 52 + actions: + - group: threshold met + params: + level: info + message: |- + Rule {{rule.name}} is active for group {{context.group}}: + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date} + id: 96b668d0-a1b6-11ed-afdf-d39a49596974 + uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d + connector_type_id: .server-log + frequency: + summary: false + throttle: null + notify_when: onActionGroupChange + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: 2024-03-26T23:23:51.316Z + api_key_created_by_user: false find_rules_response: summary: Retrieve information about a rule. value: @@ -1821,13 +1713,13 @@ components: timeField: '@timestamp' aggField: sheet.version termField: name.keyword + revision: 1 rule_type_id: .index-threshold created_by: elastic updated_by: elastic created_at: 2022-12-05T23:40:33.132Z updated_at: 2022-12-05T23:40:33.132Z api_key_owner: elastic - notify_when: onActionGroupChange mute_all: false muted_alert_ids: [] scheduled_task_id: 3583a470-74f6-11ed-9801-35303b735aef @@ -1838,15 +1730,20 @@ components: actions: - id: 9dca3e00-74f5-11ed-9801-35303b735aef group: threshold met + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: + Rule {{rule.name}} is active for group {{context.group}}: - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} connector_type_id: .server-log + frequency: + summary: false + notify_when: onActionGroupChange + throttle: null last_run: alerts_count: new: 0 @@ -1857,6 +1754,129 @@ components: warning: null outcome: succeeded next_run: 2022-12-06T01:45:23.912Z + api_key_created_by_user: false + find_rules_response_conditional_action: + summary: Retrieve information about a rule that has conditional actions. + value: + page: 1 + total: 1 + per_page: 10 + data: + - id: 6107a8f0-f401-11ed-9f8e-399c75a2deeb + name: security_rule + consumer: siem + enabled: true + tags: [] + throttle: null + revision: 1 + running: false + schedule: + interval: 1m + params: + author: [] + description: A security threshold rule. + ruleId: an_internal_rule_id + falsePositives: [] + from: now-3660s + immutable: false + license: "" + outputIndex: "" + meta: + from: 1h + kibana_siem_app_url: https://localhost:5601/app/security + maxSignals: 100 + riskScore: 21 + riskScoreMapping: [] + severity: low + severityMapping: [] + threat: [] + to: now + references: [] + version: 1 + exceptionsList: [] + type: threshold + language: kuery + index: + - kibana_sample_data_logs + query: '*' + filters: [] + threshold: + field: + - bytes + value: 1 + cardinality: [] + rule_type_id: siem.thresholdRule + created_by: elastic + updated_by: elastic + created_at: 2023-05-16T15:50:28.358Z + updated_at: 2023-05-16T20:25:42.559Z + api_key_owner: elastic + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: 6107a8f0-f401-11ed-9f8e-399c75a2deeb + execution_status: + status: ok + last_execution_date: 2023-05-16T20:26:49.590Z + last_duration: 166 + actions: + - group: default + id: 49eae970-f401-11ed-9f8e-399c75a2deeb + params: + documents: + - rule_id: + '[object Object]': null + rule_name: + '[object Object]': null + alert_id: + '[object Object]': null + context_message: + '[object Object]': null + connector_type_id: .index + frequency: + summary: true + notify_when: onActiveAlert + throttle: null + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 + alerts_filter: + timeframe: + days: + - 7 + timezone: UTC + hours: + start: 08:00 + end: 17:00 + query: + kql: "" + filters: + - meta: + disabled: false + negate: false + alias: null + index: c4bdca79-e69e-4d80-82a1-e5192c621bea + key: client.geo.region_iso_code + field: client.geo.region_iso_code + params: + query: CA-QC + type: phrase + $state: + store: appState + query: + match_phrase: + client.geo.region_iso_code: CA-QC + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: + - Rule execution completed successfully + outcome_order: 0 + warning: null + outcome: succeeded + next_run: 2023-05-16T20:27:49.507Z + api_key_created_by_user: false get_health_response: summary: Retrieve information about the health of the alerting framework. value: @@ -1872,27 +1892,105 @@ components: read_health: status: ok timestamp: 2023-01-13T01:28:00.280Z - alerting_framework_heath: - _deprecated: "This state property has a typo, use \"alerting_framework_health\"\ - \ instead." - decryption_health: - status: ok - timestamp: 2023-01-13T01:28:00.280Z - execution_health: - status: ok - timestamp: 2023-01-13T01:28:00.280Z - read_health: - status: ok - timestamp: 2023-01-13T01:28:00.280Z get_rule_types_response: summary: Retrieve rule types associated with Kibana machine learning features value: - id: xpack.ml.anomaly_detection_alert + name: Anomaly detection alert + category: management + producer: ml + alerts: + context: ml.anomaly-detection + mappings: + fieldMap: + kibana.alert.job_id: + type: keyword + array: false + required: true + kibana.alert.anomaly_score: + type: double + array: false + required: false + kibana.alert.is_interim: + type: boolean + array: false + required: false + kibana.alert.anomaly_timestamp: + type: date + array: false + required: false + kibana.alert.top_records: + type: object + array: true + required: false + dynamic: false + properties: + job_id: + type: keyword + record_score: + type: double + initial_record_score: + type: double + detector_index: + type: integer + is_interim: + type: boolean + timestamp: + type: date + partition_field_name: + type: keyword + partition_field_value: + type: keyword + over_field_name: + type: keyword + over_field_value: + type: keyword + by_field_name: + type: keyword + by_field_value: + type: keyword + function: + type: keyword + typical: + type: double + actual: + type: double + field_name: + type: keyword + kibana.alert.top_influencers: + type: object + array: true + required: false + dynamic: false + properties: + job_id: + type: keyword + influencer_field_name: + type: keyword + influencer_field_value: + type: keyword + influencer_score: + type: double + initial_influencer_score: + type: double + is_interim: + type: boolean + timestamp: + type: date + shouldWrite: true + enabled_in_license: true + recovery_action_group: + id: recovered + name: Recovered action_groups: - id: anomaly_score_match name: Anomaly score matched the condition - id: recovered name: Recovered + default_action_group_id: anomaly_score_match + minimum_license_required: platinum + is_exportable: true + rule_task_timeout: 5m action_variables: context: - name: timestamp @@ -1914,68 +2012,115 @@ components: - name: anomalyExplorerUrl description: URL to open in the Anomaly Explorer useWithTripleBracesInTemplates: true - params: [] state: [] + params: [] authorized_consumers: alerts: + read: true + all: true + stackAlerts: + read: true + all: true + slo: + read: true + all: true + ml: + read: true + all: true + uptime: + read: true + all: true + infrastructure: + read: true + all: true + logs: + read: true + all: true + monitoring: + read: true + all: true + siem: + read: true all: true + apm: read: true - ml: all: true + discover: read: true - default_action_group_id: anomaly_score_match + all: true does_set_recovery_context: true - enabled_in_license: true - is_exportable: true - minimum_license_required: platinum - name: Anomaly detection alert + has_alerts_mappings: true + has_fields_for_a_a_d: false + - id: xpack.ml.anomaly_detection_jobs_health + name: Anomaly detection jobs health + category: management producer: ml + enabled_in_license: true recovery_action_group: id: recovered name: Recovered - rule_task_timeout: 5m - - id: xpack.ml.anomaly_detection_jobs_health action_groups: - id: anomaly_detection_realtime_issue name: Issue detected - id: recovered name: Recovered + default_action_group_id: anomaly_detection_realtime_issue + minimum_license_required: platinum + is_exportable: true + rule_task_timeout: 5m action_variables: context: - name: results description: Results of the rule execution - name: message description: Alert info message - params: [] state: [] + params: [] authorized_consumers: alerts: + read: true + all: true + stackAlerts: + read: true all: true + slo: read: true + all: true ml: + read: true all: true + uptime: read: true - default_action_group_id: anomaly_detection_realtime_issue + all: true + infrastructure: + read: true + all: true + logs: + read: true + all: true + monitoring: + read: true + all: true + siem: + read: true + all: true + apm: + read: true + all: true + discover: + read: true + all: true does_set_recovery_context: true - enabled_in_license: true - is_exportable: true - minimum_license_required: platinum - name: Anomaly detection jobs health - producer: ml - recovery_action_group: - id: recovered - name: Recovered - rule_task_timeout: 5m + has_alerts_mappings: false + has_fields_for_a_a_d: false parameters: - rule_id: - description: An identifier for the rule. + kbn_xsrf: + description: Cross-site request forgery protection explode: false - in: path - name: ruleId + in: header + name: kbn-xsrf required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string + schema: {} style: simple space_id: description: "An identifier for the space. If `/s/` and the identifier are omitted\ @@ -1984,18 +2129,15 @@ components: in: path name: spaceId required: true - schema: - example: default - type: string + schema: {} style: simple - kbn_xsrf: - description: Cross-site request forgery protection + rule_id: + description: An identifier for the rule. explode: false - in: header - name: kbn-xsrf + in: path + name: ruleId required: true - schema: - type: string + schema: {} style: simple alert_id: description: An identifier for the alert. The identifier is generated by the @@ -2004,183 +2146,362 @@ components: in: path name: alertId required: true - schema: - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 - type: string + schema: {} style: simple schemas: - notify_when: + filter: + description: A filter written in Elasticsearch Query Domain Specific Language + (DSL) as defined in the `kbn-es-query` package. + example: + $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + properties: + meta: + $ref: '#/components/schemas/filter_meta' + query: + type: object + $state: + type: object + notify_when_action: description: | - Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. + Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. NOTE: You cannot specify `notify_when` at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. enum: - onActionGroupChange - onActiveAlert - onThrottleInterval - example: onActiveAlert type: string - throttle: - description: "The throttle interval, which defines how often an alert generates\ - \ repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`.\ - \ It is specified in seconds, minutes, hours, or days." - example: 10m + throttle_action: + description: | + The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. nullable: true type: string actions: - default: [] items: $ref: '#/components/schemas/actions_inner' - nullable: true - required: - - group - - id - - params type: array + notify_when: + deprecated: true + description: | + Deprecated in 8.13.0. Use the `notify_when` property in the action `frequency` object instead. Indicates how often alerts generate actions. NOTE: You cannot specify `notify_when` at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + enum: + - onActionGroupChange + - onActiveAlert + - onThrottleInterval + type: string schedule: description: "The check interval, which specifies how frequently the rule conditions\ \ are checked. The interval is specified in seconds, minutes, hours, or days." example: - interval: 1m + interval: interval properties: interval: - example: 1m type: string - type: object tags: - default: [] - description: The tags for the rule. items: type: string type: array + throttle: + deprecated: true + description: | + Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + nullable: true + type: string + alert_delay: + description: Indicates that an alert occurs only when the specified number of + consecutive runs met the rule conditions. + example: + active: 3 + properties: + active: + description: The number of consecutive runs that must meet the rule conditions. + example: 3 + type: number + required: + - active + create_rule_request: + description: The create rule API request body varies depending on the type of + rule and actions. + properties: + actions: + items: + $ref: '#/components/schemas/actions_inner' + type: array + consumer: + description: | + The name of the application or feature that owns the rule. For example: `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. + type: string + enabled: + description: Indicates whether you want to run the rule on an interval basis + after it is created. + type: boolean + name: + description: "The name of the rule. While this name does not have to be\ + \ unique, a distinctive name can help you identify a rule." + example: cluster_health_rule + type: string + notify_when: + $ref: '#/components/schemas/notify_when' + params: + additionalProperties: true + description: The parameters for the rule. + type: object + rule_type_id: + description: | + The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. + type: string + schedule: + $ref: '#/components/schemas/schedule' + tags: + items: + type: string + type: array + throttle: + deprecated: true + description: | + Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + nullable: true + type: string + alert_delay: + $ref: '#/components/schemas/alert_delay' + required: + - consumer + - name + - params + - rule_type_id + - schedule + title: Create rule request rule_response_properties: example: - throttle: 10m - created_at: 2022-12-05T23:36:58.284Z + throttle: throttle + created_at: 2000-01-23T04:56:07.000+00:00 + api_key_created_by_user: true + enabled: true + running: true + notify_when: notify_when + next_run: 2000-01-23T04:56:07.000+00:00 + updated_at: updated_at + execution_status: + last_execution_date: 2000-01-23T04:56:07.000+00:00 + last_duration: 6 + status: status + scheduled_task_id: scheduled_task_id + id: id + consumer: consumer + alert_delay: + active: 3 last_run: alerts_count: - ignored: 6 - new: 1 - recovered: 5 - active: 0 - outcome_msg: outcome_msg + ignored: 5 + new: 5 + recovered: 2 + active: 1 + outcome_msg: + - outcome_msg + - outcome_msg + outcome_order: 7 warning: warning - outcome: succeeded + outcome: outcome params: key: "" - created_by: elastic - enabled: true + created_by: created_by muted_alert_ids: - muted_alert_ids - muted_alert_ids - rule_type_id: monitoring_alert_cluster_health + rule_type_id: rule_type_id + revision: 9 tags: - tags - tags - running: true - api_key_owner: elastic + api_key_owner: api_key_owner schedule: - interval: 1m - notify_when: onActiveAlert - next_run: 2022-12-06T00:14:43.818Z - updated_at: 2022-12-05T23:36:58.284Z - execution_status: - last_execution_date: 2022-12-06T00:13:43.89Z - last_duration: 55 - status: ok - name: cluster_health_rule - updated_by: elastic - scheduled_task_id: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef - mute_all: false + interval: interval + name: name + updated_by: updated_by + mute_all: true actions: - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + throttle: throttle + notify_when: null + group: group + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - consumer: alerts + throttle: throttle + notify_when: null + group: group properties: actions: - default: [] items: $ref: '#/components/schemas/actions_inner' - nullable: true - required: - - group - - id - - params type: array + alert_delay: + $ref: '#/components/schemas/alert_delay' + api_key_created_by_user: + description: Indicates whether the API key that is associated with the rule + was created by the user. + type: boolean api_key_owner: - example: elastic + description: | + The owner of the API key that is associated with the rule and used to run background tasks. nullable: true type: string consumer: description: "The application or feature that owns the rule. For example,\ \ `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`,\ \ `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`." - example: alerts type: string created_at: description: The date and time that the rule was created. - example: 2022-12-05T23:36:58.284Z format: date-time type: string created_by: description: The identifier for the user that created the rule. - example: elastic nullable: true type: string enabled: description: Indicates whether the rule is currently enabled. - example: true type: boolean execution_status: $ref: '#/components/schemas/rule_response_properties_execution_status' id: description: The identifier for the rule. - example: b530fed0-74f5-11ed-9801-35303b735aef type: string last_run: $ref: '#/components/schemas/rule_response_properties_last_run' muted_alert_ids: items: type: string - nullable: true type: array mute_all: - example: false type: boolean name: description: The name of the rule. - example: cluster_health_rule type: string next_run: - example: 2022-12-06T00:14:43.818Z format: date-time nullable: true type: string notify_when: - $ref: '#/components/schemas/notify_when' + description: Indicates how often alerts generate actions. + nullable: true + type: string params: additionalProperties: true description: The parameters for the rule. type: object + revision: + description: The rule revision number. + type: integer rule_type_id: description: | The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. - example: monitoring_alert_cluster_health type: string running: description: Indicates whether the rule is running. @@ -2188,28 +2509,22 @@ components: schedule: $ref: '#/components/schemas/schedule' scheduled_task_id: - example: b530fed0-74f5-11ed-9801-35303b735aef type: string tags: - default: [] - description: The tags for the rule. items: type: string type: array throttle: - description: "The throttle interval, which defines how often an alert generates\ - \ repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`.\ - \ It is specified in seconds, minutes, hours, or days." - example: 10m + deprecated: true + description: | + Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. nullable: true type: string updated_at: description: The date and time that the rule was updated most recently. - example: 2022-12-05T23:36:58.284Z type: string updated_by: description: The identifier for the user that updated this rule most recently. - example: elastic nullable: true type: string required: @@ -2232,57 +2547,43 @@ components: - updated_at - updated_by title: Rule response properties - type: object "401_response": properties: error: enum: - Unauthorized - example: Unauthorized type: string message: type: string statusCode: enum: - 401 - example: 401 type: integer title: Unsuccessful rule API response - type: object "404_response": properties: error: enum: - Not Found - example: Not Found type: string message: - example: "Saved object [alert/caaad6d0-920c-11ed-b36a-874bd1548a00] not\ - \ found" type: string statusCode: enum: - 404 - example: 404 type: integer - type: object update_rule_request: - description: The update rule API request body varies depending on the type of - rule and actions. + description: | + The update rule API request body varies depending on the type of rule and actions. properties: actions: - default: [] items: $ref: '#/components/schemas/actions_inner' - nullable: true - required: - - group - - id - - params type: array + alert_delay: + $ref: '#/components/schemas/alert_delay' name: description: The name of the rule. - example: cluster_health_rule type: string notify_when: $ref: '#/components/schemas/notify_when' @@ -2293,16 +2594,13 @@ components: schedule: $ref: '#/components/schemas/schedule' tags: - default: [] - description: The tags for the rule. items: type: string type: array throttle: - description: "The throttle interval, which defines how often an alert generates\ - \ repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`.\ - \ It is specified in seconds, minutes, hours, or days." - example: 10m + deprecated: true + description: | + Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. nullable: true type: string required: @@ -2310,75 +2608,85 @@ components: - params - schedule title: Update rule request - type: object - create_rule_request: - description: The create rule API request body varies depending on the type of - rule and actions. + fieldmap_properties: + example: + path: path + array: true + format: format + ignore_above: 0 + index: true + dynamic: true + scaling_factor: 6 + type: scaled_float + properties: + key: + type: type + required: true properties: - actions: - default: [] - items: - $ref: '#/components/schemas/actions_inner' - nullable: true - required: - - group - - id - - params - type: array - consumer: + array: + description: Indicates whether the field is an array. + type: boolean + dynamic: + description: Indicates whether it is a dynamic field mapping. + type: boolean + format: description: | - The name of the application or feature that owns the rule. For example: `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. + Indicates the format of the field. For example, if the `type` is `date_range`, the `format` can be `epoch_millis||strict_date_optional_time`. type: string - enabled: - description: Indicates whether you want to run the rule on an interval basis - after it is created. + ignore_above: + description: Specifies the maximum length of a string field. Longer strings + are not indexed or stored. + type: integer + index: + description: Indicates whether field values are indexed. type: boolean - name: - description: "The name of the rule. While this name does not have to be\ - \ unique, a distinctive name can help you identify a rule." - example: cluster_health_rule + path: + description: TBD type: string - notify_when: - $ref: '#/components/schemas/notify_when' - params: - additionalProperties: true - description: The parameters for the rule. - type: object - rule_type_id: + properties: + additionalProperties: + $ref: '#/components/schemas/fieldmap_properties_properties_value' description: | - The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. + Details about the object properties. This property is applicable when `type` is `object`. + required: + description: Indicates whether the field is required. + type: boolean + scaling_factor: + description: "The scaling factor to use when encoding values. This property\ + \ is applicable when `type` is `scaled_float`. Values will be multiplied\ + \ by this factor at index time and rounded to the closest long value.\ + \ \n" + type: integer + type: + description: Specifies the data type for the field. + example: scaled_float type: string - schedule: - $ref: '#/components/schemas/schedule' - tags: - default: [] - description: The tags for the rule. - items: - type: string - type: array - throttle: - description: "The throttle interval, which defines how often an alert generates\ - \ repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`.\ - \ It is specified in seconds, minutes, hours, or days." - example: 10m - nullable: true + title: Field map objects in the get rule types response + "400_response": + properties: + error: + enum: + - Bad Request type: string + message: + type: string + statusCode: + enum: + - 400 + type: integer required: - - consumer - - name - - params - - rule_type_id - - schedule - title: Create rule request - type: object + - error + - message + - statusCode + title: Bad request alert_response_properties: example: - alertTypeId: .index-threshold + alertTypeId: alertTypeId throttle: throttle - updatedBy: elastic + updatedBy: updatedBy executionStatus: - lastExecutionDate: 2022-12-06T00:13:43.89Z - status: ok + lastExecutionDate: 2000-01-23T04:56:07.000+00:00 + status: status params: key: "" enabled: true @@ -2388,65 +2696,55 @@ components: tags: - tags - tags - createdAt: 2022-12-05T23:36:58.284Z + createdAt: 2000-01-23T04:56:07.000+00:00 schedule: interval: interval - notifyWhen: onActionGroupChange - createdBy: elastic - muteAll: false - name: my alert - scheduledTaskId: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef + notifyWhen: notifyWhen + createdBy: createdBy + muteAll: true + name: name + scheduledTaskId: scheduledTaskId + id: id actions: - "{}" - "{}" - apiKeyOwner: elastic - updatedAt: 2022-12-05T23:36:58.284Z + apiKeyOwner: apiKeyOwner + updatedAt: updatedAt properties: actions: items: type: object type: array alertTypeId: - example: .index-threshold type: string apiKeyOwner: - example: elastic nullable: true type: string createdAt: description: The date and time that the alert was created. - example: 2022-12-05T23:36:58.284Z format: date-time type: string createdBy: description: The identifier for the user that created the alert. - example: elastic type: string enabled: description: Indicates whether the alert is currently enabled. - example: true type: boolean executionStatus: $ref: '#/components/schemas/alert_response_properties_executionStatus' id: description: The identifier for the alert. - example: b530fed0-74f5-11ed-9801-35303b735aef type: string muteAll: - example: false type: boolean mutedInstanceIds: items: type: string - nullable: true type: array name: description: The name of the alert. - example: my alert type: string notifyWhen: - example: onActionGroupChange type: string params: additionalProperties: true @@ -2454,7 +2752,6 @@ components: schedule: $ref: '#/components/schemas/alert_response_properties_schedule' scheduledTaskId: - example: b530fed0-74f5-11ed-9801-35303b735aef type: string tags: items: @@ -2464,149 +2761,327 @@ components: nullable: true type: string updatedAt: - example: 2022-12-05T23:36:58.284Z type: string updatedBy: description: The identifier for the user that updated this alert most recently. - example: elastic nullable: true type: string title: Legacy alert response properties - type: object findRules_has_reference_parameter: properties: id: + nullable: true type: string type: + nullable: true type: string - type: object - findRules_search_fields_parameter: - oneOf: - - type: string - - items: - type: string - type: array findRules_200_response: example: per_page: 6 total: 1 data: - - throttle: 10m - created_at: 2022-12-05T23:36:58.284Z + - throttle: throttle + created_at: 2000-01-23T04:56:07.000+00:00 + api_key_created_by_user: true + enabled: true + running: true + notify_when: notify_when + next_run: 2000-01-23T04:56:07.000+00:00 + updated_at: updated_at + execution_status: + last_execution_date: 2000-01-23T04:56:07.000+00:00 + last_duration: 6 + status: status + scheduled_task_id: scheduled_task_id + id: id + consumer: consumer + alert_delay: + active: 3 last_run: alerts_count: - ignored: 6 - new: 1 - recovered: 5 - active: 0 - outcome_msg: outcome_msg + ignored: 5 + new: 5 + recovered: 2 + active: 1 + outcome_msg: + - outcome_msg + - outcome_msg + outcome_order: 7 warning: warning - outcome: succeeded + outcome: outcome params: key: "" - created_by: elastic - enabled: true + created_by: created_by muted_alert_ids: - muted_alert_ids - muted_alert_ids - rule_type_id: monitoring_alert_cluster_health + rule_type_id: rule_type_id + revision: 9 tags: - tags - tags - running: true - api_key_owner: elastic + api_key_owner: api_key_owner schedule: - interval: 1m - notify_when: onActiveAlert - next_run: 2022-12-06T00:14:43.818Z - updated_at: 2022-12-05T23:36:58.284Z - execution_status: - last_execution_date: 2022-12-06T00:13:43.89Z - last_duration: 55 - status: ok - name: cluster_health_rule - updated_by: elastic - scheduled_task_id: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef - mute_all: false + interval: interval + name: name + updated_by: updated_by + mute_all: true actions: - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + throttle: throttle + notify_when: null + group: group + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - consumer: alerts - - throttle: 10m - created_at: 2022-12-05T23:36:58.284Z + throttle: throttle + notify_when: null + group: group + - throttle: throttle + created_at: 2000-01-23T04:56:07.000+00:00 + api_key_created_by_user: true + enabled: true + running: true + notify_when: notify_when + next_run: 2000-01-23T04:56:07.000+00:00 + updated_at: updated_at + execution_status: + last_execution_date: 2000-01-23T04:56:07.000+00:00 + last_duration: 6 + status: status + scheduled_task_id: scheduled_task_id + id: id + consumer: consumer + alert_delay: + active: 3 last_run: alerts_count: - ignored: 6 - new: 1 - recovered: 5 - active: 0 - outcome_msg: outcome_msg + ignored: 5 + new: 5 + recovered: 2 + active: 1 + outcome_msg: + - outcome_msg + - outcome_msg + outcome_order: 7 warning: warning - outcome: succeeded + outcome: outcome params: key: "" - created_by: elastic - enabled: true + created_by: created_by muted_alert_ids: - muted_alert_ids - muted_alert_ids - rule_type_id: monitoring_alert_cluster_health + rule_type_id: rule_type_id + revision: 9 tags: - tags - tags - running: true - api_key_owner: elastic + api_key_owner: api_key_owner schedule: - interval: 1m - notify_when: onActiveAlert - next_run: 2022-12-06T00:14:43.818Z - updated_at: 2022-12-05T23:36:58.284Z - execution_status: - last_execution_date: 2022-12-06T00:13:43.89Z - last_duration: 55 - status: ok - name: cluster_health_rule - updated_by: elastic - scheduled_task_id: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef - mute_all: false + interval: interval + name: name + updated_by: updated_by + mute_all: true actions: - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - - id: 9dca3e00-74f5-11ed-9801-35303b735aef + throttle: throttle + notify_when: null + group: group + - alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default - consumer: alerts + throttle: throttle + notify_when: null + group: group page: 0 properties: data: @@ -2619,114 +3094,64 @@ components: type: integer total: type: integer - type: object - getAlertingHealth_200_response_alerting_framework_heath_decryption_health: - example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - properties: - status: - example: ok - type: string - timestamp: - example: 2023-01-13T01:28:00.28Z - format: date-time - type: string - type: object - getAlertingHealth_200_response_alerting_framework_heath: - deprecated: true - description: This property has a typo. Use `alerting_framework_health` instead. - example: - _deprecated: "This state property has a typo, use \"alerting_framework_health\"\ - \ instead." - execution_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - read_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - decryption_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - properties: - _deprecated: - example: "This state property has a typo, use \"alerting_framework_health\"\ - \ instead." - type: string - decryption_health: - $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_heath_decryption_health' - execution_health: - $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_heath_decryption_health' - read_health: - $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_heath_decryption_health' - type: object getAlertingHealth_200_response_alerting_framework_health_decryption_health: description: The timestamp and status of the rule decryption. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object getAlertingHealth_200_response_alerting_framework_health_execution_health: description: The timestamp and status of the rule run. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object getAlertingHealth_200_response_alerting_framework_health_read_health: description: The timestamp and status of the rule reading events. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object getAlertingHealth_200_response_alerting_framework_health: description: | Three substates identify the health of the alerting framework: `decryption_health`, `execution_health`, and `read_health`. example: execution_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 read_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 decryption_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: decryption_health: $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_health_decryption_health' @@ -2734,58 +3159,41 @@ components: $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_health_execution_health' read_health: $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_health_read_health' - type: object getAlertingHealth_200_response: example: alerting_framework_health: execution_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - read_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - decryption_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z - alerting_framework_heath: - _deprecated: "This state property has a typo, use \"alerting_framework_health\"\ - \ instead." - execution_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 read_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 decryption_health: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 has_permanent_encryption_key: true is_sufficiently_secure: true properties: - alerting_framework_heath: - $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_heath' alerting_framework_health: $ref: '#/components/schemas/getAlertingHealth_200_response_alerting_framework_health' has_permanent_encryption_key: description: "If `false`, the encrypted saved object plugin does not have\ \ a permanent encryption key." - example: true type: boolean is_sufficiently_secure: description: "If `false`, security is enabled but TLS is not." - example: true type: boolean - type: object getRuleTypes_200_response_inner_action_groups_inner: example: name: name id: id properties: id: + nullable: true type: string name: + nullable: true type: string - type: object getRuleTypes_200_response_inner_action_variables_context_inner: example: name: name @@ -2793,13 +3201,25 @@ components: useWithTripleBracesInTemplates: true properties: name: + nullable: true type: string description: + nullable: true type: string useWithTripleBracesInTemplates: type: boolean - type: object getRuleTypes_200_response_inner_action_variables_params_inner: + example: + name: name + description: description + properties: + description: + nullable: true + type: string + name: + nullable: true + type: string + getRuleTypes_200_response_inner_action_variables_state_inner: example: name: name description: description @@ -2808,7 +3228,6 @@ components: type: string name: type: string - type: object getRuleTypes_200_response_inner_action_variables: description: | A list of action variables that the rule type makes available via context and state in action parameter templates, and a short human readable description. When you create a rule in Kibana, it uses this information to prompt you for these variables in action parameter editors. @@ -2841,9 +3260,102 @@ components: type: array state: items: - $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables_params_inner' + $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables_state_inner' type: array - type: object + getRuleTypes_200_response_inner_alerts_mappings: + example: + fieldMap: + key: + path: path + array: true + format: format + ignore_above: 0 + index: true + dynamic: true + scaling_factor: 6 + type: scaled_float + properties: + key: + type: type + required: true + properties: + fieldMap: + additionalProperties: + $ref: '#/components/schemas/fieldmap_properties' + description: | + Mapping information for each field supported in alerts as data documents for this rule type. For more information about mapping parameters, refer to the Elasticsearch documentation. + getRuleTypes_200_response_inner_alerts: + description: | + Details for writing alerts as data documents for this rule type. + example: + shouldWrite: true + mappings: + fieldMap: + key: + path: path + array: true + format: format + ignore_above: 0 + index: true + dynamic: true + scaling_factor: 6 + type: scaled_float + properties: + key: + type: type + required: true + useEcs: true + context: ml.anomaly-detection + useLegacyAlerts: false + dynamic: "false" + isSpaceAware: true + secondaryAlias: secondaryAlias + properties: + context: + description: | + The namespace for this rule type. + enum: + - ml.anomaly-detection + - observability.apm + - observability.logs + - observability.metrics + - observability.slo + - observability.threshold + - observability.uptime + - security + - stack + type: string + dynamic: + description: Indicates whether new fields are added dynamically. + enum: + - "false" + - runtime + - strict + - "true" + type: string + isSpaceAware: + description: | + Indicates whether the alerts are space-aware. If true, space-specific alert indices are used. + type: boolean + mappings: + $ref: '#/components/schemas/getRuleTypes_200_response_inner_alerts_mappings' + secondaryAlias: + description: | + A secondary alias. It is typically used to support the signals alias for detection rules. + type: string + shouldWrite: + description: | + Indicates whether the rule should write out alerts as data. + type: boolean + useEcs: + description: | + Indicates whether to include the ECS component template for the alerts. + type: boolean + useLegacyAlerts: + default: false + description: | + Indicates whether to include the legacy component template for the alerts. + type: boolean getRuleTypes_200_response_inner_authorized_consumers_alerts: example: all: true @@ -2853,7 +3365,6 @@ components: type: boolean read: type: boolean - type: object getRuleTypes_200_response_inner_authorized_consumers: description: The list of the plugins IDs that have access to the rule type. example: @@ -2869,6 +3380,9 @@ components: infrastructure: all: true read: true + slo: + all: true + read: true siem: all: true read: true @@ -2904,11 +3418,12 @@ components: $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers_alerts' siem: $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers_alerts' + slo: + $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers_alerts' stackAlerts: $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers_alerts' uptime: $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers_alerts' - type: object getRuleTypes_200_response_inner_recovery_action_group: description: An action group to use when an alert goes from an active state to an inactive one. @@ -2917,12 +3432,15 @@ components: id: id properties: id: + nullable: true type: string name: + nullable: true type: string - type: object getRuleTypes_200_response_inner: example: + has_alerts_mappings: true + has_fields_for_a_a_d: true recovery_action_group: name: name id: id @@ -2941,6 +3459,9 @@ components: infrastructure: all: true read: true + slo: + all: true + read: true siem: all: true read: true @@ -2964,7 +3485,7 @@ components: id: id - name: name id: id - minimum_license_required: basic + minimum_license_required: minimum_license_required action_variables: context: - name: name @@ -2983,23 +3504,55 @@ components: description: description - name: name description: description - rule_task_timeout: 5m + alerts: + shouldWrite: true + mappings: + fieldMap: + key: + path: path + array: true + format: format + ignore_above: 0 + index: true + dynamic: true + scaling_factor: 6 + type: scaled_float + properties: + key: + type: type + required: true + useEcs: true + context: ml.anomaly-detection + useLegacyAlerts: false + dynamic: "false" + isSpaceAware: true + secondaryAlias: secondaryAlias + rule_task_timeout: rule_task_timeout name: name enabled_in_license: true - producer: stackAlerts + producer: producer id: id + category: management default_action_group_id: default_action_group_id properties: action_groups: - description: | - An explicit list of groups for which the rule type can schedule actions, each with the action group's unique ID and human readable name. Rule actions validation uses this configuration to ensure that groups are valid. items: $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_groups_inner' type: array action_variables: $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables' + alerts: + $ref: '#/components/schemas/getRuleTypes_200_response_inner_alerts' authorized_consumers: $ref: '#/components/schemas/getRuleTypes_200_response_inner_authorized_consumers' + category: + description: "The rule category, which is used by features such as category-specific\ + \ maintenance windows." + enum: + - management + - observability + - securitySolution + type: string default_action_group_id: description: The default identifier for the rule type group. type: string @@ -3011,6 +3564,12 @@ components: description: Indicates whether the rule type is enabled or disabled based on the subscription. type: boolean + has_alerts_mappings: + description: Indicates whether the rule type has custom mappings for the + alert data. + type: boolean + has_fields_for_a_a_d: + type: boolean id: description: The unique identifier for the rule type. type: string @@ -3020,21 +3579,17 @@ components: type: boolean minimum_license_required: description: The subscriptions required to use the rule type. - example: basic type: string name: description: The descriptive name of the rule type. type: string producer: description: An identifier for the application that produces this rule type. - example: stackAlerts type: string recovery_action_group: $ref: '#/components/schemas/getRuleTypes_200_response_inner_recovery_action_group' rule_task_timeout: - example: 5m type: string - type: object Legacy_update_alert_request_properties_actions_inner: properties: actionTypeId: @@ -3056,7 +3611,6 @@ components: - group - id - params - type: object Legacy_update_alert_request_properties_schedule: description: | The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. @@ -3064,9 +3618,7 @@ components: interval: description: "The interval format specifies the interval in seconds, minutes,\ \ hours or days at which the alert should execute." - example: 1d type: string - type: object Legacy_update_alert_request_properties: properties: actions: @@ -3091,8 +3643,8 @@ components: schedule: $ref: '#/components/schemas/Legacy_update_alert_request_properties_schedule' tags: - description: A list of keywords to reference and search. items: + nullable: true type: string type: array throttle: @@ -3105,17 +3657,6 @@ components: - params - schedule title: Legacy update alert request properties - type: object - Legacy_create_alert_request_properties_schedule: - description: | - The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - properties: - interval: - description: "The interval format specifies the interval in seconds, minutes,\ - \ hours or days at which the alert should execute." - example: 10s - type: string - type: object Legacy_create_alert_request_properties: properties: actions: @@ -3151,9 +3692,8 @@ components: \ if defined." type: object schedule: - $ref: '#/components/schemas/Legacy_create_alert_request_properties_schedule' + $ref: '#/components/schemas/Legacy_update_alert_request_properties_schedule' tags: - description: A list of keywords to reference and search. items: type: string type: array @@ -3169,18 +3709,23 @@ components: - params - schedule title: Legacy create alert request properties - type: object + legacyFindAlerts_has_reference_parameter: + properties: + id: + type: string + type: + type: string legacyFindAlerts_200_response: example: total: 1 perPage: 6 data: - - alertTypeId: .index-threshold + - alertTypeId: alertTypeId throttle: throttle - updatedBy: elastic + updatedBy: updatedBy executionStatus: - lastExecutionDate: 2022-12-06T00:13:43.89Z - status: ok + lastExecutionDate: 2000-01-23T04:56:07.000+00:00 + status: status params: key: "" enabled: true @@ -3190,26 +3735,26 @@ components: tags: - tags - tags - createdAt: 2022-12-05T23:36:58.284Z + createdAt: 2000-01-23T04:56:07.000+00:00 schedule: interval: interval - notifyWhen: onActionGroupChange - createdBy: elastic - muteAll: false - name: my alert - scheduledTaskId: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef + notifyWhen: notifyWhen + createdBy: createdBy + muteAll: true + name: name + scheduledTaskId: scheduledTaskId + id: id actions: - "{}" - "{}" - apiKeyOwner: elastic - updatedAt: 2022-12-05T23:36:58.284Z - - alertTypeId: .index-threshold + apiKeyOwner: apiKeyOwner + updatedAt: updatedAt + - alertTypeId: alertTypeId throttle: throttle - updatedBy: elastic + updatedBy: updatedBy executionStatus: - lastExecutionDate: 2022-12-06T00:13:43.89Z - status: ok + lastExecutionDate: 2000-01-23T04:56:07.000+00:00 + status: status params: key: "" enabled: true @@ -3219,20 +3764,20 @@ components: tags: - tags - tags - createdAt: 2022-12-05T23:36:58.284Z + createdAt: 2000-01-23T04:56:07.000+00:00 schedule: interval: interval - notifyWhen: onActionGroupChange - createdBy: elastic - muteAll: false - name: my alert - scheduledTaskId: b530fed0-74f5-11ed-9801-35303b735aef - id: b530fed0-74f5-11ed-9801-35303b735aef + notifyWhen: notifyWhen + createdBy: createdBy + muteAll: true + name: name + scheduledTaskId: scheduledTaskId + id: id actions: - "{}" - "{}" - apiKeyOwner: elastic - updatedAt: 2022-12-05T23:36:58.284Z + apiKeyOwner: apiKeyOwner + updatedAt: updatedAt page: 0 properties: data: @@ -3245,74 +3790,64 @@ components: type: integer total: type: integer - type: object legacyGetAlertingHealth_200_response_alertingFrameworkHealth_decryptionHealth: description: The timestamp and status of the alert decryption. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object legacyGetAlertingHealth_200_response_alertingFrameworkHealth_executionHealth: description: The timestamp and status of the alert execution. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object legacyGetAlertingHealth_200_response_alertingFrameworkHealth_readHealth: description: The timestamp and status of the alert reading events. example: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: status: enum: - error - ok - warn - example: ok type: string timestamp: - example: 2023-01-13T01:28:00.28Z format: date-time type: string - type: object legacyGetAlertingHealth_200_response_alertingFrameworkHealth: description: | Three substates identify the health of the alerting framework: `decryptionHealth`, `executionHealth`, and `readHealth`. example: executionHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 decryptionHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 readHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 properties: decryptionHealth: $ref: '#/components/schemas/legacyGetAlertingHealth_200_response_alertingFrameworkHealth_decryptionHealth' @@ -3320,20 +3855,19 @@ components: $ref: '#/components/schemas/legacyGetAlertingHealth_200_response_alertingFrameworkHealth_executionHealth' readHealth: $ref: '#/components/schemas/legacyGetAlertingHealth_200_response_alertingFrameworkHealth_readHealth' - type: object legacyGetAlertingHealth_200_response: example: hasPermanentEncryptionKey: true alertingFrameworkHealth: executionHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 decryptionHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 readHealth: - status: ok - timestamp: 2023-01-13T01:28:00.28Z + status: error + timestamp: 2000-01-23T04:56:07.000+00:00 isSufficientlySecure: true properties: alertingFrameworkHealth: @@ -3341,23 +3875,19 @@ components: hasPermanentEncryptionKey: description: "If `false`, the encrypted saved object plugin does not have\ \ a permanent encryption key." - example: true type: boolean isSufficientlySecure: description: "If `false`, security is enabled but TLS is not." - example: true type: boolean - type: object - legacyGetAlertTypes_200_response_inner_actionVariables_context_inner: + legacyGetAlertTypes_200_response_inner_actionGroups_inner: example: name: name - description: description + id: id properties: - name: + id: type: string - description: + name: type: string - type: object legacyGetAlertTypes_200_response_inner_actionVariables: description: | A list of action variables that the alert type makes available via context and state in action parameter templates, and a short human readable description. The Alert UI will use this information to prompt users for these variables in action parameter editors. @@ -3367,30 +3897,33 @@ components: description: description - name: name description: description - state: - - name: name - description: description - - name: name - description: description - params: - - name: name - description: description - - name: name - description: description + state: "" + params: "" properties: context: items: - $ref: '#/components/schemas/legacyGetAlertTypes_200_response_inner_actionVariables_context_inner' + $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables_state_inner' type: array params: items: - $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables_params_inner' - type: array + example: + name: name + description: description + properties: + description: + type: string + name: + type: string state: items: - $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_variables_params_inner' - type: array - type: object + example: + name: name + description: description + properties: + description: + type: string + name: + type: string legacyGetAlertTypes_200_response_inner_recoveryActionGroup: description: | An action group to use when an alert instance goes from an active state to an inactive one. If it is not specified, the default recovered action group is used. @@ -3399,10 +3932,11 @@ components: id: id properties: id: + nullable: true type: string name: + nullable: true type: string - type: object legacyGetAlertTypes_200_response_inner: example: defaultActionGroupId: defaultActionGroupId @@ -3413,16 +3947,8 @@ components: description: description - name: name description: description - state: - - name: name - description: description - - name: name - description: description - params: - - name: name - description: description - - name: name - description: description + state: "" + params: "" actionGroups: - name: name id: id @@ -3439,10 +3965,8 @@ components: minimumLicenseRequired: minimumLicenseRequired properties: actionGroups: - description: | - An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid. items: - $ref: '#/components/schemas/getRuleTypes_200_response_inner_action_groups_inner' + $ref: '#/components/schemas/legacyGetAlertTypes_200_response_inner_actionGroups_inner' type: array actionVariables: $ref: '#/components/schemas/legacyGetAlertTypes_200_response_inner_actionVariables' @@ -3474,59 +3998,266 @@ components: type: string recoveryActionGroup: $ref: '#/components/schemas/legacyGetAlertTypes_200_response_inner_recoveryActionGroup' - type: object + filter_meta: + example: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + properties: + alias: + nullable: true + type: string + controlledBy: + type: string + disabled: + type: boolean + field: + type: string + group: + type: string + index: + type: string + isMultiIndex: + type: boolean + key: + type: string + negate: + type: boolean + params: + type: object + type: + type: string + value: + type: string + actions_inner_alerts_filter_query: + description: Defines a query filter that determines whether the action runs. + example: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + properties: + kql: + description: A filter written in Kibana Query Language (KQL). + type: string + filters: + items: + $ref: '#/components/schemas/filter' + type: array + actions_inner_alerts_filter_timeframe_hours: + description: | + Defines the range of time in a day that the action can run. If the `start` value is `00:00` and the `end` value is `24:00`, actions be generated all day. + example: + start: start + end: end + properties: + end: + description: The end of the time frame in 24-hour notation (`hh:mm`). + type: string + start: + description: The start of the time frame in 24-hour notation (`hh:mm`). + type: string + actions_inner_alerts_filter_timeframe: + description: Defines a period that limits whether the action runs. + example: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + properties: + days: + items: + type: integer + type: array + hours: + $ref: '#/components/schemas/actions_inner_alerts_filter_timeframe_hours' + timezone: + description: | + The ISO time zone for the `hours` values. Values such as `UTC` and `UTC+1` also work but lack built-in daylight savings time support and are not recommended. + type: string + actions_inner_alerts_filter: + description: | + Conditions that affect whether the action runs. If you specify multiple conditions, all conditions must be met for the action to run. For example, if an alert occurs within the specified time frame and matches the query, the action runs. + example: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + properties: + query: + $ref: '#/components/schemas/actions_inner_alerts_filter_query' + timeframe: + $ref: '#/components/schemas/actions_inner_alerts_filter_timeframe' actions_inner_frequency: description: | - The parameters that affect how often actions are generated. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. + The properties that affect how often actions are generated. If the rule type supports setting `summary` to `true`, the action can be a summary of alerts at the specified notification interval. Otherwise, an action runs for each alert at the specified notification interval. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. example: summary: true - throttle: 10m - notify_when: onActiveAlert + throttle: throttle + notify_when: null properties: notify_when: - $ref: '#/components/schemas/notify_when' + $ref: '#/components/schemas/notify_when_action' summary: description: Indicates whether the action is a summary. type: boolean throttle: - description: "The throttle interval, which defines how often an alert generates\ - \ repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`.\ - \ It is specified in seconds, minutes, hours, or days." - example: 10m + description: | + The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. nullable: true type: string required: - notify_when - summary - type: object actions_inner: + description: | + An action that runs under defined conditions. example: - id: 9dca3e00-74f5-11ed-9801-35303b735aef + alerts_filter: + timeframe: + hours: + start: start + end: end + timezone: timezone + days: + - 0 + - 0 + query: + kql: kql + filters: + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + - $state: "{}" + meta: + field: field + controlledBy: controlledBy + negate: true + alias: alias + index: index + disabled: true + params: "{}" + type: type + value: value + isMultiIndex: true + key: key + group: group + query: "{}" + id: id params: key: "" - connector_type_id: .server-log + uuid: uuid + connector_type_id: connector_type_id frequency: summary: true - throttle: 10m - notify_when: onActiveAlert - group: default + throttle: throttle + notify_when: null + group: group properties: + alerts_filter: + $ref: '#/components/schemas/actions_inner_alerts_filter' connector_type_id: description: The type of connector. This property appears in responses but cannot be set in requests. - example: .server-log readOnly: true type: string frequency: $ref: '#/components/schemas/actions_inner_frequency' group: - description: "The group name for the actions. If you don't need to group\ - \ actions, set to `default`." - example: default + description: | + The group name, which affects when the action runs (for example, when the threshold is met or when the alert is recovered). Each rule type has a list of valid action group names. If you don't need to group actions, set to `default`. type: string id: description: The identifier for the connector saved object. - example: 9dca3e00-74f5-11ed-9801-35303b735aef type: string params: additionalProperties: true @@ -3534,30 +4265,32 @@ components: \ The `params` are handled as Mustache templates and passed a default\ \ set of context." type: object - type: object + uuid: + description: A universally unique identifier (UUID) for the action. + type: string + required: + - group + - id + - params rule_response_properties_execution_status: example: - last_execution_date: 2022-12-06T00:13:43.89Z - last_duration: 55 - status: ok + last_execution_date: 2000-01-23T04:56:07.000+00:00 + last_duration: 6 + status: status properties: last_duration: - example: 55 type: integer last_execution_date: - example: 2022-12-06T00:13:43.89Z format: date-time type: string status: - example: ok type: string - type: object rule_response_properties_last_run_alerts_count: example: - ignored: 6 - new: 1 - recovered: 5 - active: 0 + ignored: 5 + new: 5 + recovered: 2 + active: 1 properties: active: type: integer @@ -3567,52 +4300,56 @@ components: type: integer recovered: type: integer - type: object rule_response_properties_last_run: example: alerts_count: - ignored: 6 - new: 1 - recovered: 5 - active: 0 - outcome_msg: outcome_msg + ignored: 5 + new: 5 + recovered: 2 + active: 1 + outcome_msg: + - outcome_msg + - outcome_msg + outcome_order: 7 warning: warning - outcome: succeeded + outcome: outcome properties: alerts_count: $ref: '#/components/schemas/rule_response_properties_last_run_alerts_count' outcome: - example: succeeded type: string outcome_msg: - nullable: true - type: string - example: null + items: + type: string + type: array + outcome_order: + type: integer warning: nullable: true type: string - example: null - type: object + fieldmap_properties_properties_value: + example: + type: type + properties: + type: + description: The data type for each object property. + type: string alert_response_properties_executionStatus: example: - lastExecutionDate: 2022-12-06T00:13:43.89Z - status: ok + lastExecutionDate: 2000-01-23T04:56:07.000+00:00 + status: status properties: lastExecutionDate: - example: 2022-12-06T00:13:43.89Z format: date-time type: string status: - example: ok type: string - type: object alert_response_properties_schedule: example: interval: interval properties: interval: type: string - type: object securitySchemes: basicAuth: scheme: basic diff --git a/generated/alerting/api_alerting.go b/generated/alerting/api_alerting.go index 965a0d993..57a4ce27c 100644 --- a/generated/alerting/api_alerting.go +++ b/generated/alerting/api_alerting.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -23,26 +23,42 @@ import ( type AlertingAPI interface { /* - CreateRule Creates a rule. + CreateRule Creates a rule with a randomly generated rule identifier. - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you create a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If a user with different privileges updates the rule, its behavior might change. + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - @param ruleId An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. @return ApiCreateRuleRequest */ - CreateRule(ctx context.Context, spaceId string, ruleId string) ApiCreateRuleRequest + CreateRule(ctx context.Context, spaceId interface{}) ApiCreateRuleRequest // CreateRuleExecute executes the request // @return RuleResponseProperties CreateRuleExecute(r ApiCreateRuleRequest) (*RuleResponseProperties, *http.Response, error) + /* + CreateRuleId Creates a rule with a specific rule identifier. + + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @param ruleId An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. + @return ApiCreateRuleIdRequest + */ + CreateRuleId(ctx context.Context, spaceId interface{}, ruleId string) ApiCreateRuleIdRequest + + // CreateRuleIdExecute executes the request + // @return RuleResponseProperties + CreateRuleIdExecute(r ApiCreateRuleIdRequest) (*RuleResponseProperties, *http.Response, error) + /* DeleteRule Deletes a rule. - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. + To delete a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. If the API key that is used by the rule was created automatically, it is deleted. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -50,7 +66,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteRuleRequest */ - DeleteRule(ctx context.Context, ruleId string, spaceId string) ApiDeleteRuleRequest + DeleteRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiDeleteRuleRequest // DeleteRuleExecute executes the request DeleteRuleExecute(r ApiDeleteRuleRequest) (*http.Response, error) @@ -66,7 +82,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDisableRuleRequest */ - DisableRule(ctx context.Context, ruleId string, spaceId string) ApiDisableRuleRequest + DisableRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiDisableRuleRequest // DisableRuleExecute executes the request DisableRuleExecute(r ApiDisableRuleRequest) (*http.Response, error) @@ -74,7 +90,7 @@ type AlertingAPI interface { /* EnableRule Enables a rule. - This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. + To enable a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -82,7 +98,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiEnableRuleRequest */ - EnableRule(ctx context.Context, ruleId string, spaceId string) ApiEnableRuleRequest + EnableRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiEnableRuleRequest // EnableRuleExecute executes the request EnableRuleExecute(r ApiEnableRuleRequest) (*http.Response, error) @@ -97,7 +113,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiFindRulesRequest */ - FindRules(ctx context.Context, spaceId string) ApiFindRulesRequest + FindRules(ctx context.Context, spaceId interface{}) ApiFindRulesRequest // FindRulesExecute executes the request // @return FindRules200Response @@ -113,7 +129,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetAlertingHealthRequest */ - GetAlertingHealth(ctx context.Context, spaceId string) ApiGetAlertingHealthRequest + GetAlertingHealth(ctx context.Context, spaceId interface{}) ApiGetAlertingHealthRequest // GetAlertingHealthExecute executes the request // @return GetAlertingHealth200Response @@ -130,7 +146,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuleRequest */ - GetRule(ctx context.Context, ruleId string, spaceId string) ApiGetRuleRequest + GetRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiGetRuleRequest // GetRuleExecute executes the request // @return RuleResponseProperties @@ -146,7 +162,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuleTypesRequest */ - GetRuleTypes(ctx context.Context, spaceId string) ApiGetRuleTypesRequest + GetRuleTypes(ctx context.Context, spaceId interface{}) ApiGetRuleTypesRequest // GetRuleTypesExecute executes the request // @return []GetRuleTypes200ResponseInner @@ -164,7 +180,7 @@ type AlertingAPI interface { Deprecated */ - LegacyCreateAlert(ctx context.Context, alertId string, spaceId string) ApiLegacyCreateAlertRequest + LegacyCreateAlert(ctx context.Context, alertId string, spaceId interface{}) ApiLegacyCreateAlertRequest // LegacyCreateAlertExecute executes the request // @return AlertResponseProperties @@ -183,7 +199,7 @@ type AlertingAPI interface { Deprecated */ - LegacyDisableAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyDisableAlertRequest + LegacyDisableAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyDisableAlertRequest // LegacyDisableAlertExecute executes the request // Deprecated @@ -201,7 +217,7 @@ type AlertingAPI interface { Deprecated */ - LegacyEnableAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyEnableAlertRequest + LegacyEnableAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyEnableAlertRequest // LegacyEnableAlertExecute executes the request // Deprecated @@ -219,7 +235,7 @@ type AlertingAPI interface { Deprecated */ - LegacyFindAlerts(ctx context.Context, spaceId string) ApiLegacyFindAlertsRequest + LegacyFindAlerts(ctx context.Context, spaceId interface{}) ApiLegacyFindAlertsRequest // LegacyFindAlertsExecute executes the request // @return LegacyFindAlerts200Response @@ -238,7 +254,7 @@ type AlertingAPI interface { Deprecated */ - LegacyGetAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyGetAlertRequest + LegacyGetAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyGetAlertRequest // LegacyGetAlertExecute executes the request // @return AlertResponseProperties @@ -256,7 +272,7 @@ type AlertingAPI interface { Deprecated */ - LegacyGetAlertTypes(ctx context.Context, spaceId string) ApiLegacyGetAlertTypesRequest + LegacyGetAlertTypes(ctx context.Context, spaceId interface{}) ApiLegacyGetAlertTypesRequest // LegacyGetAlertTypesExecute executes the request // @return []LegacyGetAlertTypes200ResponseInner @@ -274,7 +290,7 @@ type AlertingAPI interface { Deprecated */ - LegacyGetAlertingHealth(ctx context.Context, spaceId string) ApiLegacyGetAlertingHealthRequest + LegacyGetAlertingHealth(ctx context.Context, spaceId interface{}) ApiLegacyGetAlertingHealthRequest // LegacyGetAlertingHealthExecute executes the request // @return LegacyGetAlertingHealth200Response @@ -294,7 +310,7 @@ type AlertingAPI interface { Deprecated */ - LegacyMuteAlertInstance(ctx context.Context, spaceId string, alertId string, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest + LegacyMuteAlertInstance(ctx context.Context, spaceId interface{}, alertId string, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest // LegacyMuteAlertInstanceExecute executes the request // Deprecated @@ -312,7 +328,7 @@ type AlertingAPI interface { Deprecated */ - LegacyMuteAllAlertInstances(ctx context.Context, spaceId string, alertId string) ApiLegacyMuteAllAlertInstancesRequest + LegacyMuteAllAlertInstances(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyMuteAllAlertInstancesRequest // LegacyMuteAllAlertInstancesExecute executes the request // Deprecated @@ -331,7 +347,7 @@ type AlertingAPI interface { Deprecated */ - LegacyUnmuteAlertInstance(ctx context.Context, spaceId string, alertId string, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest + LegacyUnmuteAlertInstance(ctx context.Context, spaceId interface{}, alertId string, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest // LegacyUnmuteAlertInstanceExecute executes the request // Deprecated @@ -349,7 +365,7 @@ type AlertingAPI interface { Deprecated */ - LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId string, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest + LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest // LegacyUnmuteAllAlertInstancesExecute executes the request // Deprecated @@ -367,7 +383,7 @@ type AlertingAPI interface { Deprecated */ - LegacyUpdateAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyUpdateAlertRequest + LegacyUpdateAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyUpdateAlertRequest // LegacyUpdateAlertExecute executes the request // @return AlertResponseProperties @@ -387,7 +403,7 @@ type AlertingAPI interface { Deprecated */ - LegaryDeleteAlert(ctx context.Context, spaceId string, alertId string) ApiLegaryDeleteAlertRequest + LegaryDeleteAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegaryDeleteAlertRequest // LegaryDeleteAlertExecute executes the request // Deprecated @@ -405,7 +421,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiMuteAlertRequest */ - MuteAlert(ctx context.Context, alertId string, ruleId string, spaceId string) ApiMuteAlertRequest + MuteAlert(ctx context.Context, alertId interface{}, ruleId interface{}, spaceId interface{}) ApiMuteAlertRequest // MuteAlertExecute executes the request MuteAlertExecute(r ApiMuteAlertRequest) (*http.Response, error) @@ -421,7 +437,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiMuteAllAlertsRequest */ - MuteAllAlerts(ctx context.Context, ruleId string, spaceId string) ApiMuteAllAlertsRequest + MuteAllAlerts(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiMuteAllAlertsRequest // MuteAllAlertsExecute executes the request MuteAllAlertsExecute(r ApiMuteAllAlertsRequest) (*http.Response, error) @@ -438,7 +454,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUnmuteAlertRequest */ - UnmuteAlert(ctx context.Context, alertId string, ruleId string, spaceId string) ApiUnmuteAlertRequest + UnmuteAlert(ctx context.Context, alertId interface{}, ruleId interface{}, spaceId interface{}) ApiUnmuteAlertRequest // UnmuteAlertExecute executes the request UnmuteAlertExecute(r ApiUnmuteAlertRequest) (*http.Response, error) @@ -454,7 +470,7 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUnmuteAllAlertsRequest */ - UnmuteAllAlerts(ctx context.Context, ruleId string, spaceId string) ApiUnmuteAllAlertsRequest + UnmuteAllAlerts(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUnmuteAllAlertsRequest // UnmuteAllAlertsExecute executes the request UnmuteAllAlertsExecute(r ApiUnmuteAllAlertsRequest) (*http.Response, error) @@ -462,7 +478,7 @@ type AlertingAPI interface { /* UpdateRule Updates the attributes for a rule. - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. + To update a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. NOTE: If the API key has different privileges than the key that created or most recently updated the rule, the rule behavior might change. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -470,11 +486,26 @@ type AlertingAPI interface { @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateRuleRequest */ - UpdateRule(ctx context.Context, ruleId string, spaceId string) ApiUpdateRuleRequest + UpdateRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUpdateRuleRequest // UpdateRuleExecute executes the request // @return RuleResponseProperties UpdateRuleExecute(r ApiUpdateRuleRequest) (*RuleResponseProperties, *http.Response, error) + + /* + UpdateRuleAPIKey Updates the API key for a rule. + + The new API key has the credentials of the user that submits the request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ruleId An identifier for the rule. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiUpdateRuleAPIKeyRequest + */ + UpdateRuleAPIKey(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUpdateRuleAPIKeyRequest + + // UpdateRuleAPIKeyExecute executes the request + UpdateRuleAPIKeyExecute(r ApiUpdateRuleAPIKeyRequest) (*http.Response, error) } // AlertingAPIService AlertingAPI service @@ -483,14 +514,13 @@ type AlertingAPIService service type ApiCreateRuleRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string - ruleId string + kbnXsrf *interface{} + spaceId interface{} createRuleRequest *CreateRuleRequest } // Cross-site request forgery protection -func (r ApiCreateRuleRequest) KbnXsrf(kbnXsrf string) ApiCreateRuleRequest { +func (r ApiCreateRuleRequest) KbnXsrf(kbnXsrf interface{}) ApiCreateRuleRequest { r.kbnXsrf = &kbnXsrf return r } @@ -505,21 +535,19 @@ func (r ApiCreateRuleRequest) Execute() (*RuleResponseProperties, *http.Response } /* -CreateRule Creates a rule. +CreateRule Creates a rule with a randomly generated rule identifier. -You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you create a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If a user with different privileges updates the rule, its behavior might change. +To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - @param ruleId An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. @return ApiCreateRuleRequest */ -func (a *AlertingAPIService) CreateRule(ctx context.Context, spaceId string, ruleId string) ApiCreateRuleRequest { +func (a *AlertingAPIService) CreateRule(ctx context.Context, spaceId interface{}) ApiCreateRuleRequest { return ApiCreateRuleRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, - ruleId: ruleId, } } @@ -539,6 +567,170 @@ func (a *AlertingAPIService) CreateRuleExecute(r ApiCreateRuleRequest) (*RuleRes return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } + localVarPath := localBasePath + "/s/{spaceId}/api/alerting/rule" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") + } + if r.createRuleRequest == nil { + return localVarReturnValue, nil, reportError("createRuleRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + // body params + localVarPostBody = r.createRuleRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateRuleIdRequest struct { + ctx context.Context + ApiService AlertingAPI + kbnXsrf *interface{} + spaceId interface{} + ruleId string + createRuleRequest *CreateRuleRequest +} + +// Cross-site request forgery protection +func (r ApiCreateRuleIdRequest) KbnXsrf(kbnXsrf interface{}) ApiCreateRuleIdRequest { + r.kbnXsrf = &kbnXsrf + return r +} + +func (r ApiCreateRuleIdRequest) CreateRuleRequest(createRuleRequest CreateRuleRequest) ApiCreateRuleIdRequest { + r.createRuleRequest = &createRuleRequest + return r +} + +func (r ApiCreateRuleIdRequest) Execute() (*RuleResponseProperties, *http.Response, error) { + return r.ApiService.CreateRuleIdExecute(r) +} + +/* +CreateRuleId Creates a rule with a specific rule identifier. + +To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @param ruleId An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. + @return ApiCreateRuleIdRequest +*/ +func (a *AlertingAPIService) CreateRuleId(ctx context.Context, spaceId interface{}, ruleId string) ApiCreateRuleIdRequest { + return ApiCreateRuleIdRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + ruleId: ruleId, + } +} + +// Execute executes the request +// +// @return RuleResponseProperties +func (a *AlertingAPIService) CreateRuleIdExecute(r ApiCreateRuleIdRequest) (*RuleResponseProperties, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RuleResponseProperties + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AlertingAPIService.CreateRuleId") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + localVarPath := localBasePath + "/s/{spaceId}/api/alerting/rule/{ruleId}" localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", url.PathEscape(parameterValueToString(r.ruleId, "ruleId")), -1) @@ -648,13 +840,13 @@ func (a *AlertingAPIService) CreateRuleExecute(r ApiCreateRuleRequest) (*RuleRes type ApiDeleteRuleRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiDeleteRuleRequest) KbnXsrf(kbnXsrf string) ApiDeleteRuleRequest { +func (r ApiDeleteRuleRequest) KbnXsrf(kbnXsrf interface{}) ApiDeleteRuleRequest { r.kbnXsrf = &kbnXsrf return r } @@ -666,14 +858,14 @@ func (r ApiDeleteRuleRequest) Execute() (*http.Response, error) { /* DeleteRule Deletes a rule. -You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. +To delete a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. If the API key that is used by the rule was created automatically, it is deleted. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param ruleId An identifier for the rule. @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteRuleRequest */ -func (a *AlertingAPIService) DeleteRule(ctx context.Context, ruleId string, spaceId string) ApiDeleteRuleRequest { +func (a *AlertingAPIService) DeleteRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiDeleteRuleRequest { return ApiDeleteRuleRequest{ ApiService: a, ctx: ctx, @@ -790,13 +982,13 @@ func (a *AlertingAPIService) DeleteRuleExecute(r ApiDeleteRuleRequest) (*http.Re type ApiDisableRuleRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiDisableRuleRequest) KbnXsrf(kbnXsrf string) ApiDisableRuleRequest { +func (r ApiDisableRuleRequest) KbnXsrf(kbnXsrf interface{}) ApiDisableRuleRequest { r.kbnXsrf = &kbnXsrf return r } @@ -815,7 +1007,7 @@ You must have `all` privileges for the appropriate Kibana features, depending on @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDisableRuleRequest */ -func (a *AlertingAPIService) DisableRule(ctx context.Context, ruleId string, spaceId string) ApiDisableRuleRequest { +func (a *AlertingAPIService) DisableRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiDisableRuleRequest { return ApiDisableRuleRequest{ ApiService: a, ctx: ctx, @@ -932,13 +1124,13 @@ func (a *AlertingAPIService) DisableRuleExecute(r ApiDisableRuleRequest) (*http. type ApiEnableRuleRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiEnableRuleRequest) KbnXsrf(kbnXsrf string) ApiEnableRuleRequest { +func (r ApiEnableRuleRequest) KbnXsrf(kbnXsrf interface{}) ApiEnableRuleRequest { r.kbnXsrf = &kbnXsrf return r } @@ -950,14 +1142,14 @@ func (r ApiEnableRuleRequest) Execute() (*http.Response, error) { /* EnableRule Enables a rule. -This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. +To enable a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param ruleId An identifier for the rule. @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiEnableRuleRequest */ -func (a *AlertingAPIService) EnableRule(ctx context.Context, ruleId string, spaceId string) ApiEnableRuleRequest { +func (a *AlertingAPIService) EnableRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiEnableRuleRequest { return ApiEnableRuleRequest{ ApiService: a, ctx: ctx, @@ -1074,15 +1266,15 @@ func (a *AlertingAPIService) EnableRuleExecute(r ApiEnableRuleRequest) (*http.Re type ApiFindRulesRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} defaultSearchOperator *string - fields *[]string + fields *[]*string filter *string hasReference *FindRulesHasReferenceParameter page *int32 perPage *int32 search *string - searchFields *FindRulesSearchFieldsParameter + searchFields *string sortField *string sortOrder *string } @@ -1094,7 +1286,7 @@ func (r ApiFindRulesRequest) DefaultSearchOperator(defaultSearchOperator string) } // The fields to return in the `attributes` key of the response. -func (r ApiFindRulesRequest) Fields(fields []string) ApiFindRulesRequest { +func (r ApiFindRulesRequest) Fields(fields []*string) ApiFindRulesRequest { r.fields = &fields return r } @@ -1130,7 +1322,7 @@ func (r ApiFindRulesRequest) Search(search string) ApiFindRulesRequest { } // The fields to perform the simple_query_string parsed query against. -func (r ApiFindRulesRequest) SearchFields(searchFields FindRulesSearchFieldsParameter) ApiFindRulesRequest { +func (r ApiFindRulesRequest) SearchFields(searchFields string) ApiFindRulesRequest { r.searchFields = &searchFields return r } @@ -1160,7 +1352,7 @@ You must have `read` privileges for the appropriate Kibana features, depending o @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiFindRulesRequest */ -func (a *AlertingAPIService) FindRules(ctx context.Context, spaceId string) ApiFindRulesRequest { +func (a *AlertingAPIService) FindRules(ctx context.Context, spaceId interface{}) ApiFindRulesRequest { return ApiFindRulesRequest{ ApiService: a, ctx: ctx, @@ -1322,7 +1514,7 @@ func (a *AlertingAPIService) FindRulesExecute(r ApiFindRulesRequest) (*FindRules type ApiGetAlertingHealthRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} } func (r ApiGetAlertingHealthRequest) Execute() (*GetAlertingHealth200Response, *http.Response, error) { @@ -1338,7 +1530,7 @@ You must have `read` privileges for the **Management > Stack Rules** feature or @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetAlertingHealthRequest */ -func (a *AlertingAPIService) GetAlertingHealth(ctx context.Context, spaceId string) ApiGetAlertingHealthRequest { +func (a *AlertingAPIService) GetAlertingHealth(ctx context.Context, spaceId interface{}) ApiGetAlertingHealthRequest { return ApiGetAlertingHealthRequest{ ApiService: a, ctx: ctx, @@ -1450,8 +1642,8 @@ func (a *AlertingAPIService) GetAlertingHealthExecute(r ApiGetAlertingHealthRequ type ApiGetRuleRequest struct { ctx context.Context ApiService AlertingAPI - ruleId string - spaceId string + ruleId interface{} + spaceId interface{} } func (r ApiGetRuleRequest) Execute() (*RuleResponseProperties, *http.Response, error) { @@ -1468,7 +1660,7 @@ You must have `read` privileges for the appropriate Kibana features, depending o @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuleRequest */ -func (a *AlertingAPIService) GetRule(ctx context.Context, ruleId string, spaceId string) ApiGetRuleRequest { +func (a *AlertingAPIService) GetRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiGetRuleRequest { return ApiGetRuleRequest{ ApiService: a, ctx: ctx, @@ -1593,7 +1785,7 @@ func (a *AlertingAPIService) GetRuleExecute(r ApiGetRuleRequest) (*RuleResponseP type ApiGetRuleTypesRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} } func (r ApiGetRuleTypesRequest) Execute() ([]GetRuleTypes200ResponseInner, *http.Response, error) { @@ -1609,7 +1801,7 @@ If you have `read` privileges for one or more Kibana features, the API response @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuleTypesRequest */ -func (a *AlertingAPIService) GetRuleTypes(ctx context.Context, spaceId string) ApiGetRuleTypesRequest { +func (a *AlertingAPIService) GetRuleTypes(ctx context.Context, spaceId interface{}) ApiGetRuleTypesRequest { return ApiGetRuleTypesRequest{ ApiService: a, ctx: ctx, @@ -1721,14 +1913,14 @@ func (a *AlertingAPIService) GetRuleTypesExecute(r ApiGetRuleTypesRequest) ([]Ge type ApiLegacyCreateAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string + kbnXsrf *interface{} alertId string - spaceId string + spaceId interface{} legacyCreateAlertRequestProperties *LegacyCreateAlertRequestProperties } // Cross-site request forgery protection -func (r ApiLegacyCreateAlertRequest) KbnXsrf(kbnXsrf string) ApiLegacyCreateAlertRequest { +func (r ApiLegacyCreateAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyCreateAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -1754,7 +1946,7 @@ Deprecated in 7.13.0. Use the create rule API instead. Deprecated */ -func (a *AlertingAPIService) LegacyCreateAlert(ctx context.Context, alertId string, spaceId string) ApiLegacyCreateAlertRequest { +func (a *AlertingAPIService) LegacyCreateAlert(ctx context.Context, alertId string, spaceId interface{}) ApiLegacyCreateAlertRequest { return ApiLegacyCreateAlertRequest{ ApiService: a, ctx: ctx, @@ -1879,13 +2071,13 @@ func (a *AlertingAPIService) LegacyCreateAlertExecute(r ApiLegacyCreateAlertRequ type ApiLegacyDisableAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string } // Cross-site request forgery protection -func (r ApiLegacyDisableAlertRequest) KbnXsrf(kbnXsrf string) ApiLegacyDisableAlertRequest { +func (r ApiLegacyDisableAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyDisableAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -1906,7 +2098,7 @@ Deprecated in 7.13.0. Use the disable rule API instead. Deprecated */ -func (a *AlertingAPIService) LegacyDisableAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyDisableAlertRequest { +func (a *AlertingAPIService) LegacyDisableAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyDisableAlertRequest { return ApiLegacyDisableAlertRequest{ ApiService: a, ctx: ctx, @@ -2013,13 +2205,13 @@ func (a *AlertingAPIService) LegacyDisableAlertExecute(r ApiLegacyDisableAlertRe type ApiLegacyEnableAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string } // Cross-site request forgery protection -func (r ApiLegacyEnableAlertRequest) KbnXsrf(kbnXsrf string) ApiLegacyEnableAlertRequest { +func (r ApiLegacyEnableAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyEnableAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -2040,7 +2232,7 @@ Deprecated in 7.13.0. Use the enable rule API instead. Deprecated */ -func (a *AlertingAPIService) LegacyEnableAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyEnableAlertRequest { +func (a *AlertingAPIService) LegacyEnableAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyEnableAlertRequest { return ApiLegacyEnableAlertRequest{ ApiService: a, ctx: ctx, @@ -2147,15 +2339,15 @@ func (a *AlertingAPIService) LegacyEnableAlertExecute(r ApiLegacyEnableAlertRequ type ApiLegacyFindAlertsRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} defaultSearchOperator *string fields *[]string filter *string - hasReference *FindRulesHasReferenceParameter + hasReference *LegacyFindAlertsHasReferenceParameter page *int32 perPage *int32 search *string - searchFields *FindRulesSearchFieldsParameter + searchFields *string sortField *string sortOrder *string } @@ -2179,7 +2371,7 @@ func (r ApiLegacyFindAlertsRequest) Filter(filter string) ApiLegacyFindAlertsReq } // Filters the rules that have a relation with the reference objects with a specific type and identifier. -func (r ApiLegacyFindAlertsRequest) HasReference(hasReference FindRulesHasReferenceParameter) ApiLegacyFindAlertsRequest { +func (r ApiLegacyFindAlertsRequest) HasReference(hasReference LegacyFindAlertsHasReferenceParameter) ApiLegacyFindAlertsRequest { r.hasReference = &hasReference return r } @@ -2203,7 +2395,7 @@ func (r ApiLegacyFindAlertsRequest) Search(search string) ApiLegacyFindAlertsReq } // The fields to perform the `simple_query_string` parsed query against. -func (r ApiLegacyFindAlertsRequest) SearchFields(searchFields FindRulesSearchFieldsParameter) ApiLegacyFindAlertsRequest { +func (r ApiLegacyFindAlertsRequest) SearchFields(searchFields string) ApiLegacyFindAlertsRequest { r.searchFields = &searchFields return r } @@ -2235,7 +2427,7 @@ Deprecated in 7.13.0. Use the find rules API instead. NOTE: Alert `params` are s Deprecated */ -func (a *AlertingAPIService) LegacyFindAlerts(ctx context.Context, spaceId string) ApiLegacyFindAlertsRequest { +func (a *AlertingAPIService) LegacyFindAlerts(ctx context.Context, spaceId interface{}) ApiLegacyFindAlertsRequest { return ApiLegacyFindAlertsRequest{ ApiService: a, ctx: ctx, @@ -2399,7 +2591,7 @@ func (a *AlertingAPIService) LegacyFindAlertsExecute(r ApiLegacyFindAlertsReques type ApiLegacyGetAlertRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} alertId string } @@ -2419,7 +2611,7 @@ Deprecated in 7.13.0. Use the get rule API instead. Deprecated */ -func (a *AlertingAPIService) LegacyGetAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyGetAlertRequest { +func (a *AlertingAPIService) LegacyGetAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyGetAlertRequest { return ApiLegacyGetAlertRequest{ ApiService: a, ctx: ctx, @@ -2535,7 +2727,7 @@ func (a *AlertingAPIService) LegacyGetAlertExecute(r ApiLegacyGetAlertRequest) ( type ApiLegacyGetAlertTypesRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} } func (r ApiLegacyGetAlertTypesRequest) Execute() ([]LegacyGetAlertTypes200ResponseInner, *http.Response, error) { @@ -2553,7 +2745,7 @@ Deprecated in 7.13.0. Use the get rule types API instead. Deprecated */ -func (a *AlertingAPIService) LegacyGetAlertTypes(ctx context.Context, spaceId string) ApiLegacyGetAlertTypesRequest { +func (a *AlertingAPIService) LegacyGetAlertTypes(ctx context.Context, spaceId interface{}) ApiLegacyGetAlertTypesRequest { return ApiLegacyGetAlertTypesRequest{ ApiService: a, ctx: ctx, @@ -2667,7 +2859,7 @@ func (a *AlertingAPIService) LegacyGetAlertTypesExecute(r ApiLegacyGetAlertTypes type ApiLegacyGetAlertingHealthRequest struct { ctx context.Context ApiService AlertingAPI - spaceId string + spaceId interface{} } func (r ApiLegacyGetAlertingHealthRequest) Execute() (*LegacyGetAlertingHealth200Response, *http.Response, error) { @@ -2685,7 +2877,7 @@ Deprecated in 7.13.0. Use the get alerting framework health API instead. Deprecated */ -func (a *AlertingAPIService) LegacyGetAlertingHealth(ctx context.Context, spaceId string) ApiLegacyGetAlertingHealthRequest { +func (a *AlertingAPIService) LegacyGetAlertingHealth(ctx context.Context, spaceId interface{}) ApiLegacyGetAlertingHealthRequest { return ApiLegacyGetAlertingHealthRequest{ ApiService: a, ctx: ctx, @@ -2799,14 +2991,14 @@ func (a *AlertingAPIService) LegacyGetAlertingHealthExecute(r ApiLegacyGetAlerti type ApiLegacyMuteAlertInstanceRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string alertInstanceId string } // Cross-site request forgery protection -func (r ApiLegacyMuteAlertInstanceRequest) KbnXsrf(kbnXsrf string) ApiLegacyMuteAlertInstanceRequest { +func (r ApiLegacyMuteAlertInstanceRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyMuteAlertInstanceRequest { r.kbnXsrf = &kbnXsrf return r } @@ -2828,7 +3020,7 @@ Deprecated in 7.13.0. Use the mute alert API instead. Deprecated */ -func (a *AlertingAPIService) LegacyMuteAlertInstance(ctx context.Context, spaceId string, alertId string, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest { +func (a *AlertingAPIService) LegacyMuteAlertInstance(ctx context.Context, spaceId interface{}, alertId string, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest { return ApiLegacyMuteAlertInstanceRequest{ ApiService: a, ctx: ctx, @@ -2937,13 +3129,13 @@ func (a *AlertingAPIService) LegacyMuteAlertInstanceExecute(r ApiLegacyMuteAlert type ApiLegacyMuteAllAlertInstancesRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string } // Cross-site request forgery protection -func (r ApiLegacyMuteAllAlertInstancesRequest) KbnXsrf(kbnXsrf string) ApiLegacyMuteAllAlertInstancesRequest { +func (r ApiLegacyMuteAllAlertInstancesRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyMuteAllAlertInstancesRequest { r.kbnXsrf = &kbnXsrf return r } @@ -2964,7 +3156,7 @@ Deprecated in 7.13.0. Use the mute all alerts API instead. Deprecated */ -func (a *AlertingAPIService) LegacyMuteAllAlertInstances(ctx context.Context, spaceId string, alertId string) ApiLegacyMuteAllAlertInstancesRequest { +func (a *AlertingAPIService) LegacyMuteAllAlertInstances(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyMuteAllAlertInstancesRequest { return ApiLegacyMuteAllAlertInstancesRequest{ ApiService: a, ctx: ctx, @@ -3071,14 +3263,14 @@ func (a *AlertingAPIService) LegacyMuteAllAlertInstancesExecute(r ApiLegacyMuteA type ApiLegacyUnmuteAlertInstanceRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string alertInstanceId string } // Cross-site request forgery protection -func (r ApiLegacyUnmuteAlertInstanceRequest) KbnXsrf(kbnXsrf string) ApiLegacyUnmuteAlertInstanceRequest { +func (r ApiLegacyUnmuteAlertInstanceRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyUnmuteAlertInstanceRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3100,7 +3292,7 @@ Deprecated in 7.13.0. Use the unmute alert API instead. Deprecated */ -func (a *AlertingAPIService) LegacyUnmuteAlertInstance(ctx context.Context, spaceId string, alertId string, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest { +func (a *AlertingAPIService) LegacyUnmuteAlertInstance(ctx context.Context, spaceId interface{}, alertId string, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest { return ApiLegacyUnmuteAlertInstanceRequest{ ApiService: a, ctx: ctx, @@ -3209,13 +3401,13 @@ func (a *AlertingAPIService) LegacyUnmuteAlertInstanceExecute(r ApiLegacyUnmuteA type ApiLegacyUnmuteAllAlertInstancesRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string } // Cross-site request forgery protection -func (r ApiLegacyUnmuteAllAlertInstancesRequest) KbnXsrf(kbnXsrf string) ApiLegacyUnmuteAllAlertInstancesRequest { +func (r ApiLegacyUnmuteAllAlertInstancesRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyUnmuteAllAlertInstancesRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3236,7 +3428,7 @@ Deprecated in 7.13.0. Use the unmute all alerts API instead. Deprecated */ -func (a *AlertingAPIService) LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId string, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest { +func (a *AlertingAPIService) LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest { return ApiLegacyUnmuteAllAlertInstancesRequest{ ApiService: a, ctx: ctx, @@ -3343,14 +3535,14 @@ func (a *AlertingAPIService) LegacyUnmuteAllAlertInstancesExecute(r ApiLegacyUnm type ApiLegacyUpdateAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string legacyUpdateAlertRequestProperties *LegacyUpdateAlertRequestProperties } // Cross-site request forgery protection -func (r ApiLegacyUpdateAlertRequest) KbnXsrf(kbnXsrf string) ApiLegacyUpdateAlertRequest { +func (r ApiLegacyUpdateAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiLegacyUpdateAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3376,7 +3568,7 @@ Deprecated in 7.13.0. Use the update rule API instead. Deprecated */ -func (a *AlertingAPIService) LegacyUpdateAlert(ctx context.Context, spaceId string, alertId string) ApiLegacyUpdateAlertRequest { +func (a *AlertingAPIService) LegacyUpdateAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegacyUpdateAlertRequest { return ApiLegacyUpdateAlertRequest{ ApiService: a, ctx: ctx, @@ -3501,13 +3693,13 @@ func (a *AlertingAPIService) LegacyUpdateAlertExecute(r ApiLegacyUpdateAlertRequ type ApiLegaryDeleteAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - spaceId string + kbnXsrf *interface{} + spaceId interface{} alertId string } // Cross-site request forgery protection -func (r ApiLegaryDeleteAlertRequest) KbnXsrf(kbnXsrf string) ApiLegaryDeleteAlertRequest { +func (r ApiLegaryDeleteAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiLegaryDeleteAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3528,7 +3720,7 @@ Deprecated in 7.13.0. Use the delete rule API instead. WARNING: After you delete Deprecated */ -func (a *AlertingAPIService) LegaryDeleteAlert(ctx context.Context, spaceId string, alertId string) ApiLegaryDeleteAlertRequest { +func (a *AlertingAPIService) LegaryDeleteAlert(ctx context.Context, spaceId interface{}, alertId string) ApiLegaryDeleteAlertRequest { return ApiLegaryDeleteAlertRequest{ ApiService: a, ctx: ctx, @@ -3635,14 +3827,14 @@ func (a *AlertingAPIService) LegaryDeleteAlertExecute(r ApiLegaryDeleteAlertRequ type ApiMuteAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - alertId string - ruleId string - spaceId string + kbnXsrf *interface{} + alertId interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiMuteAlertRequest) KbnXsrf(kbnXsrf string) ApiMuteAlertRequest { +func (r ApiMuteAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiMuteAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3662,7 +3854,7 @@ You must have `all` privileges for the appropriate Kibana features, depending on @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiMuteAlertRequest */ -func (a *AlertingAPIService) MuteAlert(ctx context.Context, alertId string, ruleId string, spaceId string) ApiMuteAlertRequest { +func (a *AlertingAPIService) MuteAlert(ctx context.Context, alertId interface{}, ruleId interface{}, spaceId interface{}) ApiMuteAlertRequest { return ApiMuteAlertRequest{ ApiService: a, ctx: ctx, @@ -3770,13 +3962,13 @@ func (a *AlertingAPIService) MuteAlertExecute(r ApiMuteAlertRequest) (*http.Resp type ApiMuteAllAlertsRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiMuteAllAlertsRequest) KbnXsrf(kbnXsrf string) ApiMuteAllAlertsRequest { +func (r ApiMuteAllAlertsRequest) KbnXsrf(kbnXsrf interface{}) ApiMuteAllAlertsRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3795,7 +3987,7 @@ This API snoozes the notifications for the rule indefinitely. The rule checks co @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiMuteAllAlertsRequest */ -func (a *AlertingAPIService) MuteAllAlerts(ctx context.Context, ruleId string, spaceId string) ApiMuteAllAlertsRequest { +func (a *AlertingAPIService) MuteAllAlerts(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiMuteAllAlertsRequest { return ApiMuteAllAlertsRequest{ ApiService: a, ctx: ctx, @@ -3901,14 +4093,14 @@ func (a *AlertingAPIService) MuteAllAlertsExecute(r ApiMuteAllAlertsRequest) (*h type ApiUnmuteAlertRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - alertId string - ruleId string - spaceId string + kbnXsrf *interface{} + alertId interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiUnmuteAlertRequest) KbnXsrf(kbnXsrf string) ApiUnmuteAlertRequest { +func (r ApiUnmuteAlertRequest) KbnXsrf(kbnXsrf interface{}) ApiUnmuteAlertRequest { r.kbnXsrf = &kbnXsrf return r } @@ -3928,7 +4120,7 @@ You must have `all` privileges for the appropriate Kibana features, depending on @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUnmuteAlertRequest */ -func (a *AlertingAPIService) UnmuteAlert(ctx context.Context, alertId string, ruleId string, spaceId string) ApiUnmuteAlertRequest { +func (a *AlertingAPIService) UnmuteAlert(ctx context.Context, alertId interface{}, ruleId interface{}, spaceId interface{}) ApiUnmuteAlertRequest { return ApiUnmuteAlertRequest{ ApiService: a, ctx: ctx, @@ -4036,13 +4228,13 @@ func (a *AlertingAPIService) UnmuteAlertExecute(r ApiUnmuteAlertRequest) (*http. type ApiUnmuteAllAlertsRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} } // Cross-site request forgery protection -func (r ApiUnmuteAllAlertsRequest) KbnXsrf(kbnXsrf string) ApiUnmuteAllAlertsRequest { +func (r ApiUnmuteAllAlertsRequest) KbnXsrf(kbnXsrf interface{}) ApiUnmuteAllAlertsRequest { r.kbnXsrf = &kbnXsrf return r } @@ -4061,7 +4253,7 @@ If the rule has its notifications snoozed indefinitely, this API cancels the sno @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUnmuteAllAlertsRequest */ -func (a *AlertingAPIService) UnmuteAllAlerts(ctx context.Context, ruleId string, spaceId string) ApiUnmuteAllAlertsRequest { +func (a *AlertingAPIService) UnmuteAllAlerts(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUnmuteAllAlertsRequest { return ApiUnmuteAllAlertsRequest{ ApiService: a, ctx: ctx, @@ -4167,14 +4359,14 @@ func (a *AlertingAPIService) UnmuteAllAlertsExecute(r ApiUnmuteAllAlertsRequest) type ApiUpdateRuleRequest struct { ctx context.Context ApiService AlertingAPI - kbnXsrf *string - ruleId string - spaceId string + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} updateRuleRequest *UpdateRuleRequest } // Cross-site request forgery protection -func (r ApiUpdateRuleRequest) KbnXsrf(kbnXsrf string) ApiUpdateRuleRequest { +func (r ApiUpdateRuleRequest) KbnXsrf(kbnXsrf interface{}) ApiUpdateRuleRequest { r.kbnXsrf = &kbnXsrf return r } @@ -4191,14 +4383,14 @@ func (r ApiUpdateRuleRequest) Execute() (*RuleResponseProperties, *http.Response /* UpdateRule Updates the attributes for a rule. -You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. +To update a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. NOTE: If the API key has different privileges than the key that created or most recently updated the rule, the rule behavior might change. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param ruleId An identifier for the rule. @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateRuleRequest */ -func (a *AlertingAPIService) UpdateRule(ctx context.Context, ruleId string, spaceId string) ApiUpdateRuleRequest { +func (a *AlertingAPIService) UpdateRule(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUpdateRuleRequest { return ApiUpdateRuleRequest{ ApiService: a, ctx: ctx, @@ -4328,3 +4520,134 @@ func (a *AlertingAPIService) UpdateRuleExecute(r ApiUpdateRuleRequest) (*RuleRes return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiUpdateRuleAPIKeyRequest struct { + ctx context.Context + ApiService AlertingAPI + kbnXsrf *interface{} + ruleId interface{} + spaceId interface{} +} + +// Cross-site request forgery protection +func (r ApiUpdateRuleAPIKeyRequest) KbnXsrf(kbnXsrf interface{}) ApiUpdateRuleAPIKeyRequest { + r.kbnXsrf = &kbnXsrf + return r +} + +func (r ApiUpdateRuleAPIKeyRequest) Execute() (*http.Response, error) { + return r.ApiService.UpdateRuleAPIKeyExecute(r) +} + +/* +UpdateRuleAPIKey Updates the API key for a rule. + +The new API key has the credentials of the user that submits the request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ruleId An identifier for the rule. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiUpdateRuleAPIKeyRequest +*/ +func (a *AlertingAPIService) UpdateRuleAPIKey(ctx context.Context, ruleId interface{}, spaceId interface{}) ApiUpdateRuleAPIKeyRequest { + return ApiUpdateRuleAPIKeyRequest{ + ApiService: a, + ctx: ctx, + ruleId: ruleId, + spaceId: spaceId, + } +} + +// Execute executes the request +func (a *AlertingAPIService) UpdateRuleAPIKeyExecute(r ApiUpdateRuleAPIKeyRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AlertingAPIService.UpdateRuleAPIKey") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/s/{spaceId}/api/alerting/rule/{ruleId}/_update_api_key" + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", url.PathEscape(parameterValueToString(r.ruleId, "ruleId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return nil, reportError("kbnXsrf is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/generated/alerting/api_alerting_mocks.go b/generated/alerting/api_alerting_mocks.go index 6b5c46555..ffab4e81f 100644 --- a/generated/alerting/api_alerting_mocks.go +++ b/generated/alerting/api_alerting_mocks.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: ../generated/alerting/api_alerting.go +// Source: ./api_alerting.go // // Generated by this command: // -// mockgen -destination=../generated/alerting/api_alerting_mocks.go -package=alerting -source ../generated/alerting/api_alerting.go AlertingAPI +// mockgen -destination=./api_alerting_mocks.go -package=alerting -source ./api_alerting.go AlertingAPI // // Package alerting is a generated GoMock package. @@ -41,17 +41,17 @@ func (m *MockAlertingAPI) EXPECT() *MockAlertingAPIMockRecorder { } // CreateRule mocks base method. -func (m *MockAlertingAPI) CreateRule(ctx context.Context, spaceId, ruleId string) ApiCreateRuleRequest { +func (m *MockAlertingAPI) CreateRule(ctx context.Context, spaceId any) ApiCreateRuleRequest { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRule", ctx, spaceId, ruleId) + ret := m.ctrl.Call(m, "CreateRule", ctx, spaceId) ret0, _ := ret[0].(ApiCreateRuleRequest) return ret0 } // CreateRule indicates an expected call of CreateRule. -func (mr *MockAlertingAPIMockRecorder) CreateRule(ctx, spaceId, ruleId any) *gomock.Call { +func (mr *MockAlertingAPIMockRecorder) CreateRule(ctx, spaceId any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRule", reflect.TypeOf((*MockAlertingAPI)(nil).CreateRule), ctx, spaceId, ruleId) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRule", reflect.TypeOf((*MockAlertingAPI)(nil).CreateRule), ctx, spaceId) } // CreateRuleExecute mocks base method. @@ -70,8 +70,38 @@ func (mr *MockAlertingAPIMockRecorder) CreateRuleExecute(r any) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRuleExecute", reflect.TypeOf((*MockAlertingAPI)(nil).CreateRuleExecute), r) } +// CreateRuleId mocks base method. +func (m *MockAlertingAPI) CreateRuleId(ctx context.Context, spaceId any, ruleId string) ApiCreateRuleIdRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRuleId", ctx, spaceId, ruleId) + ret0, _ := ret[0].(ApiCreateRuleIdRequest) + return ret0 +} + +// CreateRuleId indicates an expected call of CreateRuleId. +func (mr *MockAlertingAPIMockRecorder) CreateRuleId(ctx, spaceId, ruleId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRuleId", reflect.TypeOf((*MockAlertingAPI)(nil).CreateRuleId), ctx, spaceId, ruleId) +} + +// CreateRuleIdExecute mocks base method. +func (m *MockAlertingAPI) CreateRuleIdExecute(r ApiCreateRuleIdRequest) (*RuleResponseProperties, *http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRuleIdExecute", r) + ret0, _ := ret[0].(*RuleResponseProperties) + ret1, _ := ret[1].(*http.Response) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CreateRuleIdExecute indicates an expected call of CreateRuleIdExecute. +func (mr *MockAlertingAPIMockRecorder) CreateRuleIdExecute(r any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRuleIdExecute", reflect.TypeOf((*MockAlertingAPI)(nil).CreateRuleIdExecute), r) +} + // DeleteRule mocks base method. -func (m *MockAlertingAPI) DeleteRule(ctx context.Context, ruleId, spaceId string) ApiDeleteRuleRequest { +func (m *MockAlertingAPI) DeleteRule(ctx context.Context, ruleId, spaceId any) ApiDeleteRuleRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteRule", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiDeleteRuleRequest) @@ -100,7 +130,7 @@ func (mr *MockAlertingAPIMockRecorder) DeleteRuleExecute(r any) *gomock.Call { } // DisableRule mocks base method. -func (m *MockAlertingAPI) DisableRule(ctx context.Context, ruleId, spaceId string) ApiDisableRuleRequest { +func (m *MockAlertingAPI) DisableRule(ctx context.Context, ruleId, spaceId any) ApiDisableRuleRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DisableRule", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiDisableRuleRequest) @@ -129,7 +159,7 @@ func (mr *MockAlertingAPIMockRecorder) DisableRuleExecute(r any) *gomock.Call { } // EnableRule mocks base method. -func (m *MockAlertingAPI) EnableRule(ctx context.Context, ruleId, spaceId string) ApiEnableRuleRequest { +func (m *MockAlertingAPI) EnableRule(ctx context.Context, ruleId, spaceId any) ApiEnableRuleRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "EnableRule", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiEnableRuleRequest) @@ -158,7 +188,7 @@ func (mr *MockAlertingAPIMockRecorder) EnableRuleExecute(r any) *gomock.Call { } // FindRules mocks base method. -func (m *MockAlertingAPI) FindRules(ctx context.Context, spaceId string) ApiFindRulesRequest { +func (m *MockAlertingAPI) FindRules(ctx context.Context, spaceId any) ApiFindRulesRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "FindRules", ctx, spaceId) ret0, _ := ret[0].(ApiFindRulesRequest) @@ -188,7 +218,7 @@ func (mr *MockAlertingAPIMockRecorder) FindRulesExecute(r any) *gomock.Call { } // GetAlertingHealth mocks base method. -func (m *MockAlertingAPI) GetAlertingHealth(ctx context.Context, spaceId string) ApiGetAlertingHealthRequest { +func (m *MockAlertingAPI) GetAlertingHealth(ctx context.Context, spaceId any) ApiGetAlertingHealthRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAlertingHealth", ctx, spaceId) ret0, _ := ret[0].(ApiGetAlertingHealthRequest) @@ -218,7 +248,7 @@ func (mr *MockAlertingAPIMockRecorder) GetAlertingHealthExecute(r any) *gomock.C } // GetRule mocks base method. -func (m *MockAlertingAPI) GetRule(ctx context.Context, ruleId, spaceId string) ApiGetRuleRequest { +func (m *MockAlertingAPI) GetRule(ctx context.Context, ruleId, spaceId any) ApiGetRuleRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRule", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiGetRuleRequest) @@ -248,7 +278,7 @@ func (mr *MockAlertingAPIMockRecorder) GetRuleExecute(r any) *gomock.Call { } // GetRuleTypes mocks base method. -func (m *MockAlertingAPI) GetRuleTypes(ctx context.Context, spaceId string) ApiGetRuleTypesRequest { +func (m *MockAlertingAPI) GetRuleTypes(ctx context.Context, spaceId any) ApiGetRuleTypesRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRuleTypes", ctx, spaceId) ret0, _ := ret[0].(ApiGetRuleTypesRequest) @@ -278,7 +308,7 @@ func (mr *MockAlertingAPIMockRecorder) GetRuleTypesExecute(r any) *gomock.Call { } // LegacyCreateAlert mocks base method. -func (m *MockAlertingAPI) LegacyCreateAlert(ctx context.Context, alertId, spaceId string) ApiLegacyCreateAlertRequest { +func (m *MockAlertingAPI) LegacyCreateAlert(ctx context.Context, alertId string, spaceId any) ApiLegacyCreateAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyCreateAlert", ctx, alertId, spaceId) ret0, _ := ret[0].(ApiLegacyCreateAlertRequest) @@ -308,7 +338,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyCreateAlertExecute(r any) *gomock.C } // LegacyDisableAlert mocks base method. -func (m *MockAlertingAPI) LegacyDisableAlert(ctx context.Context, spaceId, alertId string) ApiLegacyDisableAlertRequest { +func (m *MockAlertingAPI) LegacyDisableAlert(ctx context.Context, spaceId any, alertId string) ApiLegacyDisableAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyDisableAlert", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyDisableAlertRequest) @@ -337,7 +367,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyDisableAlertExecute(r any) *gomock. } // LegacyEnableAlert mocks base method. -func (m *MockAlertingAPI) LegacyEnableAlert(ctx context.Context, spaceId, alertId string) ApiLegacyEnableAlertRequest { +func (m *MockAlertingAPI) LegacyEnableAlert(ctx context.Context, spaceId any, alertId string) ApiLegacyEnableAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyEnableAlert", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyEnableAlertRequest) @@ -366,7 +396,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyEnableAlertExecute(r any) *gomock.C } // LegacyFindAlerts mocks base method. -func (m *MockAlertingAPI) LegacyFindAlerts(ctx context.Context, spaceId string) ApiLegacyFindAlertsRequest { +func (m *MockAlertingAPI) LegacyFindAlerts(ctx context.Context, spaceId any) ApiLegacyFindAlertsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyFindAlerts", ctx, spaceId) ret0, _ := ret[0].(ApiLegacyFindAlertsRequest) @@ -396,7 +426,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyFindAlertsExecute(r any) *gomock.Ca } // LegacyGetAlert mocks base method. -func (m *MockAlertingAPI) LegacyGetAlert(ctx context.Context, spaceId, alertId string) ApiLegacyGetAlertRequest { +func (m *MockAlertingAPI) LegacyGetAlert(ctx context.Context, spaceId any, alertId string) ApiLegacyGetAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyGetAlert", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyGetAlertRequest) @@ -426,7 +456,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyGetAlertExecute(r any) *gomock.Call } // LegacyGetAlertTypes mocks base method. -func (m *MockAlertingAPI) LegacyGetAlertTypes(ctx context.Context, spaceId string) ApiLegacyGetAlertTypesRequest { +func (m *MockAlertingAPI) LegacyGetAlertTypes(ctx context.Context, spaceId any) ApiLegacyGetAlertTypesRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyGetAlertTypes", ctx, spaceId) ret0, _ := ret[0].(ApiLegacyGetAlertTypesRequest) @@ -456,7 +486,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyGetAlertTypesExecute(r any) *gomock } // LegacyGetAlertingHealth mocks base method. -func (m *MockAlertingAPI) LegacyGetAlertingHealth(ctx context.Context, spaceId string) ApiLegacyGetAlertingHealthRequest { +func (m *MockAlertingAPI) LegacyGetAlertingHealth(ctx context.Context, spaceId any) ApiLegacyGetAlertingHealthRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyGetAlertingHealth", ctx, spaceId) ret0, _ := ret[0].(ApiLegacyGetAlertingHealthRequest) @@ -486,7 +516,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyGetAlertingHealthExecute(r any) *go } // LegacyMuteAlertInstance mocks base method. -func (m *MockAlertingAPI) LegacyMuteAlertInstance(ctx context.Context, spaceId, alertId, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest { +func (m *MockAlertingAPI) LegacyMuteAlertInstance(ctx context.Context, spaceId any, alertId, alertInstanceId string) ApiLegacyMuteAlertInstanceRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyMuteAlertInstance", ctx, spaceId, alertId, alertInstanceId) ret0, _ := ret[0].(ApiLegacyMuteAlertInstanceRequest) @@ -515,7 +545,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyMuteAlertInstanceExecute(r any) *go } // LegacyMuteAllAlertInstances mocks base method. -func (m *MockAlertingAPI) LegacyMuteAllAlertInstances(ctx context.Context, spaceId, alertId string) ApiLegacyMuteAllAlertInstancesRequest { +func (m *MockAlertingAPI) LegacyMuteAllAlertInstances(ctx context.Context, spaceId any, alertId string) ApiLegacyMuteAllAlertInstancesRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyMuteAllAlertInstances", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyMuteAllAlertInstancesRequest) @@ -544,7 +574,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyMuteAllAlertInstancesExecute(r any) } // LegacyUnmuteAlertInstance mocks base method. -func (m *MockAlertingAPI) LegacyUnmuteAlertInstance(ctx context.Context, spaceId, alertId, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest { +func (m *MockAlertingAPI) LegacyUnmuteAlertInstance(ctx context.Context, spaceId any, alertId, alertInstanceId string) ApiLegacyUnmuteAlertInstanceRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyUnmuteAlertInstance", ctx, spaceId, alertId, alertInstanceId) ret0, _ := ret[0].(ApiLegacyUnmuteAlertInstanceRequest) @@ -573,7 +603,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyUnmuteAlertInstanceExecute(r any) * } // LegacyUnmuteAllAlertInstances mocks base method. -func (m *MockAlertingAPI) LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest { +func (m *MockAlertingAPI) LegacyUnmuteAllAlertInstances(ctx context.Context, spaceId any, alertId string) ApiLegacyUnmuteAllAlertInstancesRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyUnmuteAllAlertInstances", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyUnmuteAllAlertInstancesRequest) @@ -602,7 +632,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyUnmuteAllAlertInstancesExecute(r an } // LegacyUpdateAlert mocks base method. -func (m *MockAlertingAPI) LegacyUpdateAlert(ctx context.Context, spaceId, alertId string) ApiLegacyUpdateAlertRequest { +func (m *MockAlertingAPI) LegacyUpdateAlert(ctx context.Context, spaceId any, alertId string) ApiLegacyUpdateAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegacyUpdateAlert", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegacyUpdateAlertRequest) @@ -632,7 +662,7 @@ func (mr *MockAlertingAPIMockRecorder) LegacyUpdateAlertExecute(r any) *gomock.C } // LegaryDeleteAlert mocks base method. -func (m *MockAlertingAPI) LegaryDeleteAlert(ctx context.Context, spaceId, alertId string) ApiLegaryDeleteAlertRequest { +func (m *MockAlertingAPI) LegaryDeleteAlert(ctx context.Context, spaceId any, alertId string) ApiLegaryDeleteAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LegaryDeleteAlert", ctx, spaceId, alertId) ret0, _ := ret[0].(ApiLegaryDeleteAlertRequest) @@ -661,7 +691,7 @@ func (mr *MockAlertingAPIMockRecorder) LegaryDeleteAlertExecute(r any) *gomock.C } // MuteAlert mocks base method. -func (m *MockAlertingAPI) MuteAlert(ctx context.Context, alertId, ruleId, spaceId string) ApiMuteAlertRequest { +func (m *MockAlertingAPI) MuteAlert(ctx context.Context, alertId, ruleId, spaceId any) ApiMuteAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MuteAlert", ctx, alertId, ruleId, spaceId) ret0, _ := ret[0].(ApiMuteAlertRequest) @@ -690,7 +720,7 @@ func (mr *MockAlertingAPIMockRecorder) MuteAlertExecute(r any) *gomock.Call { } // MuteAllAlerts mocks base method. -func (m *MockAlertingAPI) MuteAllAlerts(ctx context.Context, ruleId, spaceId string) ApiMuteAllAlertsRequest { +func (m *MockAlertingAPI) MuteAllAlerts(ctx context.Context, ruleId, spaceId any) ApiMuteAllAlertsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MuteAllAlerts", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiMuteAllAlertsRequest) @@ -719,7 +749,7 @@ func (mr *MockAlertingAPIMockRecorder) MuteAllAlertsExecute(r any) *gomock.Call } // UnmuteAlert mocks base method. -func (m *MockAlertingAPI) UnmuteAlert(ctx context.Context, alertId, ruleId, spaceId string) ApiUnmuteAlertRequest { +func (m *MockAlertingAPI) UnmuteAlert(ctx context.Context, alertId, ruleId, spaceId any) ApiUnmuteAlertRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UnmuteAlert", ctx, alertId, ruleId, spaceId) ret0, _ := ret[0].(ApiUnmuteAlertRequest) @@ -748,7 +778,7 @@ func (mr *MockAlertingAPIMockRecorder) UnmuteAlertExecute(r any) *gomock.Call { } // UnmuteAllAlerts mocks base method. -func (m *MockAlertingAPI) UnmuteAllAlerts(ctx context.Context, ruleId, spaceId string) ApiUnmuteAllAlertsRequest { +func (m *MockAlertingAPI) UnmuteAllAlerts(ctx context.Context, ruleId, spaceId any) ApiUnmuteAllAlertsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UnmuteAllAlerts", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiUnmuteAllAlertsRequest) @@ -777,7 +807,7 @@ func (mr *MockAlertingAPIMockRecorder) UnmuteAllAlertsExecute(r any) *gomock.Cal } // UpdateRule mocks base method. -func (m *MockAlertingAPI) UpdateRule(ctx context.Context, ruleId, spaceId string) ApiUpdateRuleRequest { +func (m *MockAlertingAPI) UpdateRule(ctx context.Context, ruleId, spaceId any) ApiUpdateRuleRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateRule", ctx, ruleId, spaceId) ret0, _ := ret[0].(ApiUpdateRuleRequest) @@ -790,6 +820,35 @@ func (mr *MockAlertingAPIMockRecorder) UpdateRule(ctx, ruleId, spaceId any) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRule", reflect.TypeOf((*MockAlertingAPI)(nil).UpdateRule), ctx, ruleId, spaceId) } +// UpdateRuleAPIKey mocks base method. +func (m *MockAlertingAPI) UpdateRuleAPIKey(ctx context.Context, ruleId, spaceId any) ApiUpdateRuleAPIKeyRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRuleAPIKey", ctx, ruleId, spaceId) + ret0, _ := ret[0].(ApiUpdateRuleAPIKeyRequest) + return ret0 +} + +// UpdateRuleAPIKey indicates an expected call of UpdateRuleAPIKey. +func (mr *MockAlertingAPIMockRecorder) UpdateRuleAPIKey(ctx, ruleId, spaceId any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRuleAPIKey", reflect.TypeOf((*MockAlertingAPI)(nil).UpdateRuleAPIKey), ctx, ruleId, spaceId) +} + +// UpdateRuleAPIKeyExecute mocks base method. +func (m *MockAlertingAPI) UpdateRuleAPIKeyExecute(r ApiUpdateRuleAPIKeyRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRuleAPIKeyExecute", r) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRuleAPIKeyExecute indicates an expected call of UpdateRuleAPIKeyExecute. +func (mr *MockAlertingAPIMockRecorder) UpdateRuleAPIKeyExecute(r any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRuleAPIKeyExecute", reflect.TypeOf((*MockAlertingAPI)(nil).UpdateRuleAPIKeyExecute), r) +} + // UpdateRuleExecute mocks base method. func (m *MockAlertingAPI) UpdateRuleExecute(r ApiUpdateRuleRequest) (*RuleResponseProperties, *http.Response, error) { m.ctrl.T.Helper() diff --git a/generated/alerting/bundled.yaml b/generated/alerting/bundled.yaml index f544423f3..07c6e06a8 100644 --- a/generated/alerting/bundled.yaml +++ b/generated/alerting/bundled.yaml @@ -1,20 +1,80 @@ -openapi: 3.0.1 +openapi: 3.1.0 info: title: Alerting description: OpenAPI schema for alerting endpoints - version: '0.1' + version: '0.2' contact: name: Alerting Team license: name: Elastic License 2.0 url: https://www.elastic.co/licensing/elastic-license +servers: + - url: / +security: + - basicAuth: [] + - apiKeyAuth: [] tags: - name: alerting description: Alerting APIs enable you to create and manage rules and alerts. -servers: - - url: http://localhost:5601 - description: local paths: + /s/{spaceId}/api/alerting/rule: + post: + summary: Creates a rule with a randomly generated rule identifier. + operationId: createRule + description: | + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/create_rule_request' + examples: + createEsQueryEsqlRuleRequest: + $ref: '#/components/examples/create_es_query_esql_rule_request' + createEsQueryRuleRequest: + $ref: '#/components/examples/create_es_query_rule_request' + createEsQueryKqlRuleRequest: + $ref: '#/components/examples/create_es_query_kql_rule_request' + createIndexThresholdRuleRequest: + $ref: '#/components/examples/create_index_threshold_rule_request' + createTrackingContainmentRuleRequest: + $ref: '#/components/examples/create_tracking_containment_rule_request' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '#/components/schemas/rule_response_properties' + examples: + createEsQueryEsqlRuleResponse: + $ref: '#/components/examples/create_es_query_esql_rule_response' + createEsQueryRuleResponse: + $ref: '#/components/examples/create_es_query_rule_response' + createEsQueryKqlRuleResponse: + $ref: '#/components/examples/create_es_query_kql_rule_response' + createIndexThresholdRuleResponse: + $ref: '#/components/examples/create_index_threshold_rule_response' + createTrackingContainmentRuleResponse: + $ref: '#/components/examples/create_tracking_containment_rule_response' + '401': + description: Authorization information is missing or invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + '404': + description: Object is not found. + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' /s/{spaceId}/api/alerting/rule/{ruleId}: get: summary: Retrieves a rule by its identifier. @@ -48,13 +108,11 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - servers: - - url: https://localhost:5601 delete: summary: Deletes a rule. operationId: deleteRule description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. + To delete a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. If the API key that is used by the rule was created automatically, it is deleted. tags: - alerting parameters: @@ -76,13 +134,11 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - servers: - - url: https://localhost:5601 post: - summary: Creates a rule. - operationId: createRule + summary: Creates a rule with a specific rule identifier. + operationId: createRuleId description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you create a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If a user with different privileges updates the rule, its behavior might change. + To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. tags: - alerting parameters: @@ -95,7 +151,8 @@ paths: required: true schema: type: string - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + examples: + - ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 requestBody: required: true content: @@ -103,8 +160,14 @@ paths: schema: $ref: '#/components/schemas/create_rule_request' examples: - createCaseRequest: - $ref: '#/components/examples/create_rule_request' + createEsQueryEsqlRuleIdRequest: + $ref: '#/components/examples/create_es_query_esql_rule_request' + createEsQueryRuleIdRequest: + $ref: '#/components/examples/create_es_query_rule_request' + createEsQueryKqlRuleIdRequest: + $ref: '#/components/examples/create_es_query_kql_rule_request' + createIndexThreholdRuleIdRequest: + $ref: '#/components/examples/create_index_threshold_rule_request' responses: '200': description: Indicates a successful call. @@ -113,8 +176,14 @@ paths: schema: $ref: '#/components/schemas/rule_response_properties' examples: - createRuleResponse: - $ref: '#/components/examples/create_rule_response' + createEsQueryEsqlRuleIdResponse: + $ref: '#/components/examples/create_es_query_esql_rule_response' + createEsQueryRuleIdResponse: + $ref: '#/components/examples/create_es_query_rule_response' + createEsQueryKqlRuleIdResponse: + $ref: '#/components/examples/create_es_query_kql_rule_response' + createIndexThresholdRuleIdResponse: + $ref: '#/components/examples/create_index_threshold_rule_response' '401': description: Authorization information is missing or invalid. content: @@ -127,13 +196,11 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - servers: - - url: https://localhost:5601 put: summary: Updates the attributes for a rule. operationId: updateRule description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. + To update a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. NOTE: If the API key has different privileges than the key that created or most recently updated the rule, the rule behavior might change. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. tags: - alerting parameters: @@ -147,7 +214,7 @@ paths: schema: $ref: '#/components/schemas/update_rule_request' examples: - updateCaseRequest: + updateRuleRequest: $ref: '#/components/examples/update_rule_request' responses: '200': @@ -171,10 +238,6 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_disable: post: summary: Disables a rule. @@ -202,16 +265,12 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_enable: post: summary: Enables a rule. operationId: enableRule description: | - This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. + To enable a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. This API supports both key- and token-based authentication. To use key-based authentication, create an API key in Kibana and use it in the header of the API call. To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically. In both cases, the API key is subsequently used for authorization when the rule runs. tags: - alerting parameters: @@ -233,10 +292,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rules/_find: get: summary: Retrieves information about rules. @@ -253,7 +308,8 @@ paths: schema: type: string default: OR - example: OR + examples: + - AND - name: fields in: query description: The fields to return in the `attributes` key of the response. @@ -283,25 +339,31 @@ paths: schema: type: integer default: 1 - example: 1 + examples: + - 1 - name: per_page in: query description: The number of rules to return per page. schema: type: integer default: 20 - example: 20 + examples: + - 20 - name: search in: query description: An Elasticsearch simple_query_string query that filters the objects in the response. schema: type: string + examples: + - threshold +-test* - name: search_fields in: query description: The fields to perform the simple_query_string parsed query against. schema: oneOf: - type: string + examples: + - name - type: array items: type: string @@ -320,7 +382,8 @@ paths: - asc - desc default: desc - example: asc + examples: + - asc responses: '200': description: Indicates a successful call. @@ -342,16 +405,14 @@ paths: examples: findRulesResponse: $ref: '#/components/examples/find_rules_response' + findConditionalActionRulesResponse: + $ref: '#/components/examples/find_rules_response_conditional_action' '401': description: Authorization information is missing or invalid. content: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/_health: get: summary: Retrieves the health status of the alerting framework. @@ -370,44 +431,6 @@ paths: schema: type: object properties: - alerting_framework_heath: - type: object - description: This property has a typo. Use `alerting_framework_health` instead. - deprecated: true - properties: - _deprecated: - type: string - example: This state property has a typo, use "alerting_framework_health" instead. - decryption_health: - type: object - properties: - status: - type: string - example: ok - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' - execution_health: - type: object - properties: - status: - type: string - example: ok - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' - read_health: - type: object - properties: - status: - type: string - example: ok - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' alerting_framework_health: type: object description: | @@ -419,7 +442,8 @@ paths: properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -427,14 +451,16 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' execution_health: type: object description: The timestamp and status of the rule run. properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -442,14 +468,16 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' read_health: type: object description: The timestamp and status of the rule reading events. properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -457,15 +485,18 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' has_permanent_encryption_key: type: boolean description: If `false`, the encrypted saved object plugin does not have a permanent encryption key. - example: true + examples: + - true is_sufficiently_secure: type: boolean description: If `false`, security is enabled but TLS is not. - example: true + examples: + - true examples: getAlertingHealthResponse: $ref: '#/components/examples/get_health_response' @@ -475,8 +506,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule_types: get: summary: Retrieves a list of rule types. @@ -542,6 +571,63 @@ paths: type: string name: type: string + alerts: + type: object + description: | + Details for writing alerts as data documents for this rule type. + properties: + context: + type: string + description: | + The namespace for this rule type. + enum: + - ml.anomaly-detection + - observability.apm + - observability.logs + - observability.metrics + - observability.slo + - observability.threshold + - observability.uptime + - security + - stack + dynamic: + type: string + description: Indicates whether new fields are added dynamically. + enum: + - 'false' + - runtime + - strict + - 'true' + isSpaceAware: + type: boolean + description: | + Indicates whether the alerts are space-aware. If true, space-specific alert indices are used. + mappings: + type: object + properties: + fieldMap: + type: object + description: | + Mapping information for each field supported in alerts as data documents for this rule type. For more information about mapping parameters, refer to the Elasticsearch documentation. + additionalProperties: + $ref: '#/components/schemas/fieldmap_properties' + secondaryAlias: + type: string + description: | + A secondary alias. It is typically used to support the signals alias for detection rules. + shouldWrite: + type: boolean + description: | + Indicates whether the rule should write out alerts as data. + useEcs: + type: boolean + description: | + Indicates whether to include the ECS component template for the alerts. + useLegacyAlerts: + type: boolean + default: false + description: | + Indicates whether to include the legacy component template for the alerts. authorized_consumers: description: The list of the plugins IDs that have access to the rule type. type: object @@ -602,6 +688,13 @@ paths: type: boolean read: type: boolean + slo: + type: object + properties: + all: + type: boolean + read: + type: boolean stackAlerts: type: object properties: @@ -616,6 +709,13 @@ paths: type: boolean read: type: boolean + category: + type: string + description: The rule category, which is used by features such as category-specific maintenance windows. + enum: + - management + - observability + - securitySolution default_action_group_id: description: The default identifier for the rule type group. type: string @@ -625,6 +725,11 @@ paths: enabled_in_license: description: Indicates whether the rule type is enabled or disabled based on the subscription. type: boolean + has_alerts_mappings: + type: boolean + description: Indicates whether the rule type has custom mappings for the alert data. + has_fields_for_a_a_d: + type: boolean id: description: The unique identifier for the rule type. type: string @@ -634,14 +739,16 @@ paths: minimum_license_required: description: The subscriptions required to use the rule type. type: string - example: basic + examples: + - basic name: description: The descriptive name of the rule type. type: string producer: description: An identifier for the application that produces this rule type. type: string - example: stackAlerts + examples: + - stackAlerts recovery_action_group: description: An action group to use when an alert goes from an active state to an inactive one. type: object @@ -652,7 +759,8 @@ paths: type: string rule_task_timeout: type: string - example: 5m + examples: + - 5m examples: getRuleTypesResponse: $ref: '#/components/examples/get_rule_types_response' @@ -662,8 +770,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all: post: summary: Mutes all alerts. @@ -685,10 +791,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all: post: summary: Unmutes all alerts. @@ -710,16 +812,32 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_update_api_key: + post: + summary: Updates the API key for a rule. + operationId: updateRuleAPIKey + description: The new API key has the credentials of the user that submits the request. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + '200': + description: Indicates a successful call. + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute: post: summary: Mutes an alert. operationId: muteAlert description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. tags: - alerting parameters: @@ -736,16 +854,12 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute: post: summary: Unmutes an alert. operationId: unmuteAlert description: | - You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. tags: - alerting parameters: @@ -762,10 +876,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}: delete: summary: Permanently removes an alert. @@ -784,7 +894,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '204': description: Indicates a successful call. @@ -794,8 +905,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 get: summary: Retrieves an alert by its identifier. operationId: legacyGetAlert @@ -811,7 +920,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '200': description: Indicates a successful call. @@ -825,8 +935,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 post: summary: Create an alert. operationId: legacyCreateAlert @@ -842,7 +950,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 - $ref: '#/components/parameters/space_id' requestBody: required: true @@ -913,7 +1022,8 @@ paths: interval: type: string description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should execute. - example: 10s + examples: + - 10s tags: type: array items: @@ -936,8 +1046,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 put: summary: Updates the attributes for an alert. operationId: legacyUpdateAlert @@ -954,7 +1062,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 requestBody: required: true content: @@ -1013,7 +1122,8 @@ paths: interval: type: string description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should execute. - example: 1d + examples: + - 1d tags: type: array items: @@ -1036,10 +1146,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_disable: post: summary: Disables an alert. @@ -1057,7 +1163,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '204': description: Indicates a successful call. @@ -1067,10 +1174,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_enable: post: summary: Enables an alert. @@ -1088,7 +1191,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '204': description: Indicates a successful call. @@ -1098,10 +1202,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_mute_all: post: summary: Mutes all alert instances. @@ -1119,7 +1219,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '204': description: Indicates a successful call. @@ -1129,10 +1230,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/_unmute_all: post: summary: Unmutes all alert instances. @@ -1150,7 +1247,8 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 responses: '204': description: Indicates a successful call. @@ -1160,10 +1258,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/_find: get: summary: Retrieves a paginated set of alerts. @@ -1181,7 +1275,8 @@ paths: schema: type: string default: OR - example: OR + examples: + - OR - name: fields in: query description: The fields to return in the `attributes` key of the response. @@ -1211,14 +1306,16 @@ paths: schema: type: integer default: 1 - example: 1 + examples: + - 1 - name: per_page in: query description: The number of alerts to return per page. schema: type: integer default: 20 - example: 20 + examples: + - 20 - name: search in: query description: An Elasticsearch `simple_query_string` query that filters the alerts in the response. @@ -1248,7 +1345,8 @@ paths: - asc - desc default: desc - example: asc + examples: + - asc responses: '200': description: Indicates a successful call. @@ -1273,10 +1371,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/_health: get: summary: Retrieves the health status of the alerting framework. @@ -1306,7 +1400,8 @@ paths: properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -1314,14 +1409,16 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' executionHealth: type: object description: The timestamp and status of the alert execution. properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -1329,14 +1426,16 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' readHealth: type: object description: The timestamp and status of the alert reading events. properties: status: type: string - example: ok + examples: + - ok enum: - error - ok @@ -1344,23 +1443,24 @@ paths: timestamp: type: string format: date-time - example: '2023-01-13T01:28:00.280Z' + examples: + - '2023-01-13T01:28:00.280Z' hasPermanentEncryptionKey: type: boolean description: If `false`, the encrypted saved object plugin does not have a permanent encryption key. - example: true + examples: + - true isSufficientlySecure: type: boolean description: If `false`, security is enabled but TLS is not. - example: true + examples: + - true '401': description: Authorization information is missing or invalid. content: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alerts/list_alert_types: get: summary: Retrieves a list of alert types. @@ -1463,8 +1563,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute: post: summary: Mutes an alert instance. @@ -1482,14 +1580,16 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 - in: path name: alertInstanceId description: An identifier for the alert instance. required: true schema: type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 + examples: + - dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 responses: '204': description: Indicates a successful call. @@ -1499,10 +1599,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 /s/{spaceId}/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute: post: summary: Unmutes an alert instance. @@ -1520,14 +1616,16 @@ paths: required: true schema: type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 + examples: + - 41893910-6bca-11eb-9e0d-85d233e3ee35 - in: path name: alertInstanceId description: An identifier for the alert instance. required: true schema: type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 + examples: + - dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 responses: '204': description: Indicates a successful call. @@ -1537,10 +1635,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - servers: - - url: https://localhost:5601 - servers: - - url: https://localhost:5601 components: securitySchemes: basicAuth: @@ -1552,14 +1646,13 @@ components: name: Authorization description: 'e.g. Authorization: ApiKey base64AccessApiKey' parameters: - rule_id: - in: path - name: ruleId - description: An identifier for the rule. - required: true + kbn_xsrf: schema: type: string - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + in: header + name: kbn-xsrf + description: Cross-site request forgery protection + required: true space_id: in: path name: spaceId @@ -1567,14 +1660,17 @@ components: required: true schema: type: string - example: default - kbn_xsrf: + examples: + - default + rule_id: + in: path + name: ruleId + description: An identifier for the rule. + required: true schema: type: string - in: header - name: kbn-xsrf - description: Cross-site request forgery protection - required: true + examples: + - ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 alert_id: in: path name: alertId @@ -1582,79 +1678,259 @@ components: required: true schema: type: string - example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + examples: + - ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 schemas: - notify_when: + filter: + type: object + description: A filter written in Elasticsearch Query Domain Specific Language (DSL) as defined in the `kbn-es-query` package. + properties: + meta: + type: object + properties: + alias: + type: + - string + - 'null' + controlledBy: + type: string + disabled: + type: boolean + field: + type: string + group: + type: string + index: + type: string + isMultiIndex: + type: boolean + key: + type: string + negate: + type: boolean + params: + type: object + type: + type: string + value: + type: string + query: + type: object + $state: + type: object + notify_when_action: type: string description: | - Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. + Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. NOTE: You cannot specify `notify_when` at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. enum: - onActionGroupChange - onActiveAlert - onThrottleInterval - example: onActiveAlert - throttle: - type: string - description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. - nullable: true + examples: + - onActiveAlert + throttle_action: + type: + - string + - 'null' + description: | + The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. default: null - example: 10m + examples: + - 10m actions: - type: array + type: + - array + - 'null' default: [] - required: - - group - - id - - params - nullable: true items: type: object + required: + - group + - id + - params + description: | + An action that runs under defined conditions. properties: + alerts_filter: + type: object + description: | + Conditions that affect whether the action runs. If you specify multiple conditions, all conditions must be met for the action to run. For example, if an alert occurs within the specified time frame and matches the query, the action runs. + properties: + query: + type: object + description: Defines a query filter that determines whether the action runs. + properties: + kql: + type: string + description: A filter written in Kibana Query Language (KQL). + filters: + type: array + items: + $ref: '#/components/schemas/filter' + timeframe: + type: object + description: Defines a period that limits whether the action runs. + properties: + days: + type: array + description: Defines the days of the week that the action can run, represented as an array of numbers. For example, `1` represents Monday. An empty array is equivalent to specifying all the days of the week. + items: + type: integer + examples: + - - 1 + - 2 + - 3 + - 4 + - 5 + hours: + type: object + description: | + Defines the range of time in a day that the action can run. If the `start` value is `00:00` and the `end` value is `24:00`, actions be generated all day. + properties: + end: + type: string + description: The end of the time frame in 24-hour notation (`hh:mm`). + examples: + - '17:00' + start: + type: string + description: The start of the time frame in 24-hour notation (`hh:mm`). + examples: + - '08:00' + timezone: + type: string + description: | + The ISO time zone for the `hours` values. Values such as `UTC` and `UTC+1` also work but lack built-in daylight savings time support and are not recommended. + examples: + - Europe/Madrid connector_type_id: type: string description: The type of connector. This property appears in responses but cannot be set in requests. - example: .server-log + examples: + - .server-log readOnly: true frequency: type: object description: | - The parameters that affect how often actions are generated. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. + The properties that affect how often actions are generated. If the rule type supports setting `summary` to `true`, the action can be a summary of alerts at the specified notification interval. Otherwise, an action runs for each alert at the specified notification interval. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. required: - notify_when - summary properties: notify_when: - $ref: '#/components/schemas/notify_when' + $ref: '#/components/schemas/notify_when_action' summary: type: boolean description: Indicates whether the action is a summary. throttle: - $ref: '#/components/schemas/throttle' + $ref: '#/components/schemas/throttle_action' group: type: string - description: The group name for the actions. If you don't need to group actions, set to `default`. - example: default + description: | + The group name, which affects when the action runs (for example, when the threshold is met or when the alert is recovered). Each rule type has a list of valid action group names. If you don't need to group actions, set to `default`. + examples: + - default id: type: string description: The identifier for the connector saved object. - example: 9dca3e00-74f5-11ed-9801-35303b735aef + examples: + - 9dca3e00-74f5-11ed-9801-35303b735aef params: type: object description: The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. additionalProperties: true + uuid: + type: string + description: A universally unique identifier (UUID) for the action. + examples: + - 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 + notify_when: + type: string + description: | + Deprecated in 8.13.0. Use the `notify_when` property in the action `frequency` object instead. Indicates how often alerts generate actions. NOTE: You cannot specify `notify_when` at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + enum: + - onActionGroupChange + - onActiveAlert + - onThrottleInterval + deprecated: true + examples: + - onActiveAlert schedule: type: object description: The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days. properties: interval: type: string - example: 1m + examples: + - 1m tags: type: array description: The tags for the rule. items: type: string default: [] + throttle: + type: + - string + - 'null' + description: | + Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + default: null + deprecated: true + examples: + - 10m + alert_delay: + type: object + description: Indicates that an alert occurs only when the specified number of consecutive runs met the rule conditions. + required: + - active + properties: + active: + type: number + description: The number of consecutive runs that must meet the rule conditions. + example: 3 + create_rule_request: + title: Create rule request + description: The create rule API request body varies depending on the type of rule and actions. + type: object + required: + - consumer + - name + - params + - rule_type_id + - schedule + properties: + actions: + $ref: '#/components/schemas/actions' + consumer: + type: string + description: | + The name of the application or feature that owns the rule. For example: `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. + enabled: + type: boolean + description: Indicates whether you want to run the rule on an interval basis after it is created. + name: + type: string + description: The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule. + example: cluster_health_rule + notify_when: + $ref: '#/components/schemas/notify_when' + params: + type: object + description: The parameters for the rule. + additionalProperties: true + rule_type_id: + type: string + description: | + The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. + schedule: + $ref: '#/components/schemas/schedule' + tags: + $ref: '#/components/schemas/tags' + throttle: + $ref: '#/components/schemas/throttle' + alert_delay: + $ref: '#/components/schemas/alert_delay' rule_response_properties: title: Rule response properties type: object @@ -1680,45 +1956,65 @@ components: properties: actions: $ref: '#/components/schemas/actions' + alert_delay: + $ref: '#/components/schemas/alert_delay' + api_key_created_by_user: + type: boolean + description: Indicates whether the API key that is associated with the rule was created by the user. + examples: + - false api_key_owner: - type: string - nullable: true - example: elastic + type: + - string + - 'null' + description: | + The owner of the API key that is associated with the rule and used to run background tasks. + examples: + - elastic consumer: type: string description: The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. - example: alerts + examples: + - alerts created_at: type: string description: The date and time that the rule was created. format: date-time - example: '2022-12-05T23:36:58.284Z' + examples: + - '2022-12-05T23:36:58.284Z' created_by: - type: string + type: + - string + - 'null' description: The identifier for the user that created the rule. - nullable: true - example: elastic + examples: + - elastic enabled: type: boolean description: Indicates whether the rule is currently enabled. - example: true + examples: + - true execution_status: type: object properties: last_duration: type: integer - example: 55 + examples: + - 55 last_execution_date: type: string format: date-time - example: '2022-12-06T00:13:43.890Z' + examples: + - '2022-12-06T00:13:43.890Z' status: type: string - example: ok + examples: + - ok id: type: string description: The identifier for the rule. - example: b530fed0-74f5-11ed-9801-35303b735aef + examples: + - b530fed0-74f5-11ed-9801-35303b735aef last_run: type: object properties: @@ -1735,43 +2031,62 @@ components: type: integer outcome: type: string - example: succeeded + examples: + - succeeded outcome_msg: - type: string - nullable: true - example: null + type: + - array + - 'null' + items: + type: string + outcome_order: + type: integer warning: - type: string - nullable: true - example: null + type: + - string + - 'null' + examples: + - null muted_alert_ids: - type: array - nullable: true + type: + - array + - 'null' items: type: string mute_all: type: boolean - example: false + examples: + - false name: type: string description: The name of the rule. - example: cluster_health_rule + examples: + - cluster_health_rule next_run: - type: string + type: + - string + - 'null' format: date-time - nullable: true - example: '2022-12-06T00:14:43.818Z' + examples: + - '2022-12-06T00:14:43.818Z' notify_when: - $ref: '#/components/schemas/notify_when' + type: + - string + - 'null' + description: Indicates how often alerts generate actions. params: type: object description: The parameters for the rule. additionalProperties: true + revision: + type: integer + description: The rule revision number. rule_type_id: type: string description: | The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. - example: monitoring_alert_cluster_health + examples: + - monitoring_alert_cluster_health running: type: boolean description: Indicates whether the rule is running. @@ -1779,7 +2094,8 @@ components: $ref: '#/components/schemas/schedule' scheduled_task_id: type: string - example: b530fed0-74f5-11ed-9801-35303b735aef + examples: + - b530fed0-74f5-11ed-9801-35303b735aef tags: $ref: '#/components/schemas/tags' throttle: @@ -1787,26 +2103,31 @@ components: updated_at: type: string description: The date and time that the rule was updated most recently. - example: '2022-12-05T23:36:58.284Z' + examples: + - '2022-12-05T23:36:58.284Z' updated_by: - type: string + type: + - string + - 'null' description: The identifier for the user that updated this rule most recently. - nullable: true - example: elastic + examples: + - elastic 401_response: type: object title: Unsuccessful rule API response properties: error: type: string - example: Unauthorized + examples: + - Unauthorized enum: - Unauthorized message: type: string statusCode: type: integer - example: 401 + examples: + - 401 enum: - 401 404_response: @@ -1814,20 +2135,24 @@ components: properties: error: type: string - example: Not Found + examples: + - Not Found enum: - Not Found message: type: string - example: Saved object [alert/caaad6d0-920c-11ed-b36a-874bd1548a00] not found + examples: + - Saved object [alert/caaad6d0-920c-11ed-b36a-874bd1548a00] not found statusCode: type: integer - example: 404 + examples: + - 404 enum: - 404 update_rule_request: title: Update rule request - description: The update rule API request body varies depending on the type of rule and actions. + description: | + The update rule API request body varies depending on the type of rule and actions. type: object required: - name @@ -1836,10 +2161,13 @@ components: properties: actions: $ref: '#/components/schemas/actions' + alert_delay: + $ref: '#/components/schemas/alert_delay' name: type: string description: The name of the rule. - example: cluster_health_rule + examples: + - cluster_health_rule notify_when: $ref: '#/components/schemas/notify_when' params: @@ -1852,46 +2180,68 @@ components: $ref: '#/components/schemas/tags' throttle: $ref: '#/components/schemas/throttle' - create_rule_request: - title: Create rule request - description: The create rule API request body varies depending on the type of rule and actions. + fieldmap_properties: + title: Field map objects in the get rule types response type: object - required: - - consumer - - name - - params - - rule_type_id - - schedule properties: - actions: - $ref: '#/components/schemas/actions' - consumer: + array: + type: boolean + description: Indicates whether the field is an array. + dynamic: + type: boolean + description: Indicates whether it is a dynamic field mapping. + format: type: string description: | - The name of the application or feature that owns the rule. For example: `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. - enabled: + Indicates the format of the field. For example, if the `type` is `date_range`, the `format` can be `epoch_millis||strict_date_optional_time`. + ignore_above: + type: integer + description: Specifies the maximum length of a string field. Longer strings are not indexed or stored. + index: type: boolean - description: Indicates whether you want to run the rule on an interval basis after it is created. - name: + description: Indicates whether field values are indexed. + path: type: string - description: The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule. - example: cluster_health_rule - notify_when: - $ref: '#/components/schemas/notify_when' - params: + description: TBD + properties: type: object - description: The parameters for the rule. - additionalProperties: true - rule_type_id: - type: string description: | - The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. - schedule: - $ref: '#/components/schemas/schedule' - tags: - $ref: '#/components/schemas/tags' - throttle: - $ref: '#/components/schemas/throttle' + Details about the object properties. This property is applicable when `type` is `object`. + additionalProperties: + type: object + properties: + type: + type: string + description: The data type for each object property. + required: + type: boolean + description: Indicates whether the field is required. + scaling_factor: + type: integer + description: | + The scaling factor to use when encoding values. This property is applicable when `type` is `scaled_float`. Values will be multiplied by this factor at index time and rounded to the closest long value. + type: + type: string + description: Specifies the data type for the field. + example: scaled_float + 400_response: + title: Bad request + type: object + required: + - error + - message + - statusCode + properties: + error: + type: string + enum: + - Bad Request + message: + type: string + statusCode: + type: integer + enum: + - 400 alert_response_properties: title: Legacy alert response properties type: object @@ -1902,80 +2252,524 @@ components: type: object alertTypeId: type: string - example: .index-threshold + examples: + - .index-threshold apiKeyOwner: - type: string - nullable: true - example: elastic + type: + - string + - 'null' + examples: + - elastic createdAt: type: string description: The date and time that the alert was created. format: date-time - example: '2022-12-05T23:36:58.284Z' + examples: + - '2022-12-05T23:36:58.284Z' createdBy: type: string description: The identifier for the user that created the alert. - example: elastic + examples: + - elastic enabled: type: boolean description: Indicates whether the alert is currently enabled. - example: true + examples: + - true executionStatus: type: object properties: lastExecutionDate: type: string format: date-time - example: '2022-12-06T00:13:43.890Z' + examples: + - '2022-12-06T00:13:43.890Z' status: type: string - example: ok + examples: + - ok id: type: string description: The identifier for the alert. - example: b530fed0-74f5-11ed-9801-35303b735aef + examples: + - b530fed0-74f5-11ed-9801-35303b735aef muteAll: type: boolean - example: false + examples: + - false mutedInstanceIds: - type: array - nullable: true + type: + - array + - 'null' items: type: string name: type: string description: The name of the alert. - example: my alert + examples: + - my alert notifyWhen: type: string - example: onActionGroupChange + examples: + - onActionGroupChange params: type: object additionalProperties: true schedule: - type: object - properties: - interval: - type: string - scheduledTaskId: - type: string - example: b530fed0-74f5-11ed-9801-35303b735aef - tags: - type: array - items: - type: string - throttle: - type: string - nullable: true - updatedAt: - type: string - example: '2022-12-05T23:36:58.284Z' - updatedBy: - type: string - description: The identifier for the user that updated this alert most recently. - nullable: true - example: elastic - examples: + type: object + properties: + interval: + type: string + scheduledTaskId: + type: string + examples: + - b530fed0-74f5-11ed-9801-35303b735aef + tags: + type: array + items: + type: string + throttle: + type: + - string + - 'null' + updatedAt: + type: string + examples: + - '2022-12-05T23:36:58.284Z' + updatedBy: + type: + - string + - 'null' + description: The identifier for the user that updated this alert most recently. + examples: + - elastic + examples: + create_es_query_esql_rule_request: + summary: Create an Elasticsearch query rule that uses Elasticsearch Query Language (ES|QL). + value: + name: my Elasticsearch query ESQL rule + params: + searchType: esqlQuery + esqlQuery: + esql: FROM kibana_sample_data_logs | KEEP bytes, clientip, host, geo.dest | where geo.dest != "GB" | STATS sumbytes = sum(bytes) by clientip, host | WHERE sumbytes > 5000 | SORT sumbytes desc | LIMIT 10 + timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + size: 0 + thresholdComparator: '>' + threshold: + - 0 + consumer: stackAlerts + rule_type_id: .es-query + schedule: + interval: 1d + actions: + - group: query matched + id: d0db1fe0-78d6-11ee-9177-f7d404c8c945 + params: + level: info + message: |- + Elasticsearch query rule '{{rule.name}}' is active: + - Value: {{context.value}} - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} - Link: {{context.link}} + frequency: + summary: false + notify_when: onActiveAlert + create_es_query_rule_request: + summary: Create an Elasticsearch query rule that uses Elasticsearch query domain specific language (DSL) to define its query and a server log connector to send notifications. + value: + actions: + - group: query matched + params: + level: info + message: The system has detected {{alerts.new.count}} new, {{alerts.ongoing.count}} ongoing, and {{alerts.recovered.count}} recovered alerts. + id: fdbece50-406c-11ee-850e-c71febc4ca7f + frequency: + throttle: 1d + summary: true + notify_when: onThrottleInterval + - group: recovered + params: + level: info + message: Recovered + id: fdbece50-406c-11ee-850e-c71febc4ca7f + frequency: + summary: false + notify_when: onActionGroupChange + consumer: alerts + name: my Elasticsearch query rule + params: + esQuery: '"""{"query":{"match_all" : {}}}"""' + index: + - kibana_sample_data_logs + size: 100 + threshold: + - 100 + thresholdComparator: '>' + timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + rule_type_id: .es-query + schedule: + interval: 1d + create_es_query_kql_rule_request: + summary: Create an Elasticsearch query rule that uses Kibana query language (KQL). + value: + consumer: alerts + name: my Elasticsearch query KQL rule + params: + aggType: count + excludeHitsFromPreviousRun: true + groupBy: all + searchConfiguration: + query: + query: '""geo.src : "US" ""' + language: kuery + index: 90943e30-9a47-11e8-b64d-95841ca0b247 + searchType: searchSource + size: 100 + threshold: + - 1000 + thresholdComparator: '>' + timeWindowSize: 5 + timeWindowUnit: m + rule_type_id: .es-query + schedule: + interval: 1m + create_index_threshold_rule_request: + summary: Create an index threshold rule. + value: + actions: + - id: 48de3460-f401-11ed-9f8e-399c75a2deeb + frequency: + notify_when: onActionGroupChange + summary: false + group: threshold met + params: + level: info + message: |- + Rule '{{rule.name}}' is active for group '{{context.group}}': + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date}} + alert_delay: + active: 3 + consumer: alerts + name: my rule + params: + aggType: avg + termSize: 6 + thresholdComparator: '>' + timeWindowSize: 5 + timeWindowUnit: m + groupBy: top + threshold: + - 1000 + index: + - .test-index + timeField: '@timestamp' + aggField: sheet.version + termField: name.keyword + rule_type_id: .index-threshold + schedule: + interval: 1m + tags: + - cpu + create_tracking_containment_rule_request: + summary: Create a tracking containment rule. + value: + consumer: alerts + name: my tracking rule + params: + index: kibana_sample_data_logs + dateField": '@timestamp' + geoField: geo.coordinates + entity: agent.keyword + boundaryType: entireIndex + boundaryIndexTitle: boundary* + boundaryGeoField: location + boundaryNameField: name + indexId: 90943e30-9a47-11e8-b64d-95841ca0b247 + boundaryIndexId: 0cd90abf-abe7-44c7-909a-f621bbbcfefc + rule_type_id: .geo-containment + schedule: + interval: 1h + create_es_query_esql_rule_response: + summary: The create rule API returns a JSON object that contains details about the rule. + value: + id: e0d62360-78e8-11ee-9177-f7d404c8c945 + enabled: true + name: my Elasticsearch query ESQL rule + tags: [] + rule_type_id: .es-query + consumer: stackAlerts + schedule: + interval: 1d + actions: + - group: query matched + id: d0db1fe0-78d6-11ee-9177-f7d404c8c945 + params: + level: info + message: |- + Elasticsearch query rule '{{rule.name}}' is active: + - Value: {{context.value}} - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} - Link: {{context.link}} + connector_type_id: .server-log + frequency: + summary: false + notify_when: onActiveAlert + throttle: null + uuid: bfe370a3-531b-4855-bbe6-ad739f578844 + params: + searchType: esqlQuery + esqlQuery: + esql: FROM kibana_sample_data_logs | keep bytes, clientip, host, geo.dest | WHERE geo.dest != "GB" | stats sumbytes = sum(bytes) by clientip, host | WHERE sumbytes > 5000 | sort sumbytes desc | limit 10 + timeField: '@timestamp' + timeWindowSize: 1 + timeWindowUnit: d + size: 0 + thresholdComparator: '>' + threshold: + - 0 + excludeHitsFromPreviousRun": true, + aggType: count + groupBy: all + scheduled_task_id: e0d62360-78e8-11ee-9177-f7d404c8c945 + created_by: elastic + updated_by: elastic", + created_at: '2023-11-01T19:00:10.453Z' + updated_at: '2023-11-01T19:00:10.453Z' + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + mute_all: false + notify_when: null + muted_alert_ids: [] + execution_status: + status: pending + last_execution_date: '2023-11-01T19:00:10.453Z' + revision: 0 + running: false + create_es_query_rule_response: + summary: The create rule API returns a JSON object that contains details about the rule. + value: + id: 58148c70-407f-11ee-850e-c71febc4ca7f + enabled: true + name: my Elasticsearch query rule + tags: [] + rule_type_id: .es-query + consumer: alerts + schedule: + interval: 1d + actions: + - group: query matched + id: fdbece50-406c-11ee-850e-c71febc4ca7f + params: + level: info + message: The system has detected {{alerts.new.count}} new, {{alerts.ongoing.count}} ongoing, and {{alerts.recovered.count}} recovered alerts. + connector_type_id: .server-log + frequency: + summary: true + notify_when: onThrottleInterval + throttle: 1d + uuid: 53f3c2a3-e5d0-4cfa-af3b-6f0881385e78 + - group: recovered + id: fdbece50-406c-11ee-850e-c71febc4ca7f + params: + level: info + message: Recovered + connector_type_id: .server-log + frequency: + summary: false + notify_when: onActionGroupChange + throttle: null + uuid: 2324e45b-c0df-45c7-9d70-4993e30be758 + params: + thresholdComparator: '>' + timeWindowSize: 1 + timeWindowUnit: d + threshold: + - 100 + size: 100 + timeField: '@timestamp' + index: + - kibana_sample_data_logs + esQuery: '"""{"query":{"match_all" : {}}}"""' + excludeHitsFromPreviousRun: true + aggType: count + groupBy: all + searchType: esQuery + scheduled_task_id: 58148c70-407f-11ee-850e-c71febc4ca7f + created_by: elastic + updated_by: elastic + created_at: '2023-08-22T00:03:38.263Z' + updated_at: '2023-08-22T00:03:38.263Z' + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + mute_all: false + notify_when: null + muted_alert_ids: [] + execution_status: + status: pending + last_execution_date: '2023-08-22T00:03:38.263Z' + revision: 0 + running: false + create_es_query_kql_rule_response: + summary: The create rule API returns a JSON object that contains details about the rule. + value: + id: 7bd506d0-2284-11ee-8fad-6101956ced88 + enabled: true + name: my Elasticsearch query KQL rule" + tags: [] + rule_type_id: .es-query + consumer: alerts + schedule: + interval: 1m + actions: [] + params: + searchConfiguration: + query: + query: '""geo.src : "US" ""' + language: kuery + index: 90943e30-9a47-11e8-b64d-95841ca0b247 + searchType: searchSource + timeWindowSize: 5 + timeWindowUnit: m + threshold: + - 1000 + thresholdComparator: '>' + size: 100 + aggType: count + groupBy: all + excludeHitsFromPreviousRun: true + created_by: elastic + updated_by: elastic + created_at: '2023-07-14T20:24:50.729Z' + updated_at: '2023-07-14T20:24:50.729Z' + api_key_owner: elastic + api_key_created_by_user: false + throttle: null + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: 7bd506d0-2284-11ee-8fad-6101956ced88 + execution_status: + status: pending + last_execution_date: '2023-07-14T20:24:50.729Z' + revision: 0 + running: false + create_index_threshold_rule_response: + summary: The create rule API returns a JSON object that contains details about the rule. + value: + actions: + - group: threshold met + id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 + uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d + connector_type_id: .server-log + frequency: + notify_when: onActionGroupChange + summary: false + throttle: null + params: + level: info + message: |- + Rule {{rule.name}} is active for group {{context.group} : + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} + - Timestamp: {{context.date}} + alert_delay: + active: 3 + api_key_created_by_user: false + api_key_owner: elastic + consumer: alerts + created_at: '2022-06-08T17:20:31.632Z' + created_by: elastic + enabled: true + execution_status: + last_execution_date: '2022-06-08T17:20:31.632Z' + status: pending + id: 41893910-6bca-11eb-9e0d-85d233e3ee35 + muted_alert_ids: [] + mute_all: false + name: my rule + notify_when: null + params: + aggType: avg + termSize: 6 + thresholdComparator: '>' + timeWindowSize: 5 + timeWindowUnit: m + groupBy: top + threshold: + - 1000 + index: + - .test-index + timeField: '@timestamp' + aggField: sheet.version + termField: name.keyword + revision: 0 + rule_type_id: .index-threshold + running: false + schedule: + interval: 1m + scheduled_task_id: 425b0800-6bca-11eb-9e0d-85d233e3ee35 + tags: + - cpu + throttle: null + updated_at: '2022-06-08T17:20:31.632Z' + updated_by: elastic + create_tracking_containment_rule_response: + summary: The create rule API returns a JSON object that contains details about the rule. + value: + id: b6883f9d-5f70-4758-a66e-369d7c26012f + name: my tracking rule + tags: [] + enabled: true + consumer: alerts + throttle: null + revision: 1 + running: false + schedule: + interval: 1h + params: + index: kibana_sample_data_logs + dateField: '@timestamp' + geoField: geo.coordinates + entity: agent.keyword + boundaryType: entireIndex + boundaryIndexTitle: boundary* + boundaryGeoField: location + boundaryNameField: name + indexId: 90943e30-9a47-11e8-b64d-95841ca0b247 + boundaryIndexId: 0cd90abf-abe7-44c7-909a-f621bbbcfefc + rule_type_id: .geo-containment + created_by: elastic + updated_by: elastic + created_at: '2024-02-14T19:52:55.920Z' + updated_at: '2024-02-15T03:24:32.574Z' + api_key_owner: elastic + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: b6883f9d-5f70-4758-a66e-369d7c26012f + execution_status: + status: ok + last_execution_date: '2024-02-15T03:25:38.125Z' + last_duration: 74 + actions: [] + last_run: + alerts_count: + active: 0 + new: 0 + recovered: 0 + ignored: 0 + outcome_msg: null + outcome_order: 0 + outcome: succeeded + warning: null + next_run: '2024-02-15T03:26:38.033Z' + api_key_created_by_user: false get_rule_response: summary: The get rule API returns a JSON object that contains details about the rule. value: @@ -2002,13 +2796,14 @@ components: timeField: '@timestamp' aggField: sheet.version termField: name.keyword + revision: 1 rule_type_id: .index-threshold created_by: elastic updated_by: elastic created_at: '2022-12-13T22:33:41.163Z' updated_at: '2022-12-13T22:33:41.163Z' api_key_owner: elastic - notify_when: onActionGroupChange + notify_when: null muted_alert_ids: [] mute_all: false scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2 @@ -2019,15 +2814,21 @@ components: actions: - group: threshold met id: 1007a0c0-7a6e-11ed-89d5-abec321c0def + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: + Rule {{rule.name}} is active for group {{context.group}}: - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date} connector_type_id: .server-log + connector_type_id: .server-log + frequency: + throttle: null + summary: false + notify_when: onActionGroupChange last_run: alerts_count: new: 0 @@ -2038,6 +2839,7 @@ components: warning: null outcome: succeeded next_run: '2022-12-13T22:34:44.314Z' + api_key_created_by_user: false update_rule_request: summary: Update an index threshold rule. value: @@ -2050,16 +2852,16 @@ components: params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: + Rule {{rule.name}} is active for group {{context.group}}: - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} params: aggField: sheet.version aggType: avg index: - - .test-index + - .updated-index groupBy: top termField: name.keyword termSize: 6 @@ -2073,7 +2875,6 @@ components: schedule: interval: 1m tags: [] - throttle: null update_rule_response: summary: The update rule API returns a JSON object that contains details about the rule. value: @@ -2083,9 +2884,10 @@ components: name: new name enabled: true throttle: null + revision: 1 running: false schedule: - interval: 10m + interval: 1m params: index: - .updated-index @@ -2105,25 +2907,26 @@ components: updated_by: elastic rule_type_id: .index-threshold scheduled_task_id: 4c5eda00-e74f-11ec-b72f-5b18752ff9ea - created_at: '2023-01-31T23:03:33.127Z' - updated_at: '2023-01-31T23:55:27.314Z' + created_at: '2024-03-26T23:13:20.985Z' + updated_at: '2024-03-26T23:22:59.949Z' mute_all: false muted_alert_ids: [] execution_status: status: ok - last_execution_date: '2023-01-31T23:48:42.499Z' + last_execution_date: '2024-03-26T23:22:51.390Z' last_duration: 52 actions: - group: threshold met params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: + Rule {{rule.name}} is active for group {{context.group}}: - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date} id: 96b668d0-a1b6-11ed-afdf-d39a49596974 + uuid: 07aef2a0-9eed-4ef9-94ec-39ba58eb609d connector_type_id: .server-log frequency: summary: false @@ -2138,100 +2941,8 @@ components: outcome_msg: null warning: null outcome: succeeded - next_run: '2023-01-31T23:49:42.432Z' - create_rule_request: - summary: Create an index threshold rule. - value: - actions: - - id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - frequency: - notify_when: onActionGroupChange - summary: false - group: threshold met - params: - level: info - message: |- - alert '{{alertName}}' is active for group '{{context.group}}': - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date}} - consumer: alerts - name: my rule - params: - aggType: avg - termSize: 6 - thresholdComparator: '>' - timeWindowSize: 5 - timeWindowUnit: m - groupBy: top - threshold: - - 1000 - index: - - .test-index - timeField: '@timestamp' - aggField: sheet.version - termField: name.keyword - rule_type_id: .index-threshold - schedule: - interval: 1m - tags: - - cpu - create_rule_response: - summary: The create rule API returns a JSON object that contains details about the rule. - value: - actions: - - group: threshold met - id: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - frequency: - notify_when: onActionGroupChange - summary: false - throttle: null - params: - level: info - message: |- - alert {{alertName}} is active for group {{context.group} : - - - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} - - Timestamp: {{context.date}} - api_key_owner: elastic - consumer: alerts - created_at: '2022-06-08T17:20:31.632Z' - created_by: elastic - enabled: true - execution_status: - last_execution_date: '2022-06-08T17:20:31.632Z' - status: pending - id: 41893910-6bca-11eb-9e0d-85d233e3ee35 - muted_alert_ids: [] - mute_all: false - name: my rule - notify_when: onActionGroupChange - params: - aggType: avg - termSize: 6 - thresholdComparator: '>' - timeWindowSize: 5 - timeWindowUnit: m - groupBy: top - threshold: - - 1000 - index: - - .test-index - timeField: '@timestamp' - aggField: sheet.version - termField: name.keyword - rule_type_id: .index-threshold - running: false - schedule: - interval: 1m - scheduled_task_id: 425b0800-6bca-11eb-9e0d-85d233e3ee35 - tags: - - cpu - throttle: null - updated_at: '2022-06-08T17:20:31.632Z' - updated_by: elastic + next_run: '2024-03-26T23:23:51.316Z' + api_key_created_by_user: false find_rules_response: summary: Retrieve information about a rule. value: @@ -2262,13 +2973,13 @@ components: timeField: '@timestamp' aggField: sheet.version termField: name.keyword + revision: 1 rule_type_id: .index-threshold created_by: elastic updated_by: elastic created_at: '2022-12-05T23:40:33.132Z' updated_at: '2022-12-05T23:40:33.132Z' api_key_owner: elastic - notify_when: onActionGroupChange mute_all: false muted_alert_ids: [] scheduled_task_id: 3583a470-74f6-11ed-9801-35303b735aef @@ -2279,15 +2990,20 @@ components: actions: - id: 9dca3e00-74f5-11ed-9801-35303b735aef group: threshold met + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 params: level: info message: |- - alert {{alertName}} is active for group {{context.group}}: + Rule {{rule.name}} is active for group {{context.group}}: - Value: {{context.value}} - - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Conditions Met: {{context.conditions}} over {{rule.params.timeWindowSize}}{{rule.params.timeWindowUnit}} - Timestamp: {{context.date}} connector_type_id: .server-log + frequency: + summary: false + notify_when: onActionGroupChange + throttle: null last_run: alerts_count: new: 0 @@ -2298,6 +3014,129 @@ components: warning: null outcome: succeeded next_run: '2022-12-06T01:45:23.912Z' + api_key_created_by_user: false + find_rules_response_conditional_action: + summary: Retrieve information about a rule that has conditional actions. + value: + page: 1 + total: 1 + per_page: 10 + data: + - id: 6107a8f0-f401-11ed-9f8e-399c75a2deeb + name: security_rule + consumer: siem + enabled: true + tags: [] + throttle: null + revision: 1 + running: false + schedule: + interval: 1m + params: + author: [] + description: A security threshold rule. + ruleId: an_internal_rule_id + falsePositives: [] + from: now-3660s + immutable: false + license: '' + outputIndex: '' + meta: + from: 1h + kibana_siem_app_url: https://localhost:5601/app/security + maxSignals: 100 + riskScore: 21 + riskScoreMapping: [] + severity: low + severityMapping: [] + threat: [] + to: now + references: [] + version: 1 + exceptionsList: [] + type: threshold + language: kuery + index: + - kibana_sample_data_logs + query: '*' + filters: [] + threshold: + field: + - bytes + value: 1 + cardinality: [] + rule_type_id: siem.thresholdRule + created_by: elastic + updated_by: elastic + created_at: '2023-05-16T15:50:28.358Z' + updated_at: '2023-05-16T20:25:42.559Z' + api_key_owner: elastic + notify_when: null + mute_all: false + muted_alert_ids: [] + scheduled_task_id: 6107a8f0-f401-11ed-9f8e-399c75a2deeb + execution_status: + status: ok + last_execution_date: '2023-05-16T20:26:49.590Z' + last_duration: 166 + actions: + - group: default + id: 49eae970-f401-11ed-9f8e-399c75a2deeb + params: + documents: + - rule_id: + '[object Object]': null + rule_name: + '[object Object]': null + alert_id: + '[object Object]': null + context_message: + '[object Object]': null + connector_type_id: .index + frequency: + summary: true + notify_when: onActiveAlert + throttle: null + uuid: 1c7a1280-f28c-4e06-96b2-e4e5f05d1d61 + alerts_filter: + timeframe: + days: + - 7 + timezone: UTC + hours: + start: '08:00' + end: '17:00' + query: + kql: '' + filters: + - meta: + disabled: false + negate: false + alias: null + index: c4bdca79-e69e-4d80-82a1-e5192c621bea + key: client.geo.region_iso_code + field: client.geo.region_iso_code + params: + query: CA-QC + type: phrase + $state: + store: appState + query: + match_phrase: + client.geo.region_iso_code: CA-QC + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: + - Rule execution completed successfully + outcome_order: 0 + warning: null + outcome: succeeded + next_run: '2023-05-16T20:27:49.507Z' + api_key_created_by_user: false get_health_response: summary: Retrieve information about the health of the alerting framework. value: @@ -2313,26 +3152,105 @@ components: read_health: status: ok timestamp: '2023-01-13T01:28:00.280Z' - alerting_framework_heath: - _deprecated: This state property has a typo, use "alerting_framework_health" instead. - decryption_health: - status: ok - timestamp: '2023-01-13T01:28:00.280Z' - execution_health: - status: ok - timestamp: '2023-01-13T01:28:00.280Z' - read_health: - status: ok - timestamp: '2023-01-13T01:28:00.280Z' get_rule_types_response: summary: Retrieve rule types associated with Kibana machine learning features value: - id: xpack.ml.anomaly_detection_alert + name: Anomaly detection alert + category: management + producer: ml + alerts: + context: ml.anomaly-detection + mappings: + fieldMap: + kibana.alert.job_id: + type: keyword + array: false + required: true + kibana.alert.anomaly_score: + type: double + array: false + required: false + kibana.alert.is_interim: + type: boolean + array: false + required: false + kibana.alert.anomaly_timestamp: + type: date + array: false + required: false + kibana.alert.top_records: + type: object + array: true + required: false + dynamic: false + properties: + job_id: + type: keyword + record_score: + type: double + initial_record_score: + type: double + detector_index: + type: integer + is_interim: + type: boolean + timestamp: + type: date + partition_field_name: + type: keyword + partition_field_value: + type: keyword + over_field_name: + type: keyword + over_field_value: + type: keyword + by_field_name: + type: keyword + by_field_value: + type: keyword + function: + type: keyword + typical: + type: double + actual: + type: double + field_name: + type: keyword + kibana.alert.top_influencers: + type: object + array: true + required: false + dynamic: false + properties: + job_id: + type: keyword + influencer_field_name: + type: keyword + influencer_field_value: + type: keyword + influencer_score: + type: double + initial_influencer_score: + type: double + is_interim: + type: boolean + timestamp: + type: date + shouldWrite: true + enabled_in_license: true + recovery_action_group: + id: recovered + name: Recovered action_groups: - id: anomaly_score_match name: Anomaly score matched the condition - id: recovered name: Recovered + default_action_group_id: anomaly_score_match + minimum_license_required: platinum + is_exportable: true + rule_task_timeout: 5m action_variables: context: - name: timestamp @@ -2354,58 +3272,104 @@ components: - name: anomalyExplorerUrl description: URL to open in the Anomaly Explorer useWithTripleBracesInTemplates: true - params: [] state: [] + params: [] authorized_consumers: alerts: + read: true all: true + stackAlerts: read: true + all: true + slo: + read: true + all: true ml: + read: true all: true + uptime: read: true - default_action_group_id: anomaly_score_match + all: true + infrastructure: + read: true + all: true + logs: + read: true + all: true + monitoring: + read: true + all: true + siem: + read: true + all: true + apm: + read: true + all: true + discover: + read: true + all: true does_set_recovery_context: true - enabled_in_license: true - is_exportable: true - minimum_license_required: platinum - name: Anomaly detection alert + has_alerts_mappings: true + has_fields_for_a_a_d: false + - id: xpack.ml.anomaly_detection_jobs_health + name: Anomaly detection jobs health + category: management producer: ml + enabled_in_license: true recovery_action_group: id: recovered name: Recovered - rule_task_timeout: 5m - - id: xpack.ml.anomaly_detection_jobs_health action_groups: - id: anomaly_detection_realtime_issue name: Issue detected - id: recovered name: Recovered + default_action_group_id: anomaly_detection_realtime_issue + minimum_license_required: platinum + is_exportable: true + rule_task_timeout: 5m action_variables: context: - name: results description: Results of the rule execution - name: message description: Alert info message - params: [] state: [] + params: [] authorized_consumers: alerts: + read: true + all: true + stackAlerts: + read: true all: true + slo: read: true + all: true ml: + read: true all: true + uptime: read: true - default_action_group_id: anomaly_detection_realtime_issue + all: true + infrastructure: + read: true + all: true + logs: + read: true + all: true + monitoring: + read: true + all: true + siem: + read: true + all: true + apm: + read: true + all: true + discover: + read: true + all: true does_set_recovery_context: true - enabled_in_license: true - is_exportable: true - minimum_license_required: platinum - name: Anomaly detection jobs health - producer: ml - recovery_action_group: - id: recovered - name: Recovered - rule_task_timeout: 5m -security: - - basicAuth: [] - - apiKeyAuth: [] + has_alerts_mappings: false + has_fields_for_a_a_d: false diff --git a/generated/alerting/client.go b/generated/alerting/client.go index 57ce60a5d..8fe0acd0d 100644 --- a/generated/alerting/client.go +++ b/generated/alerting/client.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -40,7 +40,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the Alerting API v0.1 +// APIClient manages communication with the Alerting API v0.2 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration diff --git a/generated/alerting/configuration.go b/generated/alerting/configuration.go index 9194a2ee2..e911bf7c0 100644 --- a/generated/alerting/configuration.go +++ b/generated/alerting/configuration.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -96,168 +96,11 @@ func NewConfiguration() *Configuration { Debug: false, Servers: ServerConfigurations{ { - URL: "http://localhost:5601", - Description: "local", - }, - }, - OperationServers: map[string]ServerConfigurations{ - "AlertingAPIService.CreateRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.DeleteRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.DisableRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.EnableRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.FindRules": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.GetAlertingHealth": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.GetRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.GetRuleTypes": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyCreateAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyDisableAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyEnableAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyFindAlerts": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyGetAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyGetAlertTypes": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyGetAlertingHealth": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyMuteAlertInstance": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyMuteAllAlertInstances": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyUnmuteAlertInstance": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyUnmuteAllAlertInstances": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegacyUpdateAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.LegaryDeleteAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.MuteAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.MuteAllAlerts": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.UnmuteAlert": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.UnmuteAllAlerts": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, - }, - "AlertingAPIService.UpdateRule": { - { - URL: "https://localhost:5601", - Description: "No description provided", - }, + URL: "", + Description: "No description provided", }, }, + OperationServers: map[string]ServerConfigurations{}, } return cfg } diff --git a/generated/alerting/docs/ActionsInner.md b/generated/alerting/docs/ActionsInner.md index 1f3f97df9..7b0eb0ac4 100644 --- a/generated/alerting/docs/ActionsInner.md +++ b/generated/alerting/docs/ActionsInner.md @@ -4,17 +4,19 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**AlertsFilter** | Pointer to [**ActionsInnerAlertsFilter**](ActionsInnerAlertsFilter.md) | | [optional] **ConnectorTypeId** | Pointer to **string** | The type of connector. This property appears in responses but cannot be set in requests. | [optional] [readonly] **Frequency** | Pointer to [**ActionsInnerFrequency**](ActionsInnerFrequency.md) | | [optional] -**Group** | Pointer to **string** | The group name for the actions. If you don't need to group actions, set to `default`. | [optional] -**Id** | Pointer to **string** | The identifier for the connector saved object. | [optional] -**Params** | Pointer to **map[string]interface{}** | The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. | [optional] +**Group** | **string** | The group name, which affects when the action runs (for example, when the threshold is met or when the alert is recovered). Each rule type has a list of valid action group names. If you don't need to group actions, set to `default`. | +**Id** | **string** | The identifier for the connector saved object. | +**Params** | **map[string]interface{}** | The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. | +**Uuid** | Pointer to **string** | A universally unique identifier (UUID) for the action. | [optional] ## Methods ### NewActionsInner -`func NewActionsInner() *ActionsInner` +`func NewActionsInner(group string, id string, params map[string]interface{}, ) *ActionsInner` NewActionsInner instantiates a new ActionsInner object This constructor will assign default values to properties that have it defined, @@ -29,6 +31,31 @@ NewActionsInnerWithDefaults instantiates a new ActionsInner object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set +### GetAlertsFilter + +`func (o *ActionsInner) GetAlertsFilter() ActionsInnerAlertsFilter` + +GetAlertsFilter returns the AlertsFilter field if non-nil, zero value otherwise. + +### GetAlertsFilterOk + +`func (o *ActionsInner) GetAlertsFilterOk() (*ActionsInnerAlertsFilter, bool)` + +GetAlertsFilterOk returns a tuple with the AlertsFilter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlertsFilter + +`func (o *ActionsInner) SetAlertsFilter(v ActionsInnerAlertsFilter)` + +SetAlertsFilter sets AlertsFilter field to given value. + +### HasAlertsFilter + +`func (o *ActionsInner) HasAlertsFilter() bool` + +HasAlertsFilter returns a boolean if a field has been set. + ### GetConnectorTypeId `func (o *ActionsInner) GetConnectorTypeId() string` @@ -98,11 +125,6 @@ and a boolean to check if the value has been set. SetGroup sets Group field to given value. -### HasGroup - -`func (o *ActionsInner) HasGroup() bool` - -HasGroup returns a boolean if a field has been set. ### GetId @@ -123,11 +145,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *ActionsInner) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetParams @@ -148,11 +165,31 @@ and a boolean to check if the value has been set. SetParams sets Params field to given value. -### HasParams -`func (o *ActionsInner) HasParams() bool` +### GetUuid + +`func (o *ActionsInner) GetUuid() string` + +GetUuid returns the Uuid field if non-nil, zero value otherwise. + +### GetUuidOk + +`func (o *ActionsInner) GetUuidOk() (*string, bool)` + +GetUuidOk returns a tuple with the Uuid field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUuid + +`func (o *ActionsInner) SetUuid(v string)` + +SetUuid sets Uuid field to given value. + +### HasUuid + +`func (o *ActionsInner) HasUuid() bool` -HasParams returns a boolean if a field has been set. +HasUuid returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/ActionsInnerAlertsFilter.md b/generated/alerting/docs/ActionsInnerAlertsFilter.md new file mode 100644 index 000000000..252ea36a3 --- /dev/null +++ b/generated/alerting/docs/ActionsInnerAlertsFilter.md @@ -0,0 +1,82 @@ +# ActionsInnerAlertsFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Query** | Pointer to [**ActionsInnerAlertsFilterQuery**](ActionsInnerAlertsFilterQuery.md) | | [optional] +**Timeframe** | Pointer to [**ActionsInnerAlertsFilterTimeframe**](ActionsInnerAlertsFilterTimeframe.md) | | [optional] + +## Methods + +### NewActionsInnerAlertsFilter + +`func NewActionsInnerAlertsFilter() *ActionsInnerAlertsFilter` + +NewActionsInnerAlertsFilter instantiates a new ActionsInnerAlertsFilter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewActionsInnerAlertsFilterWithDefaults + +`func NewActionsInnerAlertsFilterWithDefaults() *ActionsInnerAlertsFilter` + +NewActionsInnerAlertsFilterWithDefaults instantiates a new ActionsInnerAlertsFilter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetQuery + +`func (o *ActionsInnerAlertsFilter) GetQuery() ActionsInnerAlertsFilterQuery` + +GetQuery returns the Query field if non-nil, zero value otherwise. + +### GetQueryOk + +`func (o *ActionsInnerAlertsFilter) GetQueryOk() (*ActionsInnerAlertsFilterQuery, bool)` + +GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuery + +`func (o *ActionsInnerAlertsFilter) SetQuery(v ActionsInnerAlertsFilterQuery)` + +SetQuery sets Query field to given value. + +### HasQuery + +`func (o *ActionsInnerAlertsFilter) HasQuery() bool` + +HasQuery returns a boolean if a field has been set. + +### GetTimeframe + +`func (o *ActionsInnerAlertsFilter) GetTimeframe() ActionsInnerAlertsFilterTimeframe` + +GetTimeframe returns the Timeframe field if non-nil, zero value otherwise. + +### GetTimeframeOk + +`func (o *ActionsInnerAlertsFilter) GetTimeframeOk() (*ActionsInnerAlertsFilterTimeframe, bool)` + +GetTimeframeOk returns a tuple with the Timeframe field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeframe + +`func (o *ActionsInnerAlertsFilter) SetTimeframe(v ActionsInnerAlertsFilterTimeframe)` + +SetTimeframe sets Timeframe field to given value. + +### HasTimeframe + +`func (o *ActionsInnerAlertsFilter) HasTimeframe() bool` + +HasTimeframe returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/ActionsInnerAlertsFilterQuery.md b/generated/alerting/docs/ActionsInnerAlertsFilterQuery.md new file mode 100644 index 000000000..b707bc504 --- /dev/null +++ b/generated/alerting/docs/ActionsInnerAlertsFilterQuery.md @@ -0,0 +1,82 @@ +# ActionsInnerAlertsFilterQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kql** | Pointer to **string** | A filter written in Kibana Query Language (KQL). | [optional] +**Filters** | Pointer to [**[]Filter**](Filter.md) | | [optional] + +## Methods + +### NewActionsInnerAlertsFilterQuery + +`func NewActionsInnerAlertsFilterQuery() *ActionsInnerAlertsFilterQuery` + +NewActionsInnerAlertsFilterQuery instantiates a new ActionsInnerAlertsFilterQuery object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewActionsInnerAlertsFilterQueryWithDefaults + +`func NewActionsInnerAlertsFilterQueryWithDefaults() *ActionsInnerAlertsFilterQuery` + +NewActionsInnerAlertsFilterQueryWithDefaults instantiates a new ActionsInnerAlertsFilterQuery object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetKql + +`func (o *ActionsInnerAlertsFilterQuery) GetKql() string` + +GetKql returns the Kql field if non-nil, zero value otherwise. + +### GetKqlOk + +`func (o *ActionsInnerAlertsFilterQuery) GetKqlOk() (*string, bool)` + +GetKqlOk returns a tuple with the Kql field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKql + +`func (o *ActionsInnerAlertsFilterQuery) SetKql(v string)` + +SetKql sets Kql field to given value. + +### HasKql + +`func (o *ActionsInnerAlertsFilterQuery) HasKql() bool` + +HasKql returns a boolean if a field has been set. + +### GetFilters + +`func (o *ActionsInnerAlertsFilterQuery) GetFilters() []Filter` + +GetFilters returns the Filters field if non-nil, zero value otherwise. + +### GetFiltersOk + +`func (o *ActionsInnerAlertsFilterQuery) GetFiltersOk() (*[]Filter, bool)` + +GetFiltersOk returns a tuple with the Filters field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilters + +`func (o *ActionsInnerAlertsFilterQuery) SetFilters(v []Filter)` + +SetFilters sets Filters field to given value. + +### HasFilters + +`func (o *ActionsInnerAlertsFilterQuery) HasFilters() bool` + +HasFilters returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/ActionsInnerAlertsFilterTimeframe.md b/generated/alerting/docs/ActionsInnerAlertsFilterTimeframe.md new file mode 100644 index 000000000..97b327bdb --- /dev/null +++ b/generated/alerting/docs/ActionsInnerAlertsFilterTimeframe.md @@ -0,0 +1,108 @@ +# ActionsInnerAlertsFilterTimeframe + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Days** | Pointer to **[]int32** | | [optional] +**Hours** | Pointer to [**ActionsInnerAlertsFilterTimeframeHours**](ActionsInnerAlertsFilterTimeframeHours.md) | | [optional] +**Timezone** | Pointer to **string** | The ISO time zone for the `hours` values. Values such as `UTC` and `UTC+1` also work but lack built-in daylight savings time support and are not recommended. | [optional] + +## Methods + +### NewActionsInnerAlertsFilterTimeframe + +`func NewActionsInnerAlertsFilterTimeframe() *ActionsInnerAlertsFilterTimeframe` + +NewActionsInnerAlertsFilterTimeframe instantiates a new ActionsInnerAlertsFilterTimeframe object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewActionsInnerAlertsFilterTimeframeWithDefaults + +`func NewActionsInnerAlertsFilterTimeframeWithDefaults() *ActionsInnerAlertsFilterTimeframe` + +NewActionsInnerAlertsFilterTimeframeWithDefaults instantiates a new ActionsInnerAlertsFilterTimeframe object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDays + +`func (o *ActionsInnerAlertsFilterTimeframe) GetDays() []int32` + +GetDays returns the Days field if non-nil, zero value otherwise. + +### GetDaysOk + +`func (o *ActionsInnerAlertsFilterTimeframe) GetDaysOk() (*[]int32, bool)` + +GetDaysOk returns a tuple with the Days field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDays + +`func (o *ActionsInnerAlertsFilterTimeframe) SetDays(v []int32)` + +SetDays sets Days field to given value. + +### HasDays + +`func (o *ActionsInnerAlertsFilterTimeframe) HasDays() bool` + +HasDays returns a boolean if a field has been set. + +### GetHours + +`func (o *ActionsInnerAlertsFilterTimeframe) GetHours() ActionsInnerAlertsFilterTimeframeHours` + +GetHours returns the Hours field if non-nil, zero value otherwise. + +### GetHoursOk + +`func (o *ActionsInnerAlertsFilterTimeframe) GetHoursOk() (*ActionsInnerAlertsFilterTimeframeHours, bool)` + +GetHoursOk returns a tuple with the Hours field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHours + +`func (o *ActionsInnerAlertsFilterTimeframe) SetHours(v ActionsInnerAlertsFilterTimeframeHours)` + +SetHours sets Hours field to given value. + +### HasHours + +`func (o *ActionsInnerAlertsFilterTimeframe) HasHours() bool` + +HasHours returns a boolean if a field has been set. + +### GetTimezone + +`func (o *ActionsInnerAlertsFilterTimeframe) GetTimezone() string` + +GetTimezone returns the Timezone field if non-nil, zero value otherwise. + +### GetTimezoneOk + +`func (o *ActionsInnerAlertsFilterTimeframe) GetTimezoneOk() (*string, bool)` + +GetTimezoneOk returns a tuple with the Timezone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimezone + +`func (o *ActionsInnerAlertsFilterTimeframe) SetTimezone(v string)` + +SetTimezone sets Timezone field to given value. + +### HasTimezone + +`func (o *ActionsInnerAlertsFilterTimeframe) HasTimezone() bool` + +HasTimezone returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/ActionsInnerAlertsFilterTimeframeHours.md b/generated/alerting/docs/ActionsInnerAlertsFilterTimeframeHours.md new file mode 100644 index 000000000..f1a5ca305 --- /dev/null +++ b/generated/alerting/docs/ActionsInnerAlertsFilterTimeframeHours.md @@ -0,0 +1,82 @@ +# ActionsInnerAlertsFilterTimeframeHours + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**End** | Pointer to **string** | The end of the time frame in 24-hour notation (`hh:mm`). | [optional] +**Start** | Pointer to **string** | The start of the time frame in 24-hour notation (`hh:mm`). | [optional] + +## Methods + +### NewActionsInnerAlertsFilterTimeframeHours + +`func NewActionsInnerAlertsFilterTimeframeHours() *ActionsInnerAlertsFilterTimeframeHours` + +NewActionsInnerAlertsFilterTimeframeHours instantiates a new ActionsInnerAlertsFilterTimeframeHours object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewActionsInnerAlertsFilterTimeframeHoursWithDefaults + +`func NewActionsInnerAlertsFilterTimeframeHoursWithDefaults() *ActionsInnerAlertsFilterTimeframeHours` + +NewActionsInnerAlertsFilterTimeframeHoursWithDefaults instantiates a new ActionsInnerAlertsFilterTimeframeHours object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEnd + +`func (o *ActionsInnerAlertsFilterTimeframeHours) GetEnd() string` + +GetEnd returns the End field if non-nil, zero value otherwise. + +### GetEndOk + +`func (o *ActionsInnerAlertsFilterTimeframeHours) GetEndOk() (*string, bool)` + +GetEndOk returns a tuple with the End field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnd + +`func (o *ActionsInnerAlertsFilterTimeframeHours) SetEnd(v string)` + +SetEnd sets End field to given value. + +### HasEnd + +`func (o *ActionsInnerAlertsFilterTimeframeHours) HasEnd() bool` + +HasEnd returns a boolean if a field has been set. + +### GetStart + +`func (o *ActionsInnerAlertsFilterTimeframeHours) GetStart() string` + +GetStart returns the Start field if non-nil, zero value otherwise. + +### GetStartOk + +`func (o *ActionsInnerAlertsFilterTimeframeHours) GetStartOk() (*string, bool)` + +GetStartOk returns a tuple with the Start field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStart + +`func (o *ActionsInnerAlertsFilterTimeframeHours) SetStart(v string)` + +SetStart sets Start field to given value. + +### HasStart + +`func (o *ActionsInnerAlertsFilterTimeframeHours) HasStart() bool` + +HasStart returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/ActionsInnerFrequency.md b/generated/alerting/docs/ActionsInnerFrequency.md index cd9b8c805..18c23a725 100644 --- a/generated/alerting/docs/ActionsInnerFrequency.md +++ b/generated/alerting/docs/ActionsInnerFrequency.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**NotifyWhen** | [**NotifyWhen**](NotifyWhen.md) | | +**NotifyWhen** | [**NotifyWhenAction**](NotifyWhenAction.md) | | **Summary** | **bool** | Indicates whether the action is a summary. | -**Throttle** | Pointer to **NullableString** | The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. | [optional] +**Throttle** | Pointer to **NullableString** | The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. | [optional] ## Methods ### NewActionsInnerFrequency -`func NewActionsInnerFrequency(notifyWhen NotifyWhen, summary bool, ) *ActionsInnerFrequency` +`func NewActionsInnerFrequency(notifyWhen NotifyWhenAction, summary bool, ) *ActionsInnerFrequency` NewActionsInnerFrequency instantiates a new ActionsInnerFrequency object This constructor will assign default values to properties that have it defined, @@ -29,20 +29,20 @@ but it doesn't guarantee that properties required by API are set ### GetNotifyWhen -`func (o *ActionsInnerFrequency) GetNotifyWhen() NotifyWhen` +`func (o *ActionsInnerFrequency) GetNotifyWhen() NotifyWhenAction` GetNotifyWhen returns the NotifyWhen field if non-nil, zero value otherwise. ### GetNotifyWhenOk -`func (o *ActionsInnerFrequency) GetNotifyWhenOk() (*NotifyWhen, bool)` +`func (o *ActionsInnerFrequency) GetNotifyWhenOk() (*NotifyWhenAction, bool)` GetNotifyWhenOk returns a tuple with the NotifyWhen field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNotifyWhen -`func (o *ActionsInnerFrequency) SetNotifyWhen(v NotifyWhen)` +`func (o *ActionsInnerFrequency) SetNotifyWhen(v NotifyWhenAction)` SetNotifyWhen sets NotifyWhen field to given value. diff --git a/generated/alerting/docs/AlertDelay.md b/generated/alerting/docs/AlertDelay.md new file mode 100644 index 000000000..678108d7e --- /dev/null +++ b/generated/alerting/docs/AlertDelay.md @@ -0,0 +1,51 @@ +# AlertDelay + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Active** | **float32** | The number of consecutive runs that must meet the rule conditions. | + +## Methods + +### NewAlertDelay + +`func NewAlertDelay(active float32, ) *AlertDelay` + +NewAlertDelay instantiates a new AlertDelay object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAlertDelayWithDefaults + +`func NewAlertDelayWithDefaults() *AlertDelay` + +NewAlertDelayWithDefaults instantiates a new AlertDelay object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetActive + +`func (o *AlertDelay) GetActive() float32` + +GetActive returns the Active field if non-nil, zero value otherwise. + +### GetActiveOk + +`func (o *AlertDelay) GetActiveOk() (*float32, bool)` + +GetActiveOk returns a tuple with the Active field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetActive + +`func (o *AlertDelay) SetActive(v float32)` + +SetActive sets Active field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/AlertResponseProperties.md b/generated/alerting/docs/AlertResponseProperties.md index 38dc6c941..57d64d15e 100644 --- a/generated/alerting/docs/AlertResponseProperties.md +++ b/generated/alerting/docs/AlertResponseProperties.md @@ -303,16 +303,6 @@ SetMutedInstanceIds sets MutedInstanceIds field to given value. HasMutedInstanceIds returns a boolean if a field has been set. -### SetMutedInstanceIdsNil - -`func (o *AlertResponseProperties) SetMutedInstanceIdsNil(b bool)` - - SetMutedInstanceIdsNil sets the value for MutedInstanceIds to be an explicit nil - -### UnsetMutedInstanceIds -`func (o *AlertResponseProperties) UnsetMutedInstanceIds()` - -UnsetMutedInstanceIds ensures that no value is present for MutedInstanceIds, not even an explicit nil ### GetName `func (o *AlertResponseProperties) GetName() string` diff --git a/generated/alerting/docs/AlertingApi.md b/generated/alerting/docs/AlertingApi.md index 66196f2b9..a13039c35 100644 --- a/generated/alerting/docs/AlertingApi.md +++ b/generated/alerting/docs/AlertingApi.md @@ -1,10 +1,11 @@ # \AlertingAPI -All URIs are relative to *http://localhost:5601* +All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**CreateRule**](AlertingAPI.md#CreateRule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule. +[**CreateRule**](AlertingAPI.md#CreateRule) | **Post** /s/{spaceId}/api/alerting/rule | Creates a rule with a randomly generated rule identifier. +[**CreateRuleId**](AlertingAPI.md#CreateRuleId) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId} | Creates a rule with a specific rule identifier. [**DeleteRule**](AlertingAPI.md#DeleteRule) | **Delete** /s/{spaceId}/api/alerting/rule/{ruleId} | Deletes a rule. [**DisableRule**](AlertingAPI.md#DisableRule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_disable | Disables a rule. [**EnableRule**](AlertingAPI.md#EnableRule) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_enable | Enables a rule. @@ -30,14 +31,15 @@ Method | HTTP request | Description [**UnmuteAlert**](AlertingAPI.md#UnmuteAlert) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute | Unmutes an alert. [**UnmuteAllAlerts**](AlertingAPI.md#UnmuteAllAlerts) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all | Unmutes all alerts. [**UpdateRule**](AlertingAPI.md#UpdateRule) | **Put** /s/{spaceId}/api/alerting/rule/{ruleId} | Updates the attributes for a rule. +[**UpdateRuleAPIKey**](AlertingAPI.md#UpdateRuleAPIKey) | **Post** /s/{spaceId}/api/alerting/rule/{ruleId}/_update_api_key | Updates the API key for a rule. ## CreateRule -> RuleResponseProperties CreateRule(ctx, spaceId, ruleId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() +> RuleResponseProperties CreateRule(ctx, spaceId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() -Creates a rule. +Creates a rule with a randomly generated rule identifier. @@ -54,14 +56,13 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. createRuleRequest := *openapiclient.NewCreateRuleRequest("Consumer_example", "cluster_health_rule", map[string]interface{}{"key": interface{}(123)}, "RuleTypeId_example", *openapiclient.NewSchedule()) // CreateRuleRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AlertingAPI.CreateRule(context.Background(), spaceId, ruleId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() + resp, r, err := apiClient.AlertingAPI.CreateRule(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AlertingAPI.CreateRule``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -77,8 +78,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | -**ruleId** | **string** | An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -87,7 +87,83 @@ Other parameters are passed through a pointer to a apiCreateRuleRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | + + **createRuleRequest** | [**CreateRuleRequest**](CreateRuleRequest.md) | | + +### Return type + +[**RuleResponseProperties**](RuleResponseProperties.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateRuleId + +> RuleResponseProperties CreateRuleId(ctx, spaceId, ruleId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() + +Creates a rule with a specific rule identifier. + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/elastic/terraform-provider-elasticstack/alerting" +) + +func main() { + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + ruleId := "ruleId_example" // string | An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. + createRuleRequest := *openapiclient.NewCreateRuleRequest("Consumer_example", "cluster_health_rule", map[string]interface{}{"key": interface{}(123)}, "RuleTypeId_example", *openapiclient.NewSchedule()) // CreateRuleRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AlertingAPI.CreateRuleId(context.Background(), spaceId, ruleId).KbnXsrf(kbnXsrf).CreateRuleRequest(createRuleRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AlertingAPI.CreateRuleId``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateRuleId`: RuleResponseProperties + fmt.Fprintf(os.Stdout, "Response from `AlertingAPI.CreateRuleId`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | **string** | An UUID v1 or v4 identifier for the rule. If you omit this parameter, an identifier is randomly generated. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateRuleIdRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | **createRuleRequest** | [**CreateRuleRequest**](CreateRuleRequest.md) | | @@ -131,9 +207,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -151,8 +227,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -161,7 +237,7 @@ Other parameters are passed through a pointer to a apiDeleteRuleRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -204,9 +280,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -224,8 +300,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -234,7 +310,7 @@ Other parameters are passed through a pointer to a apiDisableRuleRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -277,9 +353,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -297,8 +373,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -307,7 +383,7 @@ Other parameters are passed through a pointer to a apiEnableRuleRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -350,17 +426,17 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - defaultSearchOperator := "OR" // string | The default operator to use for the simple_query_string. (optional) (default to "OR") - fields := []string{"Inner_example"} // []string | The fields to return in the `attributes` key of the response. (optional) + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + defaultSearchOperator := "defaultSearchOperator_example" // string | The default operator to use for the simple_query_string. (optional) (default to "OR") + fields := []*string{"Inner_example"} // []*string | The fields to return in the `attributes` key of the response. (optional) filter := "filter_example" // string | A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: \"myTitle\"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`. (optional) hasReference := *openapiclient.NewFindRulesHasReferenceParameter() // FindRulesHasReferenceParameter | Filters the rules that have a relation with the reference objects with a specific type and identifier. (optional) - page := int32(1) // int32 | The page number to return. (optional) (default to 1) - perPage := int32(20) // int32 | The number of rules to return per page. (optional) (default to 20) + page := int32(56) // int32 | The page number to return. (optional) (default to 1) + perPage := int32(56) // int32 | The number of rules to return per page. (optional) (default to 20) search := "search_example" // string | An Elasticsearch simple_query_string query that filters the objects in the response. (optional) - searchFields := openapiclient.findRules_search_fields_parameter{ArrayOfString: new([]string)} // FindRulesSearchFieldsParameter | The fields to perform the simple_query_string parsed query against. (optional) + searchFields := "searchFields_example" // string | The fields to perform the simple_query_string parsed query against. (optional) sortField := "sortField_example" // string | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. (optional) - sortOrder := "asc" // string | Determines the sort order. (optional) (default to "desc") + sortOrder := "sortOrder_example" // string | Determines the sort order. (optional) (default to "desc") configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -380,7 +456,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -397,7 +473,7 @@ Name | Type | Description | Notes **page** | **int32** | The page number to return. | [default to 1] **perPage** | **int32** | The number of rules to return per page. | [default to 20] **search** | **string** | An Elasticsearch simple_query_string query that filters the objects in the response. | - **searchFields** | [**FindRulesSearchFieldsParameter**](FindRulesSearchFieldsParameter.md) | The fields to perform the simple_query_string parsed query against. | + **searchFields** | **string** | The fields to perform the simple_query_string parsed query against. | **sortField** | **string** | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. | **sortOrder** | **string** | Determines the sort order. | [default to "desc"] @@ -440,7 +516,7 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -460,7 +536,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -510,8 +586,8 @@ import ( ) func main() { - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -531,8 +607,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -583,7 +659,7 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -603,7 +679,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -653,10 +729,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - legacyCreateAlertRequestProperties := *openapiclient.NewLegacyCreateAlertRequestProperties("AlertTypeId_example", "Consumer_example", "Name_example", "NotifyWhen_example", map[string]interface{}(123), *openapiclient.NewLegacyCreateAlertRequestPropertiesSchedule()) // LegacyCreateAlertRequestProperties | + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + alertId := "alertId_example" // string | An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + legacyCreateAlertRequestProperties := *openapiclient.NewLegacyCreateAlertRequestProperties("AlertTypeId_example", "Consumer_example", "Name_example", "NotifyWhen_example", map[string]interface{}(123), *openapiclient.NewLegacyUpdateAlertRequestPropertiesSchedule()) // LegacyCreateAlertRequestProperties | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -677,7 +753,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **alertId** | **string** | An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -686,7 +762,7 @@ Other parameters are passed through a pointer to a apiLegacyCreateAlertRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | **legacyCreateAlertRequestProperties** | [**LegacyCreateAlertRequestProperties**](LegacyCreateAlertRequestProperties.md) | | @@ -730,9 +806,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -750,7 +826,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -760,7 +836,7 @@ Other parameters are passed through a pointer to a apiLegacyDisableAlertRequest Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -803,9 +879,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -823,7 +899,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -833,7 +909,7 @@ Other parameters are passed through a pointer to a apiLegacyEnableAlertRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -876,17 +952,17 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - defaultSearchOperator := "OR" // string | The default operator to use for the `simple_query_string`. (optional) (default to "OR") + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + defaultSearchOperator := "defaultSearchOperator_example" // string | The default operator to use for the `simple_query_string`. (optional) (default to "OR") fields := []string{"Inner_example"} // []string | The fields to return in the `attributes` key of the response. (optional) filter := "filter_example" // string | A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: \"myTitle\"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`. (optional) - hasReference := *openapiclient.NewFindRulesHasReferenceParameter() // FindRulesHasReferenceParameter | Filters the rules that have a relation with the reference objects with a specific type and identifier. (optional) - page := int32(1) // int32 | The page number to return. (optional) (default to 1) - perPage := int32(20) // int32 | The number of alerts to return per page. (optional) (default to 20) + hasReference := *openapiclient.NewLegacyFindAlertsHasReferenceParameter() // LegacyFindAlertsHasReferenceParameter | Filters the rules that have a relation with the reference objects with a specific type and identifier. (optional) + page := int32(56) // int32 | The page number to return. (optional) (default to 1) + perPage := int32(56) // int32 | The number of alerts to return per page. (optional) (default to 20) search := "search_example" // string | An Elasticsearch `simple_query_string` query that filters the alerts in the response. (optional) - searchFields := openapiclient.findRules_search_fields_parameter{ArrayOfString: new([]string)} // FindRulesSearchFieldsParameter | The fields to perform the `simple_query_string` parsed query against. (optional) + searchFields := "searchFields_example" // string | The fields to perform the `simple_query_string` parsed query against. (optional) sortField := "sortField_example" // string | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. (optional) - sortOrder := "asc" // string | Determines the sort order. (optional) (default to "desc") + sortOrder := "sortOrder_example" // string | Determines the sort order. (optional) (default to "desc") configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -906,7 +982,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -919,11 +995,11 @@ Name | Type | Description | Notes **defaultSearchOperator** | **string** | The default operator to use for the `simple_query_string`. | [default to "OR"] **fields** | **[]string** | The fields to return in the `attributes` key of the response. | **filter** | **string** | A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: \"myTitle\"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`. | - **hasReference** | [**FindRulesHasReferenceParameter**](FindRulesHasReferenceParameter.md) | Filters the rules that have a relation with the reference objects with a specific type and identifier. | + **hasReference** | [**LegacyFindAlertsHasReferenceParameter**](LegacyFindAlertsHasReferenceParameter.md) | Filters the rules that have a relation with the reference objects with a specific type and identifier. | **page** | **int32** | The page number to return. | [default to 1] **perPage** | **int32** | The number of alerts to return per page. | [default to 20] **search** | **string** | An Elasticsearch `simple_query_string` query that filters the alerts in the response. | - **searchFields** | [**FindRulesSearchFieldsParameter**](FindRulesSearchFieldsParameter.md) | The fields to perform the `simple_query_string` parsed query against. | + **searchFields** | **string** | The fields to perform the `simple_query_string` parsed query against. | **sortField** | **string** | Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. | **sortOrder** | **string** | Determines the sort order. | [default to "desc"] @@ -966,8 +1042,8 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -987,7 +1063,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -1039,7 +1115,7 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1059,7 +1135,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1109,7 +1185,7 @@ import ( ) func main() { - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1129,7 +1205,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1179,10 +1255,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | An identifier for the alert. - alertInstanceId := "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2" // string | An identifier for the alert instance. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | An identifier for the alert. + alertInstanceId := "alertInstanceId_example" // string | An identifier for the alert instance. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1200,7 +1276,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | An identifier for the alert. | **alertInstanceId** | **string** | An identifier for the alert instance. | @@ -1211,7 +1287,7 @@ Other parameters are passed through a pointer to a apiLegacyMuteAlertInstanceReq Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1255,9 +1331,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1275,7 +1351,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -1285,7 +1361,7 @@ Other parameters are passed through a pointer to a apiLegacyMuteAllAlertInstance Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1328,10 +1404,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | An identifier for the alert. - alertInstanceId := "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2" // string | An identifier for the alert instance. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | An identifier for the alert. + alertInstanceId := "alertInstanceId_example" // string | An identifier for the alert instance. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1349,7 +1425,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | An identifier for the alert. | **alertInstanceId** | **string** | An identifier for the alert instance. | @@ -1360,7 +1436,7 @@ Other parameters are passed through a pointer to a apiLegacyUnmuteAlertInstanceR Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1404,9 +1480,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1424,7 +1500,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -1434,7 +1510,7 @@ Other parameters are passed through a pointer to a apiLegacyUnmuteAllAlertInstan Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1477,9 +1553,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. legacyUpdateAlertRequestProperties := *openapiclient.NewLegacyUpdateAlertRequestProperties("Name_example", "NotifyWhen_example", map[string]interface{}(123), *openapiclient.NewLegacyUpdateAlertRequestPropertiesSchedule()) // LegacyUpdateAlertRequestProperties | configuration := openapiclient.NewConfiguration() @@ -1500,7 +1576,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -1510,7 +1586,7 @@ Other parameters are passed through a pointer to a apiLegacyUpdateAlertRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | **legacyUpdateAlertRequestProperties** | [**LegacyUpdateAlertRequestProperties**](LegacyUpdateAlertRequestProperties.md) | | @@ -1554,9 +1630,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - alertId := "41893910-6bca-11eb-9e0d-85d233e3ee35" // string | The identifier for the alert. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + alertId := "alertId_example" // string | The identifier for the alert. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1574,7 +1650,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | **alertId** | **string** | The identifier for the alert. | ### Other Parameters @@ -1584,7 +1660,7 @@ Other parameters are passed through a pointer to a apiLegaryDeleteAlertRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1627,10 +1703,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - alertId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + alertId := TODO // interface{} | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1648,9 +1724,9 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**alertId** | **string** | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. | -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**alertId** | [**interface{}**](.md) | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1659,7 +1735,7 @@ Other parameters are passed through a pointer to a apiMuteAlertRequest struct vi Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1703,9 +1779,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1723,8 +1799,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1733,7 +1809,7 @@ Other parameters are passed through a pointer to a apiMuteAllAlertsRequest struc Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1776,10 +1852,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - alertId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + alertId := TODO // interface{} | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1797,9 +1873,9 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**alertId** | **string** | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. | -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**alertId** | [**interface{}**](.md) | An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1808,7 +1884,7 @@ Other parameters are passed through a pointer to a apiUnmuteAlertRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1852,9 +1928,9 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1872,8 +1948,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1882,7 +1958,7 @@ Other parameters are passed through a pointer to a apiUnmuteAllAlertsRequest str Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | @@ -1925,10 +2001,10 @@ import ( ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - ruleId := "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" // string | An identifier for the rule. - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - updateRuleRequest := *openapiclient.NewUpdateRuleRequest("cluster_health_rule", map[string]interface{}{"key": interface{}(123)}, *openapiclient.NewSchedule()) // UpdateRuleRequest | + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + updateRuleRequest := *openapiclient.NewUpdateRuleRequest("Name_example", map[string]interface{}{"key": interface{}(123)}, *openapiclient.NewSchedule()) // UpdateRuleRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -1948,8 +2024,8 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**ruleId** | **string** | An identifier for the rule. | -**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -1958,7 +2034,7 @@ Other parameters are passed through a pointer to a apiUpdateRuleRequest struct v Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **kbnXsrf** | **string** | Cross-site request forgery protection | + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | **updateRuleRequest** | [**UpdateRuleRequest**](UpdateRuleRequest.md) | | @@ -1980,3 +2056,76 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## UpdateRuleAPIKey + +> UpdateRuleAPIKey(ctx, ruleId, spaceId).KbnXsrf(kbnXsrf).Execute() + +Updates the API key for a rule. + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/elastic/terraform-provider-elasticstack/alerting" +) + +func main() { + kbnXsrf := TODO // interface{} | Cross-site request forgery protection + ruleId := TODO // interface{} | An identifier for the rule. + spaceId := TODO // interface{} | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.AlertingAPI.UpdateRuleAPIKey(context.Background(), ruleId, spaceId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AlertingAPI.UpdateRuleAPIKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ruleId** | [**interface{}**](.md) | An identifier for the rule. | +**spaceId** | [**interface{}**](.md) | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateRuleAPIKeyRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | [**interface{}**](interface{}.md) | Cross-site request forgery protection | + + + +### Return type + + (empty response body) + +### Authorization + +[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/generated/alerting/docs/CreateRuleRequest.md b/generated/alerting/docs/CreateRuleRequest.md index f08b6d98b..b2d11f093 100644 --- a/generated/alerting/docs/CreateRuleRequest.md +++ b/generated/alerting/docs/CreateRuleRequest.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Actions** | Pointer to [**[]ActionsInner**](ActionsInner.md) | | [optional] [default to []] +**Actions** | Pointer to [**[]ActionsInner**](ActionsInner.md) | | [optional] **Consumer** | **string** | The name of the application or feature that owns the rule. For example: `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. | **Enabled** | Pointer to **bool** | Indicates whether you want to run the rule on an interval basis after it is created. | [optional] **Name** | **string** | The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule. | @@ -12,8 +12,9 @@ Name | Type | Description | Notes **Params** | **map[string]interface{}** | The parameters for the rule. | **RuleTypeId** | **string** | The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. | **Schedule** | [**Schedule**](Schedule.md) | | -**Tags** | Pointer to **[]string** | The tags for the rule. | [optional] [default to []] -**Throttle** | Pointer to **NullableString** | The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. | [optional] +**Tags** | Pointer to **[]string** | | [optional] +**Throttle** | Pointer to **NullableString** | Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. | [optional] +**AlertDelay** | Pointer to [**AlertDelay**](AlertDelay.md) | | [optional] ## Methods @@ -59,16 +60,6 @@ SetActions sets Actions field to given value. HasActions returns a boolean if a field has been set. -### SetActionsNil - -`func (o *CreateRuleRequest) SetActionsNil(b bool)` - - SetActionsNil sets the value for Actions to be an explicit nil - -### UnsetActions -`func (o *CreateRuleRequest) UnsetActions()` - -UnsetActions ensures that no value is present for Actions, not even an explicit nil ### GetConsumer `func (o *CreateRuleRequest) GetConsumer() string` @@ -279,6 +270,31 @@ HasThrottle returns a boolean if a field has been set. `func (o *CreateRuleRequest) UnsetThrottle()` UnsetThrottle ensures that no value is present for Throttle, not even an explicit nil +### GetAlertDelay + +`func (o *CreateRuleRequest) GetAlertDelay() AlertDelay` + +GetAlertDelay returns the AlertDelay field if non-nil, zero value otherwise. + +### GetAlertDelayOk + +`func (o *CreateRuleRequest) GetAlertDelayOk() (*AlertDelay, bool)` + +GetAlertDelayOk returns a tuple with the AlertDelay field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlertDelay + +`func (o *CreateRuleRequest) SetAlertDelay(v AlertDelay)` + +SetAlertDelay sets AlertDelay field to given value. + +### HasAlertDelay + +`func (o *CreateRuleRequest) HasAlertDelay() bool` + +HasAlertDelay returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/FieldmapProperties.md b/generated/alerting/docs/FieldmapProperties.md new file mode 100644 index 000000000..32d32a814 --- /dev/null +++ b/generated/alerting/docs/FieldmapProperties.md @@ -0,0 +1,300 @@ +# FieldmapProperties + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Array** | Pointer to **bool** | Indicates whether the field is an array. | [optional] +**Dynamic** | Pointer to **bool** | Indicates whether it is a dynamic field mapping. | [optional] +**Format** | Pointer to **string** | Indicates the format of the field. For example, if the `type` is `date_range`, the `format` can be `epoch_millis||strict_date_optional_time`. | [optional] +**IgnoreAbove** | Pointer to **int32** | Specifies the maximum length of a string field. Longer strings are not indexed or stored. | [optional] +**Index** | Pointer to **bool** | Indicates whether field values are indexed. | [optional] +**Path** | Pointer to **string** | TBD | [optional] +**Properties** | Pointer to | Details about the object properties. This property is applicable when `type` is `object`. | [optional] +**Required** | Pointer to **bool** | Indicates whether the field is required. | [optional] +**ScalingFactor** | Pointer to **int32** | The scaling factor to use when encoding values. This property is applicable when `type` is `scaled_float`. Values will be multiplied by this factor at index time and rounded to the closest long value. | [optional] +**Type** | Pointer to **string** | Specifies the data type for the field. | [optional] + +## Methods + +### NewFieldmapProperties + +`func NewFieldmapProperties() *FieldmapProperties` + +NewFieldmapProperties instantiates a new FieldmapProperties object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFieldmapPropertiesWithDefaults + +`func NewFieldmapPropertiesWithDefaults() *FieldmapProperties` + +NewFieldmapPropertiesWithDefaults instantiates a new FieldmapProperties object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetArray + +`func (o *FieldmapProperties) GetArray() bool` + +GetArray returns the Array field if non-nil, zero value otherwise. + +### GetArrayOk + +`func (o *FieldmapProperties) GetArrayOk() (*bool, bool)` + +GetArrayOk returns a tuple with the Array field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArray + +`func (o *FieldmapProperties) SetArray(v bool)` + +SetArray sets Array field to given value. + +### HasArray + +`func (o *FieldmapProperties) HasArray() bool` + +HasArray returns a boolean if a field has been set. + +### GetDynamic + +`func (o *FieldmapProperties) GetDynamic() bool` + +GetDynamic returns the Dynamic field if non-nil, zero value otherwise. + +### GetDynamicOk + +`func (o *FieldmapProperties) GetDynamicOk() (*bool, bool)` + +GetDynamicOk returns a tuple with the Dynamic field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDynamic + +`func (o *FieldmapProperties) SetDynamic(v bool)` + +SetDynamic sets Dynamic field to given value. + +### HasDynamic + +`func (o *FieldmapProperties) HasDynamic() bool` + +HasDynamic returns a boolean if a field has been set. + +### GetFormat + +`func (o *FieldmapProperties) GetFormat() string` + +GetFormat returns the Format field if non-nil, zero value otherwise. + +### GetFormatOk + +`func (o *FieldmapProperties) GetFormatOk() (*string, bool)` + +GetFormatOk returns a tuple with the Format field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFormat + +`func (o *FieldmapProperties) SetFormat(v string)` + +SetFormat sets Format field to given value. + +### HasFormat + +`func (o *FieldmapProperties) HasFormat() bool` + +HasFormat returns a boolean if a field has been set. + +### GetIgnoreAbove + +`func (o *FieldmapProperties) GetIgnoreAbove() int32` + +GetIgnoreAbove returns the IgnoreAbove field if non-nil, zero value otherwise. + +### GetIgnoreAboveOk + +`func (o *FieldmapProperties) GetIgnoreAboveOk() (*int32, bool)` + +GetIgnoreAboveOk returns a tuple with the IgnoreAbove field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIgnoreAbove + +`func (o *FieldmapProperties) SetIgnoreAbove(v int32)` + +SetIgnoreAbove sets IgnoreAbove field to given value. + +### HasIgnoreAbove + +`func (o *FieldmapProperties) HasIgnoreAbove() bool` + +HasIgnoreAbove returns a boolean if a field has been set. + +### GetIndex + +`func (o *FieldmapProperties) GetIndex() bool` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *FieldmapProperties) GetIndexOk() (*bool, bool)` + +GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndex + +`func (o *FieldmapProperties) SetIndex(v bool)` + +SetIndex sets Index field to given value. + +### HasIndex + +`func (o *FieldmapProperties) HasIndex() bool` + +HasIndex returns a boolean if a field has been set. + +### GetPath + +`func (o *FieldmapProperties) GetPath() string` + +GetPath returns the Path field if non-nil, zero value otherwise. + +### GetPathOk + +`func (o *FieldmapProperties) GetPathOk() (*string, bool)` + +GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPath + +`func (o *FieldmapProperties) SetPath(v string)` + +SetPath sets Path field to given value. + +### HasPath + +`func (o *FieldmapProperties) HasPath() bool` + +HasPath returns a boolean if a field has been set. + +### GetProperties + +`func (o *FieldmapProperties) GetProperties() map[string]FieldmapPropertiesPropertiesValue` + +GetProperties returns the Properties field if non-nil, zero value otherwise. + +### GetPropertiesOk + +`func (o *FieldmapProperties) GetPropertiesOk() (*map[string]FieldmapPropertiesPropertiesValue, bool)` + +GetPropertiesOk returns a tuple with the Properties field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProperties + +`func (o *FieldmapProperties) SetProperties(v map[string]FieldmapPropertiesPropertiesValue)` + +SetProperties sets Properties field to given value. + +### HasProperties + +`func (o *FieldmapProperties) HasProperties() bool` + +HasProperties returns a boolean if a field has been set. + +### SetPropertiesNil + +`func (o *FieldmapProperties) SetPropertiesNil(b bool)` + + SetPropertiesNil sets the value for Properties to be an explicit nil + +### UnsetProperties +`func (o *FieldmapProperties) UnsetProperties()` + +UnsetProperties ensures that no value is present for Properties, not even an explicit nil +### GetRequired + +`func (o *FieldmapProperties) GetRequired() bool` + +GetRequired returns the Required field if non-nil, zero value otherwise. + +### GetRequiredOk + +`func (o *FieldmapProperties) GetRequiredOk() (*bool, bool)` + +GetRequiredOk returns a tuple with the Required field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequired + +`func (o *FieldmapProperties) SetRequired(v bool)` + +SetRequired sets Required field to given value. + +### HasRequired + +`func (o *FieldmapProperties) HasRequired() bool` + +HasRequired returns a boolean if a field has been set. + +### GetScalingFactor + +`func (o *FieldmapProperties) GetScalingFactor() int32` + +GetScalingFactor returns the ScalingFactor field if non-nil, zero value otherwise. + +### GetScalingFactorOk + +`func (o *FieldmapProperties) GetScalingFactorOk() (*int32, bool)` + +GetScalingFactorOk returns a tuple with the ScalingFactor field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScalingFactor + +`func (o *FieldmapProperties) SetScalingFactor(v int32)` + +SetScalingFactor sets ScalingFactor field to given value. + +### HasScalingFactor + +`func (o *FieldmapProperties) HasScalingFactor() bool` + +HasScalingFactor returns a boolean if a field has been set. + +### GetType + +`func (o *FieldmapProperties) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *FieldmapProperties) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *FieldmapProperties) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *FieldmapProperties) HasType() bool` + +HasType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/FieldmapPropertiesPropertiesValue.md b/generated/alerting/docs/FieldmapPropertiesPropertiesValue.md new file mode 100644 index 000000000..3c18fbb00 --- /dev/null +++ b/generated/alerting/docs/FieldmapPropertiesPropertiesValue.md @@ -0,0 +1,56 @@ +# FieldmapPropertiesPropertiesValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type** | Pointer to **string** | The data type for each object property. | [optional] + +## Methods + +### NewFieldmapPropertiesPropertiesValue + +`func NewFieldmapPropertiesPropertiesValue() *FieldmapPropertiesPropertiesValue` + +NewFieldmapPropertiesPropertiesValue instantiates a new FieldmapPropertiesPropertiesValue object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFieldmapPropertiesPropertiesValueWithDefaults + +`func NewFieldmapPropertiesPropertiesValueWithDefaults() *FieldmapPropertiesPropertiesValue` + +NewFieldmapPropertiesPropertiesValueWithDefaults instantiates a new FieldmapPropertiesPropertiesValue object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetType + +`func (o *FieldmapPropertiesPropertiesValue) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *FieldmapPropertiesPropertiesValue) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *FieldmapPropertiesPropertiesValue) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *FieldmapPropertiesPropertiesValue) HasType() bool` + +HasType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/Filter.md b/generated/alerting/docs/Filter.md new file mode 100644 index 000000000..0d7f7c326 --- /dev/null +++ b/generated/alerting/docs/Filter.md @@ -0,0 +1,108 @@ +# Filter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Meta** | Pointer to [**FilterMeta**](FilterMeta.md) | | [optional] +**Query** | Pointer to **map[string]interface{}** | | [optional] +**State** | Pointer to **map[string]interface{}** | | [optional] + +## Methods + +### NewFilter + +`func NewFilter() *Filter` + +NewFilter instantiates a new Filter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFilterWithDefaults + +`func NewFilterWithDefaults() *Filter` + +NewFilterWithDefaults instantiates a new Filter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMeta + +`func (o *Filter) GetMeta() FilterMeta` + +GetMeta returns the Meta field if non-nil, zero value otherwise. + +### GetMetaOk + +`func (o *Filter) GetMetaOk() (*FilterMeta, bool)` + +GetMetaOk returns a tuple with the Meta field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMeta + +`func (o *Filter) SetMeta(v FilterMeta)` + +SetMeta sets Meta field to given value. + +### HasMeta + +`func (o *Filter) HasMeta() bool` + +HasMeta returns a boolean if a field has been set. + +### GetQuery + +`func (o *Filter) GetQuery() map[string]interface{}` + +GetQuery returns the Query field if non-nil, zero value otherwise. + +### GetQueryOk + +`func (o *Filter) GetQueryOk() (*map[string]interface{}, bool)` + +GetQueryOk returns a tuple with the Query field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetQuery + +`func (o *Filter) SetQuery(v map[string]interface{})` + +SetQuery sets Query field to given value. + +### HasQuery + +`func (o *Filter) HasQuery() bool` + +HasQuery returns a boolean if a field has been set. + +### GetState + +`func (o *Filter) GetState() map[string]interface{}` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *Filter) GetStateOk() (*map[string]interface{}, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *Filter) SetState(v map[string]interface{})` + +SetState sets State field to given value. + +### HasState + +`func (o *Filter) HasState() bool` + +HasState returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/FilterMeta.md b/generated/alerting/docs/FilterMeta.md new file mode 100644 index 000000000..d6dc10a0b --- /dev/null +++ b/generated/alerting/docs/FilterMeta.md @@ -0,0 +1,352 @@ +# FilterMeta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Alias** | Pointer to **NullableString** | | [optional] +**ControlledBy** | Pointer to **string** | | [optional] +**Disabled** | Pointer to **bool** | | [optional] +**Field** | Pointer to **string** | | [optional] +**Group** | Pointer to **string** | | [optional] +**Index** | Pointer to **string** | | [optional] +**IsMultiIndex** | Pointer to **bool** | | [optional] +**Key** | Pointer to **string** | | [optional] +**Negate** | Pointer to **bool** | | [optional] +**Params** | Pointer to **map[string]interface{}** | | [optional] +**Type** | Pointer to **string** | | [optional] +**Value** | Pointer to **string** | | [optional] + +## Methods + +### NewFilterMeta + +`func NewFilterMeta() *FilterMeta` + +NewFilterMeta instantiates a new FilterMeta object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFilterMetaWithDefaults + +`func NewFilterMetaWithDefaults() *FilterMeta` + +NewFilterMetaWithDefaults instantiates a new FilterMeta object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAlias + +`func (o *FilterMeta) GetAlias() string` + +GetAlias returns the Alias field if non-nil, zero value otherwise. + +### GetAliasOk + +`func (o *FilterMeta) GetAliasOk() (*string, bool)` + +GetAliasOk returns a tuple with the Alias field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlias + +`func (o *FilterMeta) SetAlias(v string)` + +SetAlias sets Alias field to given value. + +### HasAlias + +`func (o *FilterMeta) HasAlias() bool` + +HasAlias returns a boolean if a field has been set. + +### SetAliasNil + +`func (o *FilterMeta) SetAliasNil(b bool)` + + SetAliasNil sets the value for Alias to be an explicit nil + +### UnsetAlias +`func (o *FilterMeta) UnsetAlias()` + +UnsetAlias ensures that no value is present for Alias, not even an explicit nil +### GetControlledBy + +`func (o *FilterMeta) GetControlledBy() string` + +GetControlledBy returns the ControlledBy field if non-nil, zero value otherwise. + +### GetControlledByOk + +`func (o *FilterMeta) GetControlledByOk() (*string, bool)` + +GetControlledByOk returns a tuple with the ControlledBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetControlledBy + +`func (o *FilterMeta) SetControlledBy(v string)` + +SetControlledBy sets ControlledBy field to given value. + +### HasControlledBy + +`func (o *FilterMeta) HasControlledBy() bool` + +HasControlledBy returns a boolean if a field has been set. + +### GetDisabled + +`func (o *FilterMeta) GetDisabled() bool` + +GetDisabled returns the Disabled field if non-nil, zero value otherwise. + +### GetDisabledOk + +`func (o *FilterMeta) GetDisabledOk() (*bool, bool)` + +GetDisabledOk returns a tuple with the Disabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDisabled + +`func (o *FilterMeta) SetDisabled(v bool)` + +SetDisabled sets Disabled field to given value. + +### HasDisabled + +`func (o *FilterMeta) HasDisabled() bool` + +HasDisabled returns a boolean if a field has been set. + +### GetField + +`func (o *FilterMeta) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *FilterMeta) GetFieldOk() (*string, bool)` + +GetFieldOk returns a tuple with the Field field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetField + +`func (o *FilterMeta) SetField(v string)` + +SetField sets Field field to given value. + +### HasField + +`func (o *FilterMeta) HasField() bool` + +HasField returns a boolean if a field has been set. + +### GetGroup + +`func (o *FilterMeta) GetGroup() string` + +GetGroup returns the Group field if non-nil, zero value otherwise. + +### GetGroupOk + +`func (o *FilterMeta) GetGroupOk() (*string, bool)` + +GetGroupOk returns a tuple with the Group field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroup + +`func (o *FilterMeta) SetGroup(v string)` + +SetGroup sets Group field to given value. + +### HasGroup + +`func (o *FilterMeta) HasGroup() bool` + +HasGroup returns a boolean if a field has been set. + +### GetIndex + +`func (o *FilterMeta) GetIndex() string` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *FilterMeta) GetIndexOk() (*string, bool)` + +GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndex + +`func (o *FilterMeta) SetIndex(v string)` + +SetIndex sets Index field to given value. + +### HasIndex + +`func (o *FilterMeta) HasIndex() bool` + +HasIndex returns a boolean if a field has been set. + +### GetIsMultiIndex + +`func (o *FilterMeta) GetIsMultiIndex() bool` + +GetIsMultiIndex returns the IsMultiIndex field if non-nil, zero value otherwise. + +### GetIsMultiIndexOk + +`func (o *FilterMeta) GetIsMultiIndexOk() (*bool, bool)` + +GetIsMultiIndexOk returns a tuple with the IsMultiIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsMultiIndex + +`func (o *FilterMeta) SetIsMultiIndex(v bool)` + +SetIsMultiIndex sets IsMultiIndex field to given value. + +### HasIsMultiIndex + +`func (o *FilterMeta) HasIsMultiIndex() bool` + +HasIsMultiIndex returns a boolean if a field has been set. + +### GetKey + +`func (o *FilterMeta) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *FilterMeta) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *FilterMeta) SetKey(v string)` + +SetKey sets Key field to given value. + +### HasKey + +`func (o *FilterMeta) HasKey() bool` + +HasKey returns a boolean if a field has been set. + +### GetNegate + +`func (o *FilterMeta) GetNegate() bool` + +GetNegate returns the Negate field if non-nil, zero value otherwise. + +### GetNegateOk + +`func (o *FilterMeta) GetNegateOk() (*bool, bool)` + +GetNegateOk returns a tuple with the Negate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNegate + +`func (o *FilterMeta) SetNegate(v bool)` + +SetNegate sets Negate field to given value. + +### HasNegate + +`func (o *FilterMeta) HasNegate() bool` + +HasNegate returns a boolean if a field has been set. + +### GetParams + +`func (o *FilterMeta) GetParams() map[string]interface{}` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *FilterMeta) GetParamsOk() (*map[string]interface{}, bool)` + +GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParams + +`func (o *FilterMeta) SetParams(v map[string]interface{})` + +SetParams sets Params field to given value. + +### HasParams + +`func (o *FilterMeta) HasParams() bool` + +HasParams returns a boolean if a field has been set. + +### GetType + +`func (o *FilterMeta) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *FilterMeta) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *FilterMeta) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *FilterMeta) HasType() bool` + +HasType returns a boolean if a field has been set. + +### GetValue + +`func (o *FilterMeta) GetValue() string` + +GetValue returns the Value field if non-nil, zero value otherwise. + +### GetValueOk + +`func (o *FilterMeta) GetValueOk() (*string, bool)` + +GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValue + +`func (o *FilterMeta) SetValue(v string)` + +SetValue sets Value field to given value. + +### HasValue + +`func (o *FilterMeta) HasValue() bool` + +HasValue returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/FindRulesHasReferenceParameter.md b/generated/alerting/docs/FindRulesHasReferenceParameter.md index ab8543458..b16abea81 100644 --- a/generated/alerting/docs/FindRulesHasReferenceParameter.md +++ b/generated/alerting/docs/FindRulesHasReferenceParameter.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Type** | Pointer to **string** | | [optional] +**Id** | Pointer to **NullableString** | | [optional] +**Type** | Pointer to **NullableString** | | [optional] ## Methods @@ -51,6 +51,16 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. +### SetIdNil + +`func (o *FindRulesHasReferenceParameter) SetIdNil(b bool)` + + SetIdNil sets the value for Id to be an explicit nil + +### UnsetId +`func (o *FindRulesHasReferenceParameter) UnsetId()` + +UnsetId ensures that no value is present for Id, not even an explicit nil ### GetType `func (o *FindRulesHasReferenceParameter) GetType() string` @@ -76,6 +86,16 @@ SetType sets Type field to given value. HasType returns a boolean if a field has been set. +### SetTypeNil + +`func (o *FindRulesHasReferenceParameter) SetTypeNil(b bool)` + + SetTypeNil sets the value for Type to be an explicit nil + +### UnsetType +`func (o *FindRulesHasReferenceParameter) UnsetType()` + +UnsetType ensures that no value is present for Type, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/GetAlertingHealth200Response.md b/generated/alerting/docs/GetAlertingHealth200Response.md index 8d00bc93e..fe959d1c0 100644 --- a/generated/alerting/docs/GetAlertingHealth200Response.md +++ b/generated/alerting/docs/GetAlertingHealth200Response.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**AlertingFrameworkHeath** | Pointer to [**GetAlertingHealth200ResponseAlertingFrameworkHeath**](GetAlertingHealth200ResponseAlertingFrameworkHeath.md) | | [optional] **AlertingFrameworkHealth** | Pointer to [**GetAlertingHealth200ResponseAlertingFrameworkHealth**](GetAlertingHealth200ResponseAlertingFrameworkHealth.md) | | [optional] **HasPermanentEncryptionKey** | Pointer to **bool** | If `false`, the encrypted saved object plugin does not have a permanent encryption key. | [optional] **IsSufficientlySecure** | Pointer to **bool** | If `false`, security is enabled but TLS is not. | [optional] @@ -28,31 +27,6 @@ NewGetAlertingHealth200ResponseWithDefaults instantiates a new GetAlertingHealth This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set -### GetAlertingFrameworkHeath - -`func (o *GetAlertingHealth200Response) GetAlertingFrameworkHeath() GetAlertingHealth200ResponseAlertingFrameworkHeath` - -GetAlertingFrameworkHeath returns the AlertingFrameworkHeath field if non-nil, zero value otherwise. - -### GetAlertingFrameworkHeathOk - -`func (o *GetAlertingHealth200Response) GetAlertingFrameworkHeathOk() (*GetAlertingHealth200ResponseAlertingFrameworkHeath, bool)` - -GetAlertingFrameworkHeathOk returns a tuple with the AlertingFrameworkHeath field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetAlertingFrameworkHeath - -`func (o *GetAlertingHealth200Response) SetAlertingFrameworkHeath(v GetAlertingHealth200ResponseAlertingFrameworkHeath)` - -SetAlertingFrameworkHeath sets AlertingFrameworkHeath field to given value. - -### HasAlertingFrameworkHeath - -`func (o *GetAlertingHealth200Response) HasAlertingFrameworkHeath() bool` - -HasAlertingFrameworkHeath returns a boolean if a field has been set. - ### GetAlertingFrameworkHealth `func (o *GetAlertingHealth200Response) GetAlertingFrameworkHealth() GetAlertingHealth200ResponseAlertingFrameworkHealth` diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInner.md b/generated/alerting/docs/GetRuleTypes200ResponseInner.md index 2c2eefdd6..9d5e42e0d 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInner.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInner.md @@ -4,12 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ActionGroups** | Pointer to [**[]GetRuleTypes200ResponseInnerActionGroupsInner**](GetRuleTypes200ResponseInnerActionGroupsInner.md) | An explicit list of groups for which the rule type can schedule actions, each with the action group's unique ID and human readable name. Rule actions validation uses this configuration to ensure that groups are valid. | [optional] +**ActionGroups** | Pointer to [**[]GetRuleTypes200ResponseInnerActionGroupsInner**](GetRuleTypes200ResponseInnerActionGroupsInner.md) | | [optional] **ActionVariables** | Pointer to [**GetRuleTypes200ResponseInnerActionVariables**](GetRuleTypes200ResponseInnerActionVariables.md) | | [optional] +**Alerts** | Pointer to [**GetRuleTypes200ResponseInnerAlerts**](GetRuleTypes200ResponseInnerAlerts.md) | | [optional] **AuthorizedConsumers** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumers**](GetRuleTypes200ResponseInnerAuthorizedConsumers.md) | | [optional] +**Category** | Pointer to **string** | The rule category, which is used by features such as category-specific maintenance windows. | [optional] **DefaultActionGroupId** | Pointer to **string** | The default identifier for the rule type group. | [optional] **DoesSetRecoveryContext** | Pointer to **bool** | Indicates whether the rule passes context variables to its recovery action. | [optional] **EnabledInLicense** | Pointer to **bool** | Indicates whether the rule type is enabled or disabled based on the subscription. | [optional] +**HasAlertsMappings** | Pointer to **bool** | Indicates whether the rule type has custom mappings for the alert data. | [optional] +**HasFieldsForAAD** | Pointer to **bool** | | [optional] **Id** | Pointer to **string** | The unique identifier for the rule type. | [optional] **IsExportable** | Pointer to **bool** | Indicates whether the rule type is exportable in **Stack Management > Saved Objects**. | [optional] **MinimumLicenseRequired** | Pointer to **string** | The subscriptions required to use the rule type. | [optional] @@ -87,6 +91,31 @@ SetActionVariables sets ActionVariables field to given value. HasActionVariables returns a boolean if a field has been set. +### GetAlerts + +`func (o *GetRuleTypes200ResponseInner) GetAlerts() GetRuleTypes200ResponseInnerAlerts` + +GetAlerts returns the Alerts field if non-nil, zero value otherwise. + +### GetAlertsOk + +`func (o *GetRuleTypes200ResponseInner) GetAlertsOk() (*GetRuleTypes200ResponseInnerAlerts, bool)` + +GetAlertsOk returns a tuple with the Alerts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlerts + +`func (o *GetRuleTypes200ResponseInner) SetAlerts(v GetRuleTypes200ResponseInnerAlerts)` + +SetAlerts sets Alerts field to given value. + +### HasAlerts + +`func (o *GetRuleTypes200ResponseInner) HasAlerts() bool` + +HasAlerts returns a boolean if a field has been set. + ### GetAuthorizedConsumers `func (o *GetRuleTypes200ResponseInner) GetAuthorizedConsumers() GetRuleTypes200ResponseInnerAuthorizedConsumers` @@ -112,6 +141,31 @@ SetAuthorizedConsumers sets AuthorizedConsumers field to given value. HasAuthorizedConsumers returns a boolean if a field has been set. +### GetCategory + +`func (o *GetRuleTypes200ResponseInner) GetCategory() string` + +GetCategory returns the Category field if non-nil, zero value otherwise. + +### GetCategoryOk + +`func (o *GetRuleTypes200ResponseInner) GetCategoryOk() (*string, bool)` + +GetCategoryOk returns a tuple with the Category field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCategory + +`func (o *GetRuleTypes200ResponseInner) SetCategory(v string)` + +SetCategory sets Category field to given value. + +### HasCategory + +`func (o *GetRuleTypes200ResponseInner) HasCategory() bool` + +HasCategory returns a boolean if a field has been set. + ### GetDefaultActionGroupId `func (o *GetRuleTypes200ResponseInner) GetDefaultActionGroupId() string` @@ -187,6 +241,56 @@ SetEnabledInLicense sets EnabledInLicense field to given value. HasEnabledInLicense returns a boolean if a field has been set. +### GetHasAlertsMappings + +`func (o *GetRuleTypes200ResponseInner) GetHasAlertsMappings() bool` + +GetHasAlertsMappings returns the HasAlertsMappings field if non-nil, zero value otherwise. + +### GetHasAlertsMappingsOk + +`func (o *GetRuleTypes200ResponseInner) GetHasAlertsMappingsOk() (*bool, bool)` + +GetHasAlertsMappingsOk returns a tuple with the HasAlertsMappings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasAlertsMappings + +`func (o *GetRuleTypes200ResponseInner) SetHasAlertsMappings(v bool)` + +SetHasAlertsMappings sets HasAlertsMappings field to given value. + +### HasHasAlertsMappings + +`func (o *GetRuleTypes200ResponseInner) HasHasAlertsMappings() bool` + +HasHasAlertsMappings returns a boolean if a field has been set. + +### GetHasFieldsForAAD + +`func (o *GetRuleTypes200ResponseInner) GetHasFieldsForAAD() bool` + +GetHasFieldsForAAD returns the HasFieldsForAAD field if non-nil, zero value otherwise. + +### GetHasFieldsForAADOk + +`func (o *GetRuleTypes200ResponseInner) GetHasFieldsForAADOk() (*bool, bool)` + +GetHasFieldsForAADOk returns a tuple with the HasFieldsForAAD field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasFieldsForAAD + +`func (o *GetRuleTypes200ResponseInner) SetHasFieldsForAAD(v bool)` + +SetHasFieldsForAAD sets HasFieldsForAAD field to given value. + +### HasHasFieldsForAAD + +`func (o *GetRuleTypes200ResponseInner) HasHasFieldsForAAD() bool` + +HasHasFieldsForAAD returns a boolean if a field has been set. + ### GetId `func (o *GetRuleTypes200ResponseInner) GetId() string` diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionGroupsInner.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionGroupsInner.md index 124925b72..58e518e5c 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionGroupsInner.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionGroupsInner.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] +**Id** | Pointer to **NullableString** | | [optional] +**Name** | Pointer to **NullableString** | | [optional] ## Methods @@ -51,6 +51,16 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. +### SetIdNil + +`func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetIdNil(b bool)` + + SetIdNil sets the value for Id to be an explicit nil + +### UnsetId +`func (o *GetRuleTypes200ResponseInnerActionGroupsInner) UnsetId()` + +UnsetId ensures that no value is present for Id, not even an explicit nil ### GetName `func (o *GetRuleTypes200ResponseInnerActionGroupsInner) GetName() string` @@ -76,6 +86,16 @@ SetName sets Name field to given value. HasName returns a boolean if a field has been set. +### SetNameNil + +`func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *GetRuleTypes200ResponseInnerActionGroupsInner) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariables.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariables.md index 3e615305e..1313e8743 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariables.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariables.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Context** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesContextInner**](GetRuleTypes200ResponseInnerActionVariablesContextInner.md) | | [optional] **Params** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesParamsInner**](GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) | | [optional] -**State** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesParamsInner**](GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) | | [optional] +**State** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesStateInner**](GetRuleTypes200ResponseInnerActionVariablesStateInner.md) | | [optional] ## Methods @@ -79,20 +79,20 @@ HasParams returns a boolean if a field has been set. ### GetState -`func (o *GetRuleTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesParamsInner` +`func (o *GetRuleTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesStateInner` GetState returns the State field if non-nil, zero value otherwise. ### GetStateOk -`func (o *GetRuleTypes200ResponseInnerActionVariables) GetStateOk() (*[]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool)` +`func (o *GetRuleTypes200ResponseInnerActionVariables) GetStateOk() (*[]GetRuleTypes200ResponseInnerActionVariablesStateInner, bool)` GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetState -`func (o *GetRuleTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner)` +`func (o *GetRuleTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesStateInner)` SetState sets State field to given value. diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md index 077082ff4..78de23870 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesContextInner.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | Pointer to **string** | | [optional] -**Description** | Pointer to **string** | | [optional] +**Name** | Pointer to **NullableString** | | [optional] +**Description** | Pointer to **NullableString** | | [optional] **UseWithTripleBracesInTemplates** | Pointer to **bool** | | [optional] ## Methods @@ -52,6 +52,16 @@ SetName sets Name field to given value. HasName returns a boolean if a field has been set. +### SetNameNil + +`func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil ### GetDescription `func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetDescription() string` @@ -77,6 +87,16 @@ SetDescription sets Description field to given value. HasDescription returns a boolean if a field has been set. +### SetDescriptionNil + +`func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetDescriptionNil(b bool)` + + SetDescriptionNil sets the value for Description to be an explicit nil + +### UnsetDescription +`func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) UnsetDescription()` + +UnsetDescription ensures that no value is present for Description, not even an explicit nil ### GetUseWithTripleBracesInTemplates `func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetUseWithTripleBracesInTemplates() bool` diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md index 0997fd56c..cedbaaa81 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesParamsInner.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Description** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] +**Description** | Pointer to **NullableString** | | [optional] +**Name** | Pointer to **NullableString** | | [optional] ## Methods @@ -51,6 +51,16 @@ SetDescription sets Description field to given value. HasDescription returns a boolean if a field has been set. +### SetDescriptionNil + +`func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetDescriptionNil(b bool)` + + SetDescriptionNil sets the value for Description to be an explicit nil + +### UnsetDescription +`func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) UnsetDescription()` + +UnsetDescription ensures that no value is present for Description, not even an explicit nil ### GetName `func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) GetName() string` @@ -76,6 +86,16 @@ SetName sets Name field to given value. HasName returns a boolean if a field has been set. +### SetNameNil + +`func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md new file mode 100644 index 000000000..063c10077 --- /dev/null +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerActionVariablesStateInner.md @@ -0,0 +1,82 @@ +# GetRuleTypes200ResponseInnerActionVariablesStateInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | Pointer to **string** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewGetRuleTypes200ResponseInnerActionVariablesStateInner + +`func NewGetRuleTypes200ResponseInnerActionVariablesStateInner() *GetRuleTypes200ResponseInnerActionVariablesStateInner` + +NewGetRuleTypes200ResponseInnerActionVariablesStateInner instantiates a new GetRuleTypes200ResponseInnerActionVariablesStateInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetRuleTypes200ResponseInnerActionVariablesStateInnerWithDefaults + +`func NewGetRuleTypes200ResponseInnerActionVariablesStateInnerWithDefaults() *GetRuleTypes200ResponseInnerActionVariablesStateInner` + +NewGetRuleTypes200ResponseInnerActionVariablesStateInnerWithDefaults instantiates a new GetRuleTypes200ResponseInnerActionVariablesStateInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDescription + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) SetDescription(v string)` + +SetDescription sets Description field to given value. + +### HasDescription + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) HasDescription() bool` + +HasDescription returns a boolean if a field has been set. + +### GetName + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerAlerts.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerAlerts.md new file mode 100644 index 000000000..09848dfa3 --- /dev/null +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerAlerts.md @@ -0,0 +1,238 @@ +# GetRuleTypes200ResponseInnerAlerts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Context** | Pointer to **string** | The namespace for this rule type. | [optional] +**Dynamic** | Pointer to **string** | Indicates whether new fields are added dynamically. | [optional] +**IsSpaceAware** | Pointer to **bool** | Indicates whether the alerts are space-aware. If true, space-specific alert indices are used. | [optional] +**Mappings** | Pointer to [**GetRuleTypes200ResponseInnerAlertsMappings**](GetRuleTypes200ResponseInnerAlertsMappings.md) | | [optional] +**SecondaryAlias** | Pointer to **string** | A secondary alias. It is typically used to support the signals alias for detection rules. | [optional] +**ShouldWrite** | Pointer to **bool** | Indicates whether the rule should write out alerts as data. | [optional] +**UseEcs** | Pointer to **bool** | Indicates whether to include the ECS component template for the alerts. | [optional] +**UseLegacyAlerts** | Pointer to **bool** | Indicates whether to include the legacy component template for the alerts. | [optional] [default to false] + +## Methods + +### NewGetRuleTypes200ResponseInnerAlerts + +`func NewGetRuleTypes200ResponseInnerAlerts() *GetRuleTypes200ResponseInnerAlerts` + +NewGetRuleTypes200ResponseInnerAlerts instantiates a new GetRuleTypes200ResponseInnerAlerts object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetRuleTypes200ResponseInnerAlertsWithDefaults + +`func NewGetRuleTypes200ResponseInnerAlertsWithDefaults() *GetRuleTypes200ResponseInnerAlerts` + +NewGetRuleTypes200ResponseInnerAlertsWithDefaults instantiates a new GetRuleTypes200ResponseInnerAlerts object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetContext + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetContext() string` + +GetContext returns the Context field if non-nil, zero value otherwise. + +### GetContextOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetContextOk() (*string, bool)` + +GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContext + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetContext(v string)` + +SetContext sets Context field to given value. + +### HasContext + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasContext() bool` + +HasContext returns a boolean if a field has been set. + +### GetDynamic + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetDynamic() string` + +GetDynamic returns the Dynamic field if non-nil, zero value otherwise. + +### GetDynamicOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetDynamicOk() (*string, bool)` + +GetDynamicOk returns a tuple with the Dynamic field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDynamic + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetDynamic(v string)` + +SetDynamic sets Dynamic field to given value. + +### HasDynamic + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasDynamic() bool` + +HasDynamic returns a boolean if a field has been set. + +### GetIsSpaceAware + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetIsSpaceAware() bool` + +GetIsSpaceAware returns the IsSpaceAware field if non-nil, zero value otherwise. + +### GetIsSpaceAwareOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetIsSpaceAwareOk() (*bool, bool)` + +GetIsSpaceAwareOk returns a tuple with the IsSpaceAware field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsSpaceAware + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetIsSpaceAware(v bool)` + +SetIsSpaceAware sets IsSpaceAware field to given value. + +### HasIsSpaceAware + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasIsSpaceAware() bool` + +HasIsSpaceAware returns a boolean if a field has been set. + +### GetMappings + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetMappings() GetRuleTypes200ResponseInnerAlertsMappings` + +GetMappings returns the Mappings field if non-nil, zero value otherwise. + +### GetMappingsOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetMappingsOk() (*GetRuleTypes200ResponseInnerAlertsMappings, bool)` + +GetMappingsOk returns a tuple with the Mappings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMappings + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetMappings(v GetRuleTypes200ResponseInnerAlertsMappings)` + +SetMappings sets Mappings field to given value. + +### HasMappings + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasMappings() bool` + +HasMappings returns a boolean if a field has been set. + +### GetSecondaryAlias + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetSecondaryAlias() string` + +GetSecondaryAlias returns the SecondaryAlias field if non-nil, zero value otherwise. + +### GetSecondaryAliasOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetSecondaryAliasOk() (*string, bool)` + +GetSecondaryAliasOk returns a tuple with the SecondaryAlias field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSecondaryAlias + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetSecondaryAlias(v string)` + +SetSecondaryAlias sets SecondaryAlias field to given value. + +### HasSecondaryAlias + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasSecondaryAlias() bool` + +HasSecondaryAlias returns a boolean if a field has been set. + +### GetShouldWrite + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetShouldWrite() bool` + +GetShouldWrite returns the ShouldWrite field if non-nil, zero value otherwise. + +### GetShouldWriteOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetShouldWriteOk() (*bool, bool)` + +GetShouldWriteOk returns a tuple with the ShouldWrite field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetShouldWrite + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetShouldWrite(v bool)` + +SetShouldWrite sets ShouldWrite field to given value. + +### HasShouldWrite + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasShouldWrite() bool` + +HasShouldWrite returns a boolean if a field has been set. + +### GetUseEcs + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetUseEcs() bool` + +GetUseEcs returns the UseEcs field if non-nil, zero value otherwise. + +### GetUseEcsOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetUseEcsOk() (*bool, bool)` + +GetUseEcsOk returns a tuple with the UseEcs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUseEcs + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetUseEcs(v bool)` + +SetUseEcs sets UseEcs field to given value. + +### HasUseEcs + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasUseEcs() bool` + +HasUseEcs returns a boolean if a field has been set. + +### GetUseLegacyAlerts + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetUseLegacyAlerts() bool` + +GetUseLegacyAlerts returns the UseLegacyAlerts field if non-nil, zero value otherwise. + +### GetUseLegacyAlertsOk + +`func (o *GetRuleTypes200ResponseInnerAlerts) GetUseLegacyAlertsOk() (*bool, bool)` + +GetUseLegacyAlertsOk returns a tuple with the UseLegacyAlerts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUseLegacyAlerts + +`func (o *GetRuleTypes200ResponseInnerAlerts) SetUseLegacyAlerts(v bool)` + +SetUseLegacyAlerts sets UseLegacyAlerts field to given value. + +### HasUseLegacyAlerts + +`func (o *GetRuleTypes200ResponseInnerAlerts) HasUseLegacyAlerts() bool` + +HasUseLegacyAlerts returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerAlertsMappings.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerAlertsMappings.md new file mode 100644 index 000000000..57c147545 --- /dev/null +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerAlertsMappings.md @@ -0,0 +1,66 @@ +# GetRuleTypes200ResponseInnerAlertsMappings + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**FieldMap** | Pointer to | Mapping information for each field supported in alerts as data documents for this rule type. For more information about mapping parameters, refer to the Elasticsearch documentation. | [optional] + +## Methods + +### NewGetRuleTypes200ResponseInnerAlertsMappings + +`func NewGetRuleTypes200ResponseInnerAlertsMappings() *GetRuleTypes200ResponseInnerAlertsMappings` + +NewGetRuleTypes200ResponseInnerAlertsMappings instantiates a new GetRuleTypes200ResponseInnerAlertsMappings object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetRuleTypes200ResponseInnerAlertsMappingsWithDefaults + +`func NewGetRuleTypes200ResponseInnerAlertsMappingsWithDefaults() *GetRuleTypes200ResponseInnerAlertsMappings` + +NewGetRuleTypes200ResponseInnerAlertsMappingsWithDefaults instantiates a new GetRuleTypes200ResponseInnerAlertsMappings object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetFieldMap + +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) GetFieldMap() map[string]FieldmapProperties` + +GetFieldMap returns the FieldMap field if non-nil, zero value otherwise. + +### GetFieldMapOk + +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) GetFieldMapOk() (*map[string]FieldmapProperties, bool)` + +GetFieldMapOk returns a tuple with the FieldMap field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFieldMap + +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) SetFieldMap(v map[string]FieldmapProperties)` + +SetFieldMap sets FieldMap field to given value. + +### HasFieldMap + +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) HasFieldMap() bool` + +HasFieldMap returns a boolean if a field has been set. + +### SetFieldMapNil + +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) SetFieldMapNil(b bool)` + + SetFieldMapNil sets the value for FieldMap to be an explicit nil + +### UnsetFieldMap +`func (o *GetRuleTypes200ResponseInnerAlertsMappings) UnsetFieldMap()` + +UnsetFieldMap ensures that no value is present for FieldMap, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md index c50a2edab..fcacd3653 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerAuthorizedConsumers.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **Ml** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] **Monitoring** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] **Siem** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] +**Slo** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] **StackAlerts** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] **Uptime** | Pointer to [**GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts**](GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts.md) | | [optional] @@ -234,6 +235,31 @@ SetSiem sets Siem field to given value. HasSiem returns a boolean if a field has been set. +### GetSlo + +`func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetSlo() GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts` + +GetSlo returns the Slo field if non-nil, zero value otherwise. + +### GetSloOk + +`func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetSloOk() (*GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts, bool)` + +GetSloOk returns a tuple with the Slo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSlo + +`func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) SetSlo(v GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts)` + +SetSlo sets Slo field to given value. + +### HasSlo + +`func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) HasSlo() bool` + +HasSlo returns a boolean if a field has been set. + ### GetStackAlerts `func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetStackAlerts() GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts` diff --git a/generated/alerting/docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md b/generated/alerting/docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md index 25068aa0e..5ffe4fe59 100644 --- a/generated/alerting/docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md +++ b/generated/alerting/docs/GetRuleTypes200ResponseInnerRecoveryActionGroup.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] +**Id** | Pointer to **NullableString** | | [optional] +**Name** | Pointer to **NullableString** | | [optional] ## Methods @@ -51,6 +51,16 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. +### SetIdNil + +`func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetIdNil(b bool)` + + SetIdNil sets the value for Id to be an explicit nil + +### UnsetId +`func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) UnsetId()` + +UnsetId ensures that no value is present for Id, not even an explicit nil ### GetName `func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) GetName() string` @@ -76,6 +86,16 @@ SetName sets Name field to given value. HasName returns a boolean if a field has been set. +### SetNameNil + +`func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/LegacyCreateAlertRequestProperties.md b/generated/alerting/docs/LegacyCreateAlertRequestProperties.md index 03759dad0..e4da33723 100644 --- a/generated/alerting/docs/LegacyCreateAlertRequestProperties.md +++ b/generated/alerting/docs/LegacyCreateAlertRequestProperties.md @@ -11,15 +11,15 @@ Name | Type | Description | Notes **Name** | **string** | A name to reference and search. | **NotifyWhen** | **string** | The condition for throttling the notification. | **Params** | **map[string]interface{}** | The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. | -**Schedule** | [**LegacyCreateAlertRequestPropertiesSchedule**](LegacyCreateAlertRequestPropertiesSchedule.md) | | -**Tags** | Pointer to **[]string** | A list of keywords to reference and search. | [optional] +**Schedule** | [**LegacyUpdateAlertRequestPropertiesSchedule**](LegacyUpdateAlertRequestPropertiesSchedule.md) | | +**Tags** | Pointer to **[]string** | | [optional] **Throttle** | Pointer to **string** | How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. | [optional] ## Methods ### NewLegacyCreateAlertRequestProperties -`func NewLegacyCreateAlertRequestProperties(alertTypeId string, consumer string, name string, notifyWhen string, params map[string]interface{}, schedule LegacyCreateAlertRequestPropertiesSchedule, ) *LegacyCreateAlertRequestProperties` +`func NewLegacyCreateAlertRequestProperties(alertTypeId string, consumer string, name string, notifyWhen string, params map[string]interface{}, schedule LegacyUpdateAlertRequestPropertiesSchedule, ) *LegacyCreateAlertRequestProperties` NewLegacyCreateAlertRequestProperties instantiates a new LegacyCreateAlertRequestProperties object This constructor will assign default values to properties that have it defined, @@ -186,20 +186,20 @@ SetParams sets Params field to given value. ### GetSchedule -`func (o *LegacyCreateAlertRequestProperties) GetSchedule() LegacyCreateAlertRequestPropertiesSchedule` +`func (o *LegacyCreateAlertRequestProperties) GetSchedule() LegacyUpdateAlertRequestPropertiesSchedule` GetSchedule returns the Schedule field if non-nil, zero value otherwise. ### GetScheduleOk -`func (o *LegacyCreateAlertRequestProperties) GetScheduleOk() (*LegacyCreateAlertRequestPropertiesSchedule, bool)` +`func (o *LegacyCreateAlertRequestProperties) GetScheduleOk() (*LegacyUpdateAlertRequestPropertiesSchedule, bool)` GetScheduleOk returns a tuple with the Schedule field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSchedule -`func (o *LegacyCreateAlertRequestProperties) SetSchedule(v LegacyCreateAlertRequestPropertiesSchedule)` +`func (o *LegacyCreateAlertRequestProperties) SetSchedule(v LegacyUpdateAlertRequestPropertiesSchedule)` SetSchedule sets Schedule field to given value. diff --git a/generated/alerting/docs/LegacyFindAlertsHasReferenceParameter.md b/generated/alerting/docs/LegacyFindAlertsHasReferenceParameter.md new file mode 100644 index 000000000..8eca24399 --- /dev/null +++ b/generated/alerting/docs/LegacyFindAlertsHasReferenceParameter.md @@ -0,0 +1,82 @@ +# LegacyFindAlertsHasReferenceParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Type** | Pointer to **string** | | [optional] + +## Methods + +### NewLegacyFindAlertsHasReferenceParameter + +`func NewLegacyFindAlertsHasReferenceParameter() *LegacyFindAlertsHasReferenceParameter` + +NewLegacyFindAlertsHasReferenceParameter instantiates a new LegacyFindAlertsHasReferenceParameter object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewLegacyFindAlertsHasReferenceParameterWithDefaults + +`func NewLegacyFindAlertsHasReferenceParameterWithDefaults() *LegacyFindAlertsHasReferenceParameter` + +NewLegacyFindAlertsHasReferenceParameterWithDefaults instantiates a new LegacyFindAlertsHasReferenceParameter object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *LegacyFindAlertsHasReferenceParameter) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *LegacyFindAlertsHasReferenceParameter) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *LegacyFindAlertsHasReferenceParameter) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *LegacyFindAlertsHasReferenceParameter) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetType + +`func (o *LegacyFindAlertsHasReferenceParameter) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *LegacyFindAlertsHasReferenceParameter) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *LegacyFindAlertsHasReferenceParameter) SetType(v string)` + +SetType sets Type field to given value. + +### HasType + +`func (o *LegacyFindAlertsHasReferenceParameter) HasType() bool` + +HasType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInner.md b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInner.md index ca6616f35..1779036c6 100644 --- a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInner.md +++ b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInner.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ActionGroups** | Pointer to [**[]GetRuleTypes200ResponseInnerActionGroupsInner**](GetRuleTypes200ResponseInnerActionGroupsInner.md) | An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid. | [optional] +**ActionGroups** | Pointer to [**[]LegacyGetAlertTypes200ResponseInnerActionGroupsInner**](LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md) | | [optional] **ActionVariables** | Pointer to [**LegacyGetAlertTypes200ResponseInnerActionVariables**](LegacyGetAlertTypes200ResponseInnerActionVariables.md) | | [optional] **AuthorizedConsumers** | Pointer to **map[string]interface{}** | The list of the plugins IDs that have access to the alert type. | [optional] **DefaultActionGroupId** | Pointer to **string** | The default identifier for the alert type group. | [optional] @@ -37,20 +37,20 @@ but it doesn't guarantee that properties required by API are set ### GetActionGroups -`func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroups() []GetRuleTypes200ResponseInnerActionGroupsInner` +`func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroups() []LegacyGetAlertTypes200ResponseInnerActionGroupsInner` GetActionGroups returns the ActionGroups field if non-nil, zero value otherwise. ### GetActionGroupsOk -`func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroupsOk() (*[]GetRuleTypes200ResponseInnerActionGroupsInner, bool)` +`func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroupsOk() (*[]LegacyGetAlertTypes200ResponseInnerActionGroupsInner, bool)` GetActionGroupsOk returns a tuple with the ActionGroups field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetActionGroups -`func (o *LegacyGetAlertTypes200ResponseInner) SetActionGroups(v []GetRuleTypes200ResponseInnerActionGroupsInner)` +`func (o *LegacyGetAlertTypes200ResponseInner) SetActionGroups(v []LegacyGetAlertTypes200ResponseInnerActionGroupsInner)` SetActionGroups sets ActionGroups field to given value. diff --git a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md new file mode 100644 index 000000000..060a45798 --- /dev/null +++ b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionGroupsInner.md @@ -0,0 +1,82 @@ +# LegacyGetAlertTypes200ResponseInnerActionGroupsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewLegacyGetAlertTypes200ResponseInnerActionGroupsInner + +`func NewLegacyGetAlertTypes200ResponseInnerActionGroupsInner() *LegacyGetAlertTypes200ResponseInnerActionGroupsInner` + +NewLegacyGetAlertTypes200ResponseInnerActionGroupsInner instantiates a new LegacyGetAlertTypes200ResponseInnerActionGroupsInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewLegacyGetAlertTypes200ResponseInnerActionGroupsInnerWithDefaults + +`func NewLegacyGetAlertTypes200ResponseInnerActionGroupsInnerWithDefaults() *LegacyGetAlertTypes200ResponseInnerActionGroupsInner` + +NewLegacyGetAlertTypes200ResponseInnerActionGroupsInnerWithDefaults instantiates a new LegacyGetAlertTypes200ResponseInnerActionGroupsInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md index 2d0cd2311..17fe9c091 100644 --- a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md +++ b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerActionVariables.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Context** | Pointer to [**[]LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner**](LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner.md) | | [optional] -**Params** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesParamsInner**](GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) | | [optional] -**State** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesParamsInner**](GetRuleTypes200ResponseInnerActionVariablesParamsInner.md) | | [optional] +**Context** | Pointer to [**[]GetRuleTypes200ResponseInnerActionVariablesStateInner**](GetRuleTypes200ResponseInnerActionVariablesStateInner.md) | | [optional] +**Params** | Pointer to **interface{}** | | [optional] +**State** | Pointer to **interface{}** | | [optional] ## Methods @@ -29,20 +29,20 @@ but it doesn't guarantee that properties required by API are set ### GetContext -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContext() []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContext() []GetRuleTypes200ResponseInnerActionVariablesStateInner` GetContext returns the Context field if non-nil, zero value otherwise. ### GetContextOk -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContextOk() (*[]LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner, bool)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContextOk() (*[]GetRuleTypes200ResponseInnerActionVariablesStateInner, bool)` GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetContext -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetContext(v []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetContext(v []GetRuleTypes200ResponseInnerActionVariablesStateInner)` SetContext sets Context field to given value. @@ -54,20 +54,20 @@ HasContext returns a boolean if a field has been set. ### GetParams -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParams() []GetRuleTypes200ResponseInnerActionVariablesParamsInner` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParams() interface{}` GetParams returns the Params field if non-nil, zero value otherwise. ### GetParamsOk -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParamsOk() (*[]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParamsOk() (*interface{}, bool)` GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetParams -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetParams(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetParams(v interface{})` SetParams sets Params field to given value. @@ -77,22 +77,32 @@ SetParams sets Params field to given value. HasParams returns a boolean if a field has been set. +### SetParamsNil + +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetParamsNil(b bool)` + + SetParamsNil sets the value for Params to be an explicit nil + +### UnsetParams +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) UnsetParams()` + +UnsetParams ensures that no value is present for Params, not even an explicit nil ### GetState -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesParamsInner` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetState() interface{}` GetState returns the State field if non-nil, zero value otherwise. ### GetStateOk -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetStateOk() (*[]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetStateOk() (*interface{}, bool)` GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetState -`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner)` +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetState(v interface{})` SetState sets State field to given value. @@ -102,6 +112,16 @@ SetState sets State field to given value. HasState returns a boolean if a field has been set. +### SetStateNil + +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetStateNil(b bool)` + + SetStateNil sets the value for State to be an explicit nil + +### UnsetState +`func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) UnsetState()` + +UnsetState ensures that no value is present for State, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md index b7db23757..64c9a7b76 100644 --- a/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md +++ b/generated/alerting/docs/LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | | [optional] -**Name** | Pointer to **string** | | [optional] +**Id** | Pointer to **NullableString** | | [optional] +**Name** | Pointer to **NullableString** | | [optional] ## Methods @@ -51,6 +51,16 @@ SetId sets Id field to given value. HasId returns a boolean if a field has been set. +### SetIdNil + +`func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetIdNil(b bool)` + + SetIdNil sets the value for Id to be an explicit nil + +### UnsetId +`func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) UnsetId()` + +UnsetId ensures that no value is present for Id, not even an explicit nil ### GetName `func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) GetName() string` @@ -76,6 +86,16 @@ SetName sets Name field to given value. HasName returns a boolean if a field has been set. +### SetNameNil + +`func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetNameNil(b bool)` + + SetNameNil sets the value for Name to be an explicit nil + +### UnsetName +`func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) UnsetName()` + +UnsetName ensures that no value is present for Name, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/alerting/docs/LegacyUpdateAlertRequestProperties.md b/generated/alerting/docs/LegacyUpdateAlertRequestProperties.md index bfbd6833e..75ada43f7 100644 --- a/generated/alerting/docs/LegacyUpdateAlertRequestProperties.md +++ b/generated/alerting/docs/LegacyUpdateAlertRequestProperties.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **NotifyWhen** | **string** | The condition for throttling the notification. | **Params** | **map[string]interface{}** | The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. | **Schedule** | [**LegacyUpdateAlertRequestPropertiesSchedule**](LegacyUpdateAlertRequestPropertiesSchedule.md) | | -**Tags** | Pointer to **[]string** | A list of keywords to reference and search. | [optional] +**Tags** | Pointer to **[]string** | | [optional] **Throttle** | Pointer to **string** | How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. | [optional] ## Methods @@ -138,20 +138,20 @@ SetSchedule sets Schedule field to given value. ### GetTags -`func (o *LegacyUpdateAlertRequestProperties) GetTags() []string` +`func (o *LegacyUpdateAlertRequestProperties) GetTags() []*string` GetTags returns the Tags field if non-nil, zero value otherwise. ### GetTagsOk -`func (o *LegacyUpdateAlertRequestProperties) GetTagsOk() (*[]string, bool)` +`func (o *LegacyUpdateAlertRequestProperties) GetTagsOk() (*[]*string, bool)` GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTags -`func (o *LegacyUpdateAlertRequestProperties) SetTags(v []string)` +`func (o *LegacyUpdateAlertRequestProperties) SetTags(v []*string)` SetTags sets Tags field to given value. diff --git a/generated/alerting/docs/Model400Response.md b/generated/alerting/docs/Model400Response.md new file mode 100644 index 000000000..41202218a --- /dev/null +++ b/generated/alerting/docs/Model400Response.md @@ -0,0 +1,93 @@ +# Model400Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error** | **string** | | +**Message** | **string** | | +**StatusCode** | **int32** | | + +## Methods + +### NewModel400Response + +`func NewModel400Response(error_ string, message string, statusCode int32, ) *Model400Response` + +NewModel400Response instantiates a new Model400Response object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewModel400ResponseWithDefaults + +`func NewModel400ResponseWithDefaults() *Model400Response` + +NewModel400ResponseWithDefaults instantiates a new Model400Response object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetError + +`func (o *Model400Response) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *Model400Response) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *Model400Response) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMessage + +`func (o *Model400Response) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Model400Response) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Model400Response) SetMessage(v string)` + +SetMessage sets Message field to given value. + + +### GetStatusCode + +`func (o *Model400Response) GetStatusCode() int32` + +GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. + +### GetStatusCodeOk + +`func (o *Model400Response) GetStatusCodeOk() (*int32, bool)` + +GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusCode + +`func (o *Model400Response) SetStatusCode(v int32)` + +SetStatusCode sets StatusCode field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/NotifyWhenAction.md b/generated/alerting/docs/NotifyWhenAction.md new file mode 100644 index 000000000..d141ce652 --- /dev/null +++ b/generated/alerting/docs/NotifyWhenAction.md @@ -0,0 +1,15 @@ +# NotifyWhenAction + +## Enum + + +* `ON_ACTION_GROUP_CHANGE` (value: `"onActionGroupChange"`) + +* `ON_ACTIVE_ALERT` (value: `"onActiveAlert"`) + +* `ON_THROTTLE_INTERVAL` (value: `"onThrottleInterval"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/alerting/docs/RuleResponseProperties.md b/generated/alerting/docs/RuleResponseProperties.md index 757234a31..70cd6af57 100644 --- a/generated/alerting/docs/RuleResponseProperties.md +++ b/generated/alerting/docs/RuleResponseProperties.md @@ -4,8 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Actions** | [**[]ActionsInner**](ActionsInner.md) | | [default to []] -**ApiKeyOwner** | **NullableString** | | +**Actions** | [**[]ActionsInner**](ActionsInner.md) | | +**AlertDelay** | Pointer to [**AlertDelay**](AlertDelay.md) | | [optional] +**ApiKeyCreatedByUser** | Pointer to **bool** | Indicates whether the API key that is associated with the rule was created by the user. | [optional] +**ApiKeyOwner** | **NullableString** | The owner of the API key that is associated with the rule and used to run background tasks. | **Consumer** | **string** | The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. | **CreatedAt** | **time.Time** | The date and time that the rule was created. | **CreatedBy** | **NullableString** | The identifier for the user that created the rule. | @@ -17,14 +19,15 @@ Name | Type | Description | Notes **MuteAll** | **bool** | | **Name** | **string** | The name of the rule. | **NextRun** | Pointer to **NullableTime** | | [optional] -**NotifyWhen** | Pointer to [**NotifyWhen**](NotifyWhen.md) | | [optional] +**NotifyWhen** | Pointer to **NullableString** | Indicates how often alerts generate actions. | [optional] **Params** | **map[string]interface{}** | The parameters for the rule. | +**Revision** | Pointer to **int32** | The rule revision number. | [optional] **RuleTypeId** | **string** | The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. | **Running** | Pointer to **bool** | Indicates whether the rule is running. | [optional] **Schedule** | [**Schedule**](Schedule.md) | | **ScheduledTaskId** | Pointer to **string** | | [optional] -**Tags** | **[]string** | The tags for the rule. | [default to []] -**Throttle** | **NullableString** | The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. | +**Tags** | **[]string** | | +**Throttle** | **NullableString** | Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. | **UpdatedAt** | **string** | The date and time that the rule was updated most recently. | **UpdatedBy** | **NullableString** | The identifier for the user that updated this rule most recently. | @@ -67,16 +70,56 @@ and a boolean to check if the value has been set. SetActions sets Actions field to given value. -### SetActionsNil +### GetAlertDelay -`func (o *RuleResponseProperties) SetActionsNil(b bool)` +`func (o *RuleResponseProperties) GetAlertDelay() AlertDelay` - SetActionsNil sets the value for Actions to be an explicit nil +GetAlertDelay returns the AlertDelay field if non-nil, zero value otherwise. -### UnsetActions -`func (o *RuleResponseProperties) UnsetActions()` +### GetAlertDelayOk + +`func (o *RuleResponseProperties) GetAlertDelayOk() (*AlertDelay, bool)` + +GetAlertDelayOk returns a tuple with the AlertDelay field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlertDelay + +`func (o *RuleResponseProperties) SetAlertDelay(v AlertDelay)` + +SetAlertDelay sets AlertDelay field to given value. + +### HasAlertDelay + +`func (o *RuleResponseProperties) HasAlertDelay() bool` + +HasAlertDelay returns a boolean if a field has been set. + +### GetApiKeyCreatedByUser + +`func (o *RuleResponseProperties) GetApiKeyCreatedByUser() bool` + +GetApiKeyCreatedByUser returns the ApiKeyCreatedByUser field if non-nil, zero value otherwise. + +### GetApiKeyCreatedByUserOk + +`func (o *RuleResponseProperties) GetApiKeyCreatedByUserOk() (*bool, bool)` + +GetApiKeyCreatedByUserOk returns a tuple with the ApiKeyCreatedByUser field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetApiKeyCreatedByUser + +`func (o *RuleResponseProperties) SetApiKeyCreatedByUser(v bool)` + +SetApiKeyCreatedByUser sets ApiKeyCreatedByUser field to given value. + +### HasApiKeyCreatedByUser + +`func (o *RuleResponseProperties) HasApiKeyCreatedByUser() bool` + +HasApiKeyCreatedByUser returns a boolean if a field has been set. -UnsetActions ensures that no value is present for Actions, not even an explicit nil ### GetApiKeyOwner `func (o *RuleResponseProperties) GetApiKeyOwner() string` @@ -282,16 +325,6 @@ and a boolean to check if the value has been set. SetMutedAlertIds sets MutedAlertIds field to given value. -### SetMutedAlertIdsNil - -`func (o *RuleResponseProperties) SetMutedAlertIdsNil(b bool)` - - SetMutedAlertIdsNil sets the value for MutedAlertIds to be an explicit nil - -### UnsetMutedAlertIds -`func (o *RuleResponseProperties) UnsetMutedAlertIds()` - -UnsetMutedAlertIds ensures that no value is present for MutedAlertIds, not even an explicit nil ### GetMuteAll `func (o *RuleResponseProperties) GetMuteAll() bool` @@ -369,20 +402,20 @@ HasNextRun returns a boolean if a field has been set. UnsetNextRun ensures that no value is present for NextRun, not even an explicit nil ### GetNotifyWhen -`func (o *RuleResponseProperties) GetNotifyWhen() NotifyWhen` +`func (o *RuleResponseProperties) GetNotifyWhen() string` GetNotifyWhen returns the NotifyWhen field if non-nil, zero value otherwise. ### GetNotifyWhenOk -`func (o *RuleResponseProperties) GetNotifyWhenOk() (*NotifyWhen, bool)` +`func (o *RuleResponseProperties) GetNotifyWhenOk() (*string, bool)` GetNotifyWhenOk returns a tuple with the NotifyWhen field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNotifyWhen -`func (o *RuleResponseProperties) SetNotifyWhen(v NotifyWhen)` +`func (o *RuleResponseProperties) SetNotifyWhen(v string)` SetNotifyWhen sets NotifyWhen field to given value. @@ -392,6 +425,16 @@ SetNotifyWhen sets NotifyWhen field to given value. HasNotifyWhen returns a boolean if a field has been set. +### SetNotifyWhenNil + +`func (o *RuleResponseProperties) SetNotifyWhenNil(b bool)` + + SetNotifyWhenNil sets the value for NotifyWhen to be an explicit nil + +### UnsetNotifyWhen +`func (o *RuleResponseProperties) UnsetNotifyWhen()` + +UnsetNotifyWhen ensures that no value is present for NotifyWhen, not even an explicit nil ### GetParams `func (o *RuleResponseProperties) GetParams() map[string]interface{}` @@ -412,6 +455,31 @@ and a boolean to check if the value has been set. SetParams sets Params field to given value. +### GetRevision + +`func (o *RuleResponseProperties) GetRevision() int32` + +GetRevision returns the Revision field if non-nil, zero value otherwise. + +### GetRevisionOk + +`func (o *RuleResponseProperties) GetRevisionOk() (*int32, bool)` + +GetRevisionOk returns a tuple with the Revision field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRevision + +`func (o *RuleResponseProperties) SetRevision(v int32)` + +SetRevision sets Revision field to given value. + +### HasRevision + +`func (o *RuleResponseProperties) HasRevision() bool` + +HasRevision returns a boolean if a field has been set. + ### GetRuleTypeId `func (o *RuleResponseProperties) GetRuleTypeId() string` diff --git a/generated/alerting/docs/RuleResponsePropertiesLastRun.md b/generated/alerting/docs/RuleResponsePropertiesLastRun.md index 029c4cce7..4f0f637da 100644 --- a/generated/alerting/docs/RuleResponsePropertiesLastRun.md +++ b/generated/alerting/docs/RuleResponsePropertiesLastRun.md @@ -6,7 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AlertsCount** | Pointer to [**RuleResponsePropertiesLastRunAlertsCount**](RuleResponsePropertiesLastRunAlertsCount.md) | | [optional] **Outcome** | Pointer to **string** | | [optional] -**OutcomeMsg** | Pointer to **NullableString** | | [optional] +**OutcomeMsg** | Pointer to **[]string** | | [optional] +**OutcomeOrder** | Pointer to **int32** | | [optional] **Warning** | Pointer to **NullableString** | | [optional] ## Methods @@ -80,20 +81,20 @@ HasOutcome returns a boolean if a field has been set. ### GetOutcomeMsg -`func (o *RuleResponsePropertiesLastRun) GetOutcomeMsg() string` +`func (o *RuleResponsePropertiesLastRun) GetOutcomeMsg() []string` GetOutcomeMsg returns the OutcomeMsg field if non-nil, zero value otherwise. ### GetOutcomeMsgOk -`func (o *RuleResponsePropertiesLastRun) GetOutcomeMsgOk() (*string, bool)` +`func (o *RuleResponsePropertiesLastRun) GetOutcomeMsgOk() (*[]string, bool)` GetOutcomeMsgOk returns a tuple with the OutcomeMsg field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetOutcomeMsg -`func (o *RuleResponsePropertiesLastRun) SetOutcomeMsg(v string)` +`func (o *RuleResponsePropertiesLastRun) SetOutcomeMsg(v []string)` SetOutcomeMsg sets OutcomeMsg field to given value. @@ -103,16 +104,31 @@ SetOutcomeMsg sets OutcomeMsg field to given value. HasOutcomeMsg returns a boolean if a field has been set. -### SetOutcomeMsgNil +### GetOutcomeOrder -`func (o *RuleResponsePropertiesLastRun) SetOutcomeMsgNil(b bool)` +`func (o *RuleResponsePropertiesLastRun) GetOutcomeOrder() int32` - SetOutcomeMsgNil sets the value for OutcomeMsg to be an explicit nil +GetOutcomeOrder returns the OutcomeOrder field if non-nil, zero value otherwise. -### UnsetOutcomeMsg -`func (o *RuleResponsePropertiesLastRun) UnsetOutcomeMsg()` +### GetOutcomeOrderOk + +`func (o *RuleResponsePropertiesLastRun) GetOutcomeOrderOk() (*int32, bool)` + +GetOutcomeOrderOk returns a tuple with the OutcomeOrder field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutcomeOrder + +`func (o *RuleResponsePropertiesLastRun) SetOutcomeOrder(v int32)` + +SetOutcomeOrder sets OutcomeOrder field to given value. + +### HasOutcomeOrder + +`func (o *RuleResponsePropertiesLastRun) HasOutcomeOrder() bool` + +HasOutcomeOrder returns a boolean if a field has been set. -UnsetOutcomeMsg ensures that no value is present for OutcomeMsg, not even an explicit nil ### GetWarning `func (o *RuleResponsePropertiesLastRun) GetWarning() string` diff --git a/generated/alerting/docs/UpdateRuleRequest.md b/generated/alerting/docs/UpdateRuleRequest.md index ce0f42682..ccf40b3f3 100644 --- a/generated/alerting/docs/UpdateRuleRequest.md +++ b/generated/alerting/docs/UpdateRuleRequest.md @@ -4,13 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Actions** | Pointer to [**[]ActionsInner**](ActionsInner.md) | | [optional] [default to []] +**Actions** | Pointer to [**[]ActionsInner**](ActionsInner.md) | | [optional] +**AlertDelay** | Pointer to [**AlertDelay**](AlertDelay.md) | | [optional] **Name** | **string** | The name of the rule. | **NotifyWhen** | Pointer to [**NotifyWhen**](NotifyWhen.md) | | [optional] **Params** | **map[string]interface{}** | The parameters for the rule. | **Schedule** | [**Schedule**](Schedule.md) | | -**Tags** | Pointer to **[]string** | The tags for the rule. | [optional] [default to []] -**Throttle** | Pointer to **NullableString** | The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. | [optional] +**Tags** | Pointer to **[]string** | | [optional] +**Throttle** | Pointer to **NullableString** | Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. | [optional] ## Methods @@ -56,16 +57,31 @@ SetActions sets Actions field to given value. HasActions returns a boolean if a field has been set. -### SetActionsNil +### GetAlertDelay -`func (o *UpdateRuleRequest) SetActionsNil(b bool)` +`func (o *UpdateRuleRequest) GetAlertDelay() AlertDelay` - SetActionsNil sets the value for Actions to be an explicit nil +GetAlertDelay returns the AlertDelay field if non-nil, zero value otherwise. -### UnsetActions -`func (o *UpdateRuleRequest) UnsetActions()` +### GetAlertDelayOk + +`func (o *UpdateRuleRequest) GetAlertDelayOk() (*AlertDelay, bool)` + +GetAlertDelayOk returns a tuple with the AlertDelay field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAlertDelay + +`func (o *UpdateRuleRequest) SetAlertDelay(v AlertDelay)` + +SetAlertDelay sets AlertDelay field to given value. + +### HasAlertDelay + +`func (o *UpdateRuleRequest) HasAlertDelay() bool` + +HasAlertDelay returns a boolean if a field has been set. -UnsetActions ensures that no value is present for Actions, not even an explicit nil ### GetName `func (o *UpdateRuleRequest) GetName() string` diff --git a/generated/alerting/model_400_response.go b/generated/alerting/model_400_response.go new file mode 100644 index 000000000..b7050c1f8 --- /dev/null +++ b/generated/alerting/model_400_response.go @@ -0,0 +1,169 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the Model400Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model400Response{} + +// Model400Response struct for Model400Response +type Model400Response struct { + Error string `json:"error"` + Message string `json:"message"` + StatusCode int32 `json:"statusCode"` +} + +// NewModel400Response instantiates a new Model400Response object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModel400Response(error_ string, message string, statusCode int32) *Model400Response { + this := Model400Response{} + this.Error = error_ + this.Message = message + this.StatusCode = statusCode + return &this +} + +// NewModel400ResponseWithDefaults instantiates a new Model400Response object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModel400ResponseWithDefaults() *Model400Response { + this := Model400Response{} + return &this +} + +// GetError returns the Error field value +func (o *Model400Response) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *Model400Response) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *Model400Response) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Model400Response) SetMessage(v string) { + o.Message = v +} + +// GetStatusCode returns the StatusCode field value +func (o *Model400Response) GetStatusCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetStatusCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *Model400Response) SetStatusCode(v int32) { + o.StatusCode = v +} + +func (o Model400Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Model400Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + toSerialize["statusCode"] = o.StatusCode + return toSerialize, nil +} + +type NullableModel400Response struct { + value *Model400Response + isSet bool +} + +func (v NullableModel400Response) Get() *Model400Response { + return v.value +} + +func (v *NullableModel400Response) Set(val *Model400Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel400Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel400Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel400Response(val *Model400Response) *NullableModel400Response { + return &NullableModel400Response{value: val, isSet: true} +} + +func (v NullableModel400Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel400Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_401_response.go b/generated/alerting/model_401_response.go index 333e0bf27..c5c156507 100644 --- a/generated/alerting/model_401_response.go +++ b/generated/alerting/model_401_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_404_response.go b/generated/alerting/model_404_response.go index 17116ccf3..d7f845db5 100644 --- a/generated/alerting/model_404_response.go +++ b/generated/alerting/model_404_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_actions_inner.go b/generated/alerting/model_actions_inner.go index 38fdb9aef..abb7f93e9 100644 --- a/generated/alerting/model_actions_inner.go +++ b/generated/alerting/model_actions_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,25 +17,31 @@ import ( // checks if the ActionsInner type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ActionsInner{} -// ActionsInner struct for ActionsInner +// ActionsInner An action that runs under defined conditions. type ActionsInner struct { + AlertsFilter *ActionsInnerAlertsFilter `json:"alerts_filter,omitempty"` // The type of connector. This property appears in responses but cannot be set in requests. ConnectorTypeId *string `json:"connector_type_id,omitempty"` Frequency *ActionsInnerFrequency `json:"frequency,omitempty"` - // The group name for the actions. If you don't need to group actions, set to `default`. - Group *string `json:"group,omitempty"` + // The group name, which affects when the action runs (for example, when the threshold is met or when the alert is recovered). Each rule type has a list of valid action group names. If you don't need to group actions, set to `default`. + Group string `json:"group"` // The identifier for the connector saved object. - Id *string `json:"id,omitempty"` + Id string `json:"id"` // The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. - Params map[string]interface{} `json:"params,omitempty"` + Params map[string]interface{} `json:"params"` + // A universally unique identifier (UUID) for the action. + Uuid *string `json:"uuid,omitempty"` } // NewActionsInner instantiates a new ActionsInner object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewActionsInner() *ActionsInner { +func NewActionsInner(group string, id string, params map[string]interface{}) *ActionsInner { this := ActionsInner{} + this.Group = group + this.Id = id + this.Params = params return &this } @@ -47,6 +53,38 @@ func NewActionsInnerWithDefaults() *ActionsInner { return &this } +// GetAlertsFilter returns the AlertsFilter field value if set, zero value otherwise. +func (o *ActionsInner) GetAlertsFilter() ActionsInnerAlertsFilter { + if o == nil || IsNil(o.AlertsFilter) { + var ret ActionsInnerAlertsFilter + return ret + } + return *o.AlertsFilter +} + +// GetAlertsFilterOk returns a tuple with the AlertsFilter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInner) GetAlertsFilterOk() (*ActionsInnerAlertsFilter, bool) { + if o == nil || IsNil(o.AlertsFilter) { + return nil, false + } + return o.AlertsFilter, true +} + +// HasAlertsFilter returns a boolean if a field has been set. +func (o *ActionsInner) HasAlertsFilter() bool { + if o != nil && !IsNil(o.AlertsFilter) { + return true + } + + return false +} + +// SetAlertsFilter gets a reference to the given ActionsInnerAlertsFilter and assigns it to the AlertsFilter field. +func (o *ActionsInner) SetAlertsFilter(v ActionsInnerAlertsFilter) { + o.AlertsFilter = &v +} + // GetConnectorTypeId returns the ConnectorTypeId field value if set, zero value otherwise. func (o *ActionsInner) GetConnectorTypeId() string { if o == nil || IsNil(o.ConnectorTypeId) { @@ -111,100 +149,108 @@ func (o *ActionsInner) SetFrequency(v ActionsInnerFrequency) { o.Frequency = &v } -// GetGroup returns the Group field value if set, zero value otherwise. +// GetGroup returns the Group field value func (o *ActionsInner) GetGroup() string { - if o == nil || IsNil(o.Group) { + if o == nil { var ret string return ret } - return *o.Group + + return o.Group } -// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// GetGroupOk returns a tuple with the Group field value // and a boolean to check if the value has been set. func (o *ActionsInner) GetGroupOk() (*string, bool) { - if o == nil || IsNil(o.Group) { + if o == nil { return nil, false } - return o.Group, true + return &o.Group, true } -// HasGroup returns a boolean if a field has been set. -func (o *ActionsInner) HasGroup() bool { - if o != nil && !IsNil(o.Group) { - return true - } - - return false -} - -// SetGroup gets a reference to the given string and assigns it to the Group field. +// SetGroup sets field value func (o *ActionsInner) SetGroup(v string) { - o.Group = &v + o.Group = v } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *ActionsInner) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *ActionsInner) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true + return &o.Id, true } -// HasId returns a boolean if a field has been set. -func (o *ActionsInner) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *ActionsInner) SetId(v string) { - o.Id = &v + o.Id = v } -// GetParams returns the Params field value if set, zero value otherwise. +// GetParams returns the Params field value func (o *ActionsInner) GetParams() map[string]interface{} { - if o == nil || IsNil(o.Params) { + if o == nil { var ret map[string]interface{} return ret } + return o.Params } -// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// GetParamsOk returns a tuple with the Params field value // and a boolean to check if the value has been set. func (o *ActionsInner) GetParamsOk() (map[string]interface{}, bool) { - if o == nil || IsNil(o.Params) { + if o == nil { return map[string]interface{}{}, false } return o.Params, true } -// HasParams returns a boolean if a field has been set. -func (o *ActionsInner) HasParams() bool { - if o != nil && !IsNil(o.Params) { +// SetParams sets field value +func (o *ActionsInner) SetParams(v map[string]interface{}) { + o.Params = v +} + +// GetUuid returns the Uuid field value if set, zero value otherwise. +func (o *ActionsInner) GetUuid() string { + if o == nil || IsNil(o.Uuid) { + var ret string + return ret + } + return *o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInner) GetUuidOk() (*string, bool) { + if o == nil || IsNil(o.Uuid) { + return nil, false + } + return o.Uuid, true +} + +// HasUuid returns a boolean if a field has been set. +func (o *ActionsInner) HasUuid() bool { + if o != nil && !IsNil(o.Uuid) { return true } return false } -// SetParams gets a reference to the given map[string]interface{} and assigns it to the Params field. -func (o *ActionsInner) SetParams(v map[string]interface{}) { - o.Params = v +// SetUuid gets a reference to the given string and assigns it to the Uuid field. +func (o *ActionsInner) SetUuid(v string) { + o.Uuid = &v } func (o ActionsInner) MarshalJSON() ([]byte, error) { @@ -217,20 +263,20 @@ func (o ActionsInner) MarshalJSON() ([]byte, error) { func (o ActionsInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.AlertsFilter) { + toSerialize["alerts_filter"] = o.AlertsFilter + } if !IsNil(o.ConnectorTypeId) { toSerialize["connector_type_id"] = o.ConnectorTypeId } if !IsNil(o.Frequency) { toSerialize["frequency"] = o.Frequency } - if !IsNil(o.Group) { - toSerialize["group"] = o.Group - } - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } - if !IsNil(o.Params) { - toSerialize["params"] = o.Params + toSerialize["group"] = o.Group + toSerialize["id"] = o.Id + toSerialize["params"] = o.Params + if !IsNil(o.Uuid) { + toSerialize["uuid"] = o.Uuid } return toSerialize, nil } diff --git a/generated/alerting/model_actions_inner_alerts_filter.go b/generated/alerting/model_actions_inner_alerts_filter.go new file mode 100644 index 000000000..b53edaafb --- /dev/null +++ b/generated/alerting/model_actions_inner_alerts_filter.go @@ -0,0 +1,160 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the ActionsInnerAlertsFilter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActionsInnerAlertsFilter{} + +// ActionsInnerAlertsFilter Conditions that affect whether the action runs. If you specify multiple conditions, all conditions must be met for the action to run. For example, if an alert occurs within the specified time frame and matches the query, the action runs. +type ActionsInnerAlertsFilter struct { + Query *ActionsInnerAlertsFilterQuery `json:"query,omitempty"` + Timeframe *ActionsInnerAlertsFilterTimeframe `json:"timeframe,omitempty"` +} + +// NewActionsInnerAlertsFilter instantiates a new ActionsInnerAlertsFilter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewActionsInnerAlertsFilter() *ActionsInnerAlertsFilter { + this := ActionsInnerAlertsFilter{} + return &this +} + +// NewActionsInnerAlertsFilterWithDefaults instantiates a new ActionsInnerAlertsFilter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewActionsInnerAlertsFilterWithDefaults() *ActionsInnerAlertsFilter { + this := ActionsInnerAlertsFilter{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilter) GetQuery() ActionsInnerAlertsFilterQuery { + if o == nil || IsNil(o.Query) { + var ret ActionsInnerAlertsFilterQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilter) GetQueryOk() (*ActionsInnerAlertsFilterQuery, bool) { + if o == nil || IsNil(o.Query) { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilter) HasQuery() bool { + if o != nil && !IsNil(o.Query) { + return true + } + + return false +} + +// SetQuery gets a reference to the given ActionsInnerAlertsFilterQuery and assigns it to the Query field. +func (o *ActionsInnerAlertsFilter) SetQuery(v ActionsInnerAlertsFilterQuery) { + o.Query = &v +} + +// GetTimeframe returns the Timeframe field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilter) GetTimeframe() ActionsInnerAlertsFilterTimeframe { + if o == nil || IsNil(o.Timeframe) { + var ret ActionsInnerAlertsFilterTimeframe + return ret + } + return *o.Timeframe +} + +// GetTimeframeOk returns a tuple with the Timeframe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilter) GetTimeframeOk() (*ActionsInnerAlertsFilterTimeframe, bool) { + if o == nil || IsNil(o.Timeframe) { + return nil, false + } + return o.Timeframe, true +} + +// HasTimeframe returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilter) HasTimeframe() bool { + if o != nil && !IsNil(o.Timeframe) { + return true + } + + return false +} + +// SetTimeframe gets a reference to the given ActionsInnerAlertsFilterTimeframe and assigns it to the Timeframe field. +func (o *ActionsInnerAlertsFilter) SetTimeframe(v ActionsInnerAlertsFilterTimeframe) { + o.Timeframe = &v +} + +func (o ActionsInnerAlertsFilter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ActionsInnerAlertsFilter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Query) { + toSerialize["query"] = o.Query + } + if !IsNil(o.Timeframe) { + toSerialize["timeframe"] = o.Timeframe + } + return toSerialize, nil +} + +type NullableActionsInnerAlertsFilter struct { + value *ActionsInnerAlertsFilter + isSet bool +} + +func (v NullableActionsInnerAlertsFilter) Get() *ActionsInnerAlertsFilter { + return v.value +} + +func (v *NullableActionsInnerAlertsFilter) Set(val *ActionsInnerAlertsFilter) { + v.value = val + v.isSet = true +} + +func (v NullableActionsInnerAlertsFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableActionsInnerAlertsFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActionsInnerAlertsFilter(val *ActionsInnerAlertsFilter) *NullableActionsInnerAlertsFilter { + return &NullableActionsInnerAlertsFilter{value: val, isSet: true} +} + +func (v NullableActionsInnerAlertsFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActionsInnerAlertsFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_actions_inner_alerts_filter_query.go b/generated/alerting/model_actions_inner_alerts_filter_query.go new file mode 100644 index 000000000..2782dc978 --- /dev/null +++ b/generated/alerting/model_actions_inner_alerts_filter_query.go @@ -0,0 +1,161 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the ActionsInnerAlertsFilterQuery type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActionsInnerAlertsFilterQuery{} + +// ActionsInnerAlertsFilterQuery Defines a query filter that determines whether the action runs. +type ActionsInnerAlertsFilterQuery struct { + // A filter written in Kibana Query Language (KQL). + Kql *string `json:"kql,omitempty"` + Filters []Filter `json:"filters,omitempty"` +} + +// NewActionsInnerAlertsFilterQuery instantiates a new ActionsInnerAlertsFilterQuery object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewActionsInnerAlertsFilterQuery() *ActionsInnerAlertsFilterQuery { + this := ActionsInnerAlertsFilterQuery{} + return &this +} + +// NewActionsInnerAlertsFilterQueryWithDefaults instantiates a new ActionsInnerAlertsFilterQuery object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewActionsInnerAlertsFilterQueryWithDefaults() *ActionsInnerAlertsFilterQuery { + this := ActionsInnerAlertsFilterQuery{} + return &this +} + +// GetKql returns the Kql field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterQuery) GetKql() string { + if o == nil || IsNil(o.Kql) { + var ret string + return ret + } + return *o.Kql +} + +// GetKqlOk returns a tuple with the Kql field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterQuery) GetKqlOk() (*string, bool) { + if o == nil || IsNil(o.Kql) { + return nil, false + } + return o.Kql, true +} + +// HasKql returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterQuery) HasKql() bool { + if o != nil && !IsNil(o.Kql) { + return true + } + + return false +} + +// SetKql gets a reference to the given string and assigns it to the Kql field. +func (o *ActionsInnerAlertsFilterQuery) SetKql(v string) { + o.Kql = &v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterQuery) GetFilters() []Filter { + if o == nil || IsNil(o.Filters) { + var ret []Filter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterQuery) GetFiltersOk() ([]Filter, bool) { + if o == nil || IsNil(o.Filters) { + return nil, false + } + return o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterQuery) HasFilters() bool { + if o != nil && !IsNil(o.Filters) { + return true + } + + return false +} + +// SetFilters gets a reference to the given []Filter and assigns it to the Filters field. +func (o *ActionsInnerAlertsFilterQuery) SetFilters(v []Filter) { + o.Filters = v +} + +func (o ActionsInnerAlertsFilterQuery) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ActionsInnerAlertsFilterQuery) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Kql) { + toSerialize["kql"] = o.Kql + } + if !IsNil(o.Filters) { + toSerialize["filters"] = o.Filters + } + return toSerialize, nil +} + +type NullableActionsInnerAlertsFilterQuery struct { + value *ActionsInnerAlertsFilterQuery + isSet bool +} + +func (v NullableActionsInnerAlertsFilterQuery) Get() *ActionsInnerAlertsFilterQuery { + return v.value +} + +func (v *NullableActionsInnerAlertsFilterQuery) Set(val *ActionsInnerAlertsFilterQuery) { + v.value = val + v.isSet = true +} + +func (v NullableActionsInnerAlertsFilterQuery) IsSet() bool { + return v.isSet +} + +func (v *NullableActionsInnerAlertsFilterQuery) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActionsInnerAlertsFilterQuery(val *ActionsInnerAlertsFilterQuery) *NullableActionsInnerAlertsFilterQuery { + return &NullableActionsInnerAlertsFilterQuery{value: val, isSet: true} +} + +func (v NullableActionsInnerAlertsFilterQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActionsInnerAlertsFilterQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_actions_inner_alerts_filter_timeframe.go b/generated/alerting/model_actions_inner_alerts_filter_timeframe.go new file mode 100644 index 000000000..4bd68eb00 --- /dev/null +++ b/generated/alerting/model_actions_inner_alerts_filter_timeframe.go @@ -0,0 +1,197 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the ActionsInnerAlertsFilterTimeframe type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActionsInnerAlertsFilterTimeframe{} + +// ActionsInnerAlertsFilterTimeframe Defines a period that limits whether the action runs. +type ActionsInnerAlertsFilterTimeframe struct { + Days []int32 `json:"days,omitempty"` + Hours *ActionsInnerAlertsFilterTimeframeHours `json:"hours,omitempty"` + // The ISO time zone for the `hours` values. Values such as `UTC` and `UTC+1` also work but lack built-in daylight savings time support and are not recommended. + Timezone *string `json:"timezone,omitempty"` +} + +// NewActionsInnerAlertsFilterTimeframe instantiates a new ActionsInnerAlertsFilterTimeframe object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewActionsInnerAlertsFilterTimeframe() *ActionsInnerAlertsFilterTimeframe { + this := ActionsInnerAlertsFilterTimeframe{} + return &this +} + +// NewActionsInnerAlertsFilterTimeframeWithDefaults instantiates a new ActionsInnerAlertsFilterTimeframe object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewActionsInnerAlertsFilterTimeframeWithDefaults() *ActionsInnerAlertsFilterTimeframe { + this := ActionsInnerAlertsFilterTimeframe{} + return &this +} + +// GetDays returns the Days field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterTimeframe) GetDays() []int32 { + if o == nil || IsNil(o.Days) { + var ret []int32 + return ret + } + return o.Days +} + +// GetDaysOk returns a tuple with the Days field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterTimeframe) GetDaysOk() ([]int32, bool) { + if o == nil || IsNil(o.Days) { + return nil, false + } + return o.Days, true +} + +// HasDays returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterTimeframe) HasDays() bool { + if o != nil && !IsNil(o.Days) { + return true + } + + return false +} + +// SetDays gets a reference to the given []int32 and assigns it to the Days field. +func (o *ActionsInnerAlertsFilterTimeframe) SetDays(v []int32) { + o.Days = v +} + +// GetHours returns the Hours field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterTimeframe) GetHours() ActionsInnerAlertsFilterTimeframeHours { + if o == nil || IsNil(o.Hours) { + var ret ActionsInnerAlertsFilterTimeframeHours + return ret + } + return *o.Hours +} + +// GetHoursOk returns a tuple with the Hours field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterTimeframe) GetHoursOk() (*ActionsInnerAlertsFilterTimeframeHours, bool) { + if o == nil || IsNil(o.Hours) { + return nil, false + } + return o.Hours, true +} + +// HasHours returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterTimeframe) HasHours() bool { + if o != nil && !IsNil(o.Hours) { + return true + } + + return false +} + +// SetHours gets a reference to the given ActionsInnerAlertsFilterTimeframeHours and assigns it to the Hours field. +func (o *ActionsInnerAlertsFilterTimeframe) SetHours(v ActionsInnerAlertsFilterTimeframeHours) { + o.Hours = &v +} + +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterTimeframe) GetTimezone() string { + if o == nil || IsNil(o.Timezone) { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterTimeframe) GetTimezoneOk() (*string, bool) { + if o == nil || IsNil(o.Timezone) { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterTimeframe) HasTimezone() bool { + if o != nil && !IsNil(o.Timezone) { + return true + } + + return false +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *ActionsInnerAlertsFilterTimeframe) SetTimezone(v string) { + o.Timezone = &v +} + +func (o ActionsInnerAlertsFilterTimeframe) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ActionsInnerAlertsFilterTimeframe) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Days) { + toSerialize["days"] = o.Days + } + if !IsNil(o.Hours) { + toSerialize["hours"] = o.Hours + } + if !IsNil(o.Timezone) { + toSerialize["timezone"] = o.Timezone + } + return toSerialize, nil +} + +type NullableActionsInnerAlertsFilterTimeframe struct { + value *ActionsInnerAlertsFilterTimeframe + isSet bool +} + +func (v NullableActionsInnerAlertsFilterTimeframe) Get() *ActionsInnerAlertsFilterTimeframe { + return v.value +} + +func (v *NullableActionsInnerAlertsFilterTimeframe) Set(val *ActionsInnerAlertsFilterTimeframe) { + v.value = val + v.isSet = true +} + +func (v NullableActionsInnerAlertsFilterTimeframe) IsSet() bool { + return v.isSet +} + +func (v *NullableActionsInnerAlertsFilterTimeframe) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActionsInnerAlertsFilterTimeframe(val *ActionsInnerAlertsFilterTimeframe) *NullableActionsInnerAlertsFilterTimeframe { + return &NullableActionsInnerAlertsFilterTimeframe{value: val, isSet: true} +} + +func (v NullableActionsInnerAlertsFilterTimeframe) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActionsInnerAlertsFilterTimeframe) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_actions_inner_alerts_filter_timeframe_hours.go b/generated/alerting/model_actions_inner_alerts_filter_timeframe_hours.go new file mode 100644 index 000000000..21efa4959 --- /dev/null +++ b/generated/alerting/model_actions_inner_alerts_filter_timeframe_hours.go @@ -0,0 +1,162 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the ActionsInnerAlertsFilterTimeframeHours type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActionsInnerAlertsFilterTimeframeHours{} + +// ActionsInnerAlertsFilterTimeframeHours Defines the range of time in a day that the action can run. If the `start` value is `00:00` and the `end` value is `24:00`, actions be generated all day. +type ActionsInnerAlertsFilterTimeframeHours struct { + // The end of the time frame in 24-hour notation (`hh:mm`). + End *string `json:"end,omitempty"` + // The start of the time frame in 24-hour notation (`hh:mm`). + Start *string `json:"start,omitempty"` +} + +// NewActionsInnerAlertsFilterTimeframeHours instantiates a new ActionsInnerAlertsFilterTimeframeHours object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewActionsInnerAlertsFilterTimeframeHours() *ActionsInnerAlertsFilterTimeframeHours { + this := ActionsInnerAlertsFilterTimeframeHours{} + return &this +} + +// NewActionsInnerAlertsFilterTimeframeHoursWithDefaults instantiates a new ActionsInnerAlertsFilterTimeframeHours object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewActionsInnerAlertsFilterTimeframeHoursWithDefaults() *ActionsInnerAlertsFilterTimeframeHours { + this := ActionsInnerAlertsFilterTimeframeHours{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterTimeframeHours) GetEnd() string { + if o == nil || IsNil(o.End) { + var ret string + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterTimeframeHours) GetEndOk() (*string, bool) { + if o == nil || IsNil(o.End) { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterTimeframeHours) HasEnd() bool { + if o != nil && !IsNil(o.End) { + return true + } + + return false +} + +// SetEnd gets a reference to the given string and assigns it to the End field. +func (o *ActionsInnerAlertsFilterTimeframeHours) SetEnd(v string) { + o.End = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *ActionsInnerAlertsFilterTimeframeHours) GetStart() string { + if o == nil || IsNil(o.Start) { + var ret string + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActionsInnerAlertsFilterTimeframeHours) GetStartOk() (*string, bool) { + if o == nil || IsNil(o.Start) { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *ActionsInnerAlertsFilterTimeframeHours) HasStart() bool { + if o != nil && !IsNil(o.Start) { + return true + } + + return false +} + +// SetStart gets a reference to the given string and assigns it to the Start field. +func (o *ActionsInnerAlertsFilterTimeframeHours) SetStart(v string) { + o.Start = &v +} + +func (o ActionsInnerAlertsFilterTimeframeHours) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ActionsInnerAlertsFilterTimeframeHours) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.End) { + toSerialize["end"] = o.End + } + if !IsNil(o.Start) { + toSerialize["start"] = o.Start + } + return toSerialize, nil +} + +type NullableActionsInnerAlertsFilterTimeframeHours struct { + value *ActionsInnerAlertsFilterTimeframeHours + isSet bool +} + +func (v NullableActionsInnerAlertsFilterTimeframeHours) Get() *ActionsInnerAlertsFilterTimeframeHours { + return v.value +} + +func (v *NullableActionsInnerAlertsFilterTimeframeHours) Set(val *ActionsInnerAlertsFilterTimeframeHours) { + v.value = val + v.isSet = true +} + +func (v NullableActionsInnerAlertsFilterTimeframeHours) IsSet() bool { + return v.isSet +} + +func (v *NullableActionsInnerAlertsFilterTimeframeHours) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActionsInnerAlertsFilterTimeframeHours(val *ActionsInnerAlertsFilterTimeframeHours) *NullableActionsInnerAlertsFilterTimeframeHours { + return &NullableActionsInnerAlertsFilterTimeframeHours{value: val, isSet: true} +} + +func (v NullableActionsInnerAlertsFilterTimeframeHours) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActionsInnerAlertsFilterTimeframeHours) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_actions_inner_frequency.go b/generated/alerting/model_actions_inner_frequency.go index b33da8787..2bf2be63d 100644 --- a/generated/alerting/model_actions_inner_frequency.go +++ b/generated/alerting/model_actions_inner_frequency.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,12 +17,12 @@ import ( // checks if the ActionsInnerFrequency type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ActionsInnerFrequency{} -// ActionsInnerFrequency The parameters that affect how often actions are generated. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. +// ActionsInnerFrequency The properties that affect how often actions are generated. If the rule type supports setting `summary` to `true`, the action can be a summary of alerts at the specified notification interval. Otherwise, an action runs for each alert at the specified notification interval. NOTE: You cannot specify these parameters when `notify_when` or `throttle` are defined at the rule level. type ActionsInnerFrequency struct { NotifyWhen NotifyWhen `json:"notify_when"` // Indicates whether the action is a summary. Summary bool `json:"summary"` - // The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. + // The throttle interval, which defines how often an alert generates repeated actions. It is specified in seconds, minutes, hours, or days and is applicable only if `notify_when` is set to `onThrottleInterval`. NOTE: You cannot specify the throttle interval at both the rule and action level. The recommended method is to set it for each action. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. Throttle NullableString `json:"throttle,omitempty"` } diff --git a/generated/alerting/model_alert_delay.go b/generated/alerting/model_alert_delay.go new file mode 100644 index 000000000..afd273b72 --- /dev/null +++ b/generated/alerting/model_alert_delay.go @@ -0,0 +1,116 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the AlertDelay type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertDelay{} + +// AlertDelay Indicates that an alert occurs only when the specified number of consecutive runs met the rule conditions. +type AlertDelay struct { + // The number of consecutive runs that must meet the rule conditions. + Active float32 `json:"active"` +} + +// NewAlertDelay instantiates a new AlertDelay object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAlertDelay(active float32) *AlertDelay { + this := AlertDelay{} + this.Active = active + return &this +} + +// NewAlertDelayWithDefaults instantiates a new AlertDelay object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAlertDelayWithDefaults() *AlertDelay { + this := AlertDelay{} + return &this +} + +// GetActive returns the Active field value +func (o *AlertDelay) GetActive() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Active +} + +// GetActiveOk returns a tuple with the Active field value +// and a boolean to check if the value has been set. +func (o *AlertDelay) GetActiveOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Active, true +} + +// SetActive sets field value +func (o *AlertDelay) SetActive(v float32) { + o.Active = v +} + +func (o AlertDelay) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AlertDelay) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["active"] = o.Active + return toSerialize, nil +} + +type NullableAlertDelay struct { + value *AlertDelay + isSet bool +} + +func (v NullableAlertDelay) Get() *AlertDelay { + return v.value +} + +func (v *NullableAlertDelay) Set(val *AlertDelay) { + v.value = val + v.isSet = true +} + +func (v NullableAlertDelay) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertDelay) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertDelay(val *AlertDelay) *NullableAlertDelay { + return &NullableAlertDelay{value: val, isSet: true} +} + +func (v NullableAlertDelay) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertDelay) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_alert_response_properties.go b/generated/alerting/model_alert_response_properties.go index d5866d1db..ab4d3e0f2 100644 --- a/generated/alerting/model_alert_response_properties.go +++ b/generated/alerting/model_alert_response_properties.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -363,9 +363,9 @@ func (o *AlertResponseProperties) SetMuteAll(v bool) { o.MuteAll = &v } -// GetMutedInstanceIds returns the MutedInstanceIds field value if set, zero value otherwise (both if not set or set to explicit null). +// GetMutedInstanceIds returns the MutedInstanceIds field value if set, zero value otherwise. func (o *AlertResponseProperties) GetMutedInstanceIds() []string { - if o == nil { + if o == nil || IsNil(o.MutedInstanceIds) { var ret []string return ret } @@ -374,7 +374,6 @@ func (o *AlertResponseProperties) GetMutedInstanceIds() []string { // GetMutedInstanceIdsOk returns a tuple with the MutedInstanceIds field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *AlertResponseProperties) GetMutedInstanceIdsOk() ([]string, bool) { if o == nil || IsNil(o.MutedInstanceIds) { return nil, false @@ -384,7 +383,7 @@ func (o *AlertResponseProperties) GetMutedInstanceIdsOk() ([]string, bool) { // HasMutedInstanceIds returns a boolean if a field has been set. func (o *AlertResponseProperties) HasMutedInstanceIds() bool { - if o != nil && IsNil(o.MutedInstanceIds) { + if o != nil && !IsNil(o.MutedInstanceIds) { return true } @@ -743,7 +742,7 @@ func (o AlertResponseProperties) ToMap() (map[string]interface{}, error) { if !IsNil(o.MuteAll) { toSerialize["muteAll"] = o.MuteAll } - if o.MutedInstanceIds != nil { + if !IsNil(o.MutedInstanceIds) { toSerialize["mutedInstanceIds"] = o.MutedInstanceIds } if !IsNil(o.Name) { diff --git a/generated/alerting/model_alert_response_properties_execution_status.go b/generated/alerting/model_alert_response_properties_execution_status.go index 49ccab9db..feb16111f 100644 --- a/generated/alerting/model_alert_response_properties_execution_status.go +++ b/generated/alerting/model_alert_response_properties_execution_status.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_alert_response_properties_schedule.go b/generated/alerting/model_alert_response_properties_schedule.go index 90d8ce2e4..506c2b883 100644 --- a/generated/alerting/model_alert_response_properties_schedule.go +++ b/generated/alerting/model_alert_response_properties_schedule.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_create_rule_request.go b/generated/alerting/model_create_rule_request.go index 3b03004fa..6f818dc99 100644 --- a/generated/alerting/model_create_rule_request.go +++ b/generated/alerting/model_create_rule_request.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -25,17 +25,19 @@ type CreateRuleRequest struct { // Indicates whether you want to run the rule on an interval basis after it is created. Enabled *bool `json:"enabled,omitempty"` // The name of the rule. While this name does not have to be unique, a distinctive name can help you identify a rule. - Name string `json:"name"` + Name string `json:"name"` + // Deprecated NotifyWhen *NotifyWhen `json:"notify_when,omitempty"` // The parameters for the rule. Params map[string]interface{} `json:"params"` // The ID of the rule type that you want to call when the rule is scheduled to run. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. RuleTypeId string `json:"rule_type_id"` Schedule Schedule `json:"schedule"` - // The tags for the rule. - Tags []string `json:"tags,omitempty"` - // The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. - Throttle NullableString `json:"throttle,omitempty"` + Tags []string `json:"tags,omitempty"` + // Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + // Deprecated + Throttle NullableString `json:"throttle,omitempty"` + AlertDelay *AlertDelay `json:"alert_delay,omitempty"` } // NewCreateRuleRequest instantiates a new CreateRuleRequest object @@ -60,9 +62,9 @@ func NewCreateRuleRequestWithDefaults() *CreateRuleRequest { return &this } -// GetActions returns the Actions field value if set, zero value otherwise (both if not set or set to explicit null). +// GetActions returns the Actions field value if set, zero value otherwise. func (o *CreateRuleRequest) GetActions() []ActionsInner { - if o == nil { + if o == nil || IsNil(o.Actions) { var ret []ActionsInner return ret } @@ -71,7 +73,6 @@ func (o *CreateRuleRequest) GetActions() []ActionsInner { // GetActionsOk returns a tuple with the Actions field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateRuleRequest) GetActionsOk() ([]ActionsInner, bool) { if o == nil || IsNil(o.Actions) { return nil, false @@ -81,7 +82,7 @@ func (o *CreateRuleRequest) GetActionsOk() ([]ActionsInner, bool) { // HasActions returns a boolean if a field has been set. func (o *CreateRuleRequest) HasActions() bool { - if o != nil && IsNil(o.Actions) { + if o != nil && !IsNil(o.Actions) { return true } @@ -174,6 +175,7 @@ func (o *CreateRuleRequest) SetName(v string) { } // GetNotifyWhen returns the NotifyWhen field value if set, zero value otherwise. +// Deprecated func (o *CreateRuleRequest) GetNotifyWhen() NotifyWhen { if o == nil || IsNil(o.NotifyWhen) { var ret NotifyWhen @@ -184,6 +186,7 @@ func (o *CreateRuleRequest) GetNotifyWhen() NotifyWhen { // GetNotifyWhenOk returns a tuple with the NotifyWhen field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *CreateRuleRequest) GetNotifyWhenOk() (*NotifyWhen, bool) { if o == nil || IsNil(o.NotifyWhen) { return nil, false @@ -201,6 +204,7 @@ func (o *CreateRuleRequest) HasNotifyWhen() bool { } // SetNotifyWhen gets a reference to the given NotifyWhen and assigns it to the NotifyWhen field. +// Deprecated func (o *CreateRuleRequest) SetNotifyWhen(v NotifyWhen) { o.NotifyWhen = &v } @@ -310,6 +314,7 @@ func (o *CreateRuleRequest) SetTags(v []string) { } // GetThrottle returns the Throttle field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated func (o *CreateRuleRequest) GetThrottle() string { if o == nil || IsNil(o.Throttle.Get()) { var ret string @@ -321,6 +326,7 @@ func (o *CreateRuleRequest) GetThrottle() string { // GetThrottleOk returns a tuple with the Throttle field value if set, nil otherwise // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated func (o *CreateRuleRequest) GetThrottleOk() (*string, bool) { if o == nil { return nil, false @@ -338,6 +344,7 @@ func (o *CreateRuleRequest) HasThrottle() bool { } // SetThrottle gets a reference to the given NullableString and assigns it to the Throttle field. +// Deprecated func (o *CreateRuleRequest) SetThrottle(v string) { o.Throttle.Set(&v) } @@ -352,6 +359,38 @@ func (o *CreateRuleRequest) UnsetThrottle() { o.Throttle.Unset() } +// GetAlertDelay returns the AlertDelay field value if set, zero value otherwise. +func (o *CreateRuleRequest) GetAlertDelay() AlertDelay { + if o == nil || IsNil(o.AlertDelay) { + var ret AlertDelay + return ret + } + return *o.AlertDelay +} + +// GetAlertDelayOk returns a tuple with the AlertDelay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRuleRequest) GetAlertDelayOk() (*AlertDelay, bool) { + if o == nil || IsNil(o.AlertDelay) { + return nil, false + } + return o.AlertDelay, true +} + +// HasAlertDelay returns a boolean if a field has been set. +func (o *CreateRuleRequest) HasAlertDelay() bool { + if o != nil && !IsNil(o.AlertDelay) { + return true + } + + return false +} + +// SetAlertDelay gets a reference to the given AlertDelay and assigns it to the AlertDelay field. +func (o *CreateRuleRequest) SetAlertDelay(v AlertDelay) { + o.AlertDelay = &v +} + func (o CreateRuleRequest) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -362,7 +401,7 @@ func (o CreateRuleRequest) MarshalJSON() ([]byte, error) { func (o CreateRuleRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Actions != nil { + if !IsNil(o.Actions) { toSerialize["actions"] = o.Actions } toSerialize["consumer"] = o.Consumer @@ -382,6 +421,9 @@ func (o CreateRuleRequest) ToMap() (map[string]interface{}, error) { if o.Throttle.IsSet() { toSerialize["throttle"] = o.Throttle.Get() } + if !IsNil(o.AlertDelay) { + toSerialize["alert_delay"] = o.AlertDelay + } return toSerialize, nil } diff --git a/generated/alerting/model_fieldmap_properties.go b/generated/alerting/model_fieldmap_properties.go new file mode 100644 index 000000000..7fa79c286 --- /dev/null +++ b/generated/alerting/model_fieldmap_properties.go @@ -0,0 +1,459 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the FieldmapProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FieldmapProperties{} + +// FieldmapProperties struct for FieldmapProperties +type FieldmapProperties struct { + // Indicates whether the field is an array. + Array *bool `json:"array,omitempty"` + // Indicates whether it is a dynamic field mapping. + Dynamic *bool `json:"dynamic,omitempty"` + // Indicates the format of the field. For example, if the `type` is `date_range`, the `format` can be `epoch_millis||strict_date_optional_time`. + Format *string `json:"format,omitempty"` + // Specifies the maximum length of a string field. Longer strings are not indexed or stored. + IgnoreAbove *int32 `json:"ignore_above,omitempty"` + // Indicates whether field values are indexed. + Index *bool `json:"index,omitempty"` + // TBD + Path *string `json:"path,omitempty"` + // Details about the object properties. This property is applicable when `type` is `object`. + Properties map[string]FieldmapPropertiesPropertiesValue `json:"properties,omitempty"` + // Indicates whether the field is required. + Required *bool `json:"required,omitempty"` + // The scaling factor to use when encoding values. This property is applicable when `type` is `scaled_float`. Values will be multiplied by this factor at index time and rounded to the closest long value. + ScalingFactor *int32 `json:"scaling_factor,omitempty"` + // Specifies the data type for the field. + Type *string `json:"type,omitempty"` +} + +// NewFieldmapProperties instantiates a new FieldmapProperties object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFieldmapProperties() *FieldmapProperties { + this := FieldmapProperties{} + return &this +} + +// NewFieldmapPropertiesWithDefaults instantiates a new FieldmapProperties object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFieldmapPropertiesWithDefaults() *FieldmapProperties { + this := FieldmapProperties{} + return &this +} + +// GetArray returns the Array field value if set, zero value otherwise. +func (o *FieldmapProperties) GetArray() bool { + if o == nil || IsNil(o.Array) { + var ret bool + return ret + } + return *o.Array +} + +// GetArrayOk returns a tuple with the Array field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetArrayOk() (*bool, bool) { + if o == nil || IsNil(o.Array) { + return nil, false + } + return o.Array, true +} + +// HasArray returns a boolean if a field has been set. +func (o *FieldmapProperties) HasArray() bool { + if o != nil && !IsNil(o.Array) { + return true + } + + return false +} + +// SetArray gets a reference to the given bool and assigns it to the Array field. +func (o *FieldmapProperties) SetArray(v bool) { + o.Array = &v +} + +// GetDynamic returns the Dynamic field value if set, zero value otherwise. +func (o *FieldmapProperties) GetDynamic() bool { + if o == nil || IsNil(o.Dynamic) { + var ret bool + return ret + } + return *o.Dynamic +} + +// GetDynamicOk returns a tuple with the Dynamic field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetDynamicOk() (*bool, bool) { + if o == nil || IsNil(o.Dynamic) { + return nil, false + } + return o.Dynamic, true +} + +// HasDynamic returns a boolean if a field has been set. +func (o *FieldmapProperties) HasDynamic() bool { + if o != nil && !IsNil(o.Dynamic) { + return true + } + + return false +} + +// SetDynamic gets a reference to the given bool and assigns it to the Dynamic field. +func (o *FieldmapProperties) SetDynamic(v bool) { + o.Dynamic = &v +} + +// GetFormat returns the Format field value if set, zero value otherwise. +func (o *FieldmapProperties) GetFormat() string { + if o == nil || IsNil(o.Format) { + var ret string + return ret + } + return *o.Format +} + +// GetFormatOk returns a tuple with the Format field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetFormatOk() (*string, bool) { + if o == nil || IsNil(o.Format) { + return nil, false + } + return o.Format, true +} + +// HasFormat returns a boolean if a field has been set. +func (o *FieldmapProperties) HasFormat() bool { + if o != nil && !IsNil(o.Format) { + return true + } + + return false +} + +// SetFormat gets a reference to the given string and assigns it to the Format field. +func (o *FieldmapProperties) SetFormat(v string) { + o.Format = &v +} + +// GetIgnoreAbove returns the IgnoreAbove field value if set, zero value otherwise. +func (o *FieldmapProperties) GetIgnoreAbove() int32 { + if o == nil || IsNil(o.IgnoreAbove) { + var ret int32 + return ret + } + return *o.IgnoreAbove +} + +// GetIgnoreAboveOk returns a tuple with the IgnoreAbove field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetIgnoreAboveOk() (*int32, bool) { + if o == nil || IsNil(o.IgnoreAbove) { + return nil, false + } + return o.IgnoreAbove, true +} + +// HasIgnoreAbove returns a boolean if a field has been set. +func (o *FieldmapProperties) HasIgnoreAbove() bool { + if o != nil && !IsNil(o.IgnoreAbove) { + return true + } + + return false +} + +// SetIgnoreAbove gets a reference to the given int32 and assigns it to the IgnoreAbove field. +func (o *FieldmapProperties) SetIgnoreAbove(v int32) { + o.IgnoreAbove = &v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *FieldmapProperties) GetIndex() bool { + if o == nil || IsNil(o.Index) { + var ret bool + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetIndexOk() (*bool, bool) { + if o == nil || IsNil(o.Index) { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *FieldmapProperties) HasIndex() bool { + if o != nil && !IsNil(o.Index) { + return true + } + + return false +} + +// SetIndex gets a reference to the given bool and assigns it to the Index field. +func (o *FieldmapProperties) SetIndex(v bool) { + o.Index = &v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *FieldmapProperties) GetPath() string { + if o == nil || IsNil(o.Path) { + var ret string + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetPathOk() (*string, bool) { + if o == nil || IsNil(o.Path) { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *FieldmapProperties) HasPath() bool { + if o != nil && !IsNil(o.Path) { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *FieldmapProperties) SetPath(v string) { + o.Path = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FieldmapProperties) GetProperties() map[string]FieldmapPropertiesPropertiesValue { + if o == nil { + var ret map[string]FieldmapPropertiesPropertiesValue + return ret + } + return o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FieldmapProperties) GetPropertiesOk() (*map[string]FieldmapPropertiesPropertiesValue, bool) { + if o == nil || IsNil(o.Properties) { + return nil, false + } + return &o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *FieldmapProperties) HasProperties() bool { + if o != nil && IsNil(o.Properties) { + return true + } + + return false +} + +// SetProperties gets a reference to the given map[string]FieldmapPropertiesPropertiesValue and assigns it to the Properties field. +func (o *FieldmapProperties) SetProperties(v map[string]FieldmapPropertiesPropertiesValue) { + o.Properties = v +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *FieldmapProperties) GetRequired() bool { + if o == nil || IsNil(o.Required) { + var ret bool + return ret + } + return *o.Required +} + +// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetRequiredOk() (*bool, bool) { + if o == nil || IsNil(o.Required) { + return nil, false + } + return o.Required, true +} + +// HasRequired returns a boolean if a field has been set. +func (o *FieldmapProperties) HasRequired() bool { + if o != nil && !IsNil(o.Required) { + return true + } + + return false +} + +// SetRequired gets a reference to the given bool and assigns it to the Required field. +func (o *FieldmapProperties) SetRequired(v bool) { + o.Required = &v +} + +// GetScalingFactor returns the ScalingFactor field value if set, zero value otherwise. +func (o *FieldmapProperties) GetScalingFactor() int32 { + if o == nil || IsNil(o.ScalingFactor) { + var ret int32 + return ret + } + return *o.ScalingFactor +} + +// GetScalingFactorOk returns a tuple with the ScalingFactor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetScalingFactorOk() (*int32, bool) { + if o == nil || IsNil(o.ScalingFactor) { + return nil, false + } + return o.ScalingFactor, true +} + +// HasScalingFactor returns a boolean if a field has been set. +func (o *FieldmapProperties) HasScalingFactor() bool { + if o != nil && !IsNil(o.ScalingFactor) { + return true + } + + return false +} + +// SetScalingFactor gets a reference to the given int32 and assigns it to the ScalingFactor field. +func (o *FieldmapProperties) SetScalingFactor(v int32) { + o.ScalingFactor = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FieldmapProperties) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapProperties) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FieldmapProperties) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FieldmapProperties) SetType(v string) { + o.Type = &v +} + +func (o FieldmapProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FieldmapProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Array) { + toSerialize["array"] = o.Array + } + if !IsNil(o.Dynamic) { + toSerialize["dynamic"] = o.Dynamic + } + if !IsNil(o.Format) { + toSerialize["format"] = o.Format + } + if !IsNil(o.IgnoreAbove) { + toSerialize["ignore_above"] = o.IgnoreAbove + } + if !IsNil(o.Index) { + toSerialize["index"] = o.Index + } + if !IsNil(o.Path) { + toSerialize["path"] = o.Path + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + if !IsNil(o.Required) { + toSerialize["required"] = o.Required + } + if !IsNil(o.ScalingFactor) { + toSerialize["scaling_factor"] = o.ScalingFactor + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +type NullableFieldmapProperties struct { + value *FieldmapProperties + isSet bool +} + +func (v NullableFieldmapProperties) Get() *FieldmapProperties { + return v.value +} + +func (v *NullableFieldmapProperties) Set(val *FieldmapProperties) { + v.value = val + v.isSet = true +} + +func (v NullableFieldmapProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableFieldmapProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFieldmapProperties(val *FieldmapProperties) *NullableFieldmapProperties { + return &NullableFieldmapProperties{value: val, isSet: true} +} + +func (v NullableFieldmapProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFieldmapProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_fieldmap_properties_properties_value.go b/generated/alerting/model_fieldmap_properties_properties_value.go new file mode 100644 index 000000000..2a9ca344e --- /dev/null +++ b/generated/alerting/model_fieldmap_properties_properties_value.go @@ -0,0 +1,125 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the FieldmapPropertiesPropertiesValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FieldmapPropertiesPropertiesValue{} + +// FieldmapPropertiesPropertiesValue struct for FieldmapPropertiesPropertiesValue +type FieldmapPropertiesPropertiesValue struct { + // The data type for each object property. + Type *string `json:"type,omitempty"` +} + +// NewFieldmapPropertiesPropertiesValue instantiates a new FieldmapPropertiesPropertiesValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFieldmapPropertiesPropertiesValue() *FieldmapPropertiesPropertiesValue { + this := FieldmapPropertiesPropertiesValue{} + return &this +} + +// NewFieldmapPropertiesPropertiesValueWithDefaults instantiates a new FieldmapPropertiesPropertiesValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFieldmapPropertiesPropertiesValueWithDefaults() *FieldmapPropertiesPropertiesValue { + this := FieldmapPropertiesPropertiesValue{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FieldmapPropertiesPropertiesValue) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FieldmapPropertiesPropertiesValue) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FieldmapPropertiesPropertiesValue) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FieldmapPropertiesPropertiesValue) SetType(v string) { + o.Type = &v +} + +func (o FieldmapPropertiesPropertiesValue) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FieldmapPropertiesPropertiesValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +type NullableFieldmapPropertiesPropertiesValue struct { + value *FieldmapPropertiesPropertiesValue + isSet bool +} + +func (v NullableFieldmapPropertiesPropertiesValue) Get() *FieldmapPropertiesPropertiesValue { + return v.value +} + +func (v *NullableFieldmapPropertiesPropertiesValue) Set(val *FieldmapPropertiesPropertiesValue) { + v.value = val + v.isSet = true +} + +func (v NullableFieldmapPropertiesPropertiesValue) IsSet() bool { + return v.isSet +} + +func (v *NullableFieldmapPropertiesPropertiesValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFieldmapPropertiesPropertiesValue(val *FieldmapPropertiesPropertiesValue) *NullableFieldmapPropertiesPropertiesValue { + return &NullableFieldmapPropertiesPropertiesValue{value: val, isSet: true} +} + +func (v NullableFieldmapPropertiesPropertiesValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFieldmapPropertiesPropertiesValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_filter.go b/generated/alerting/model_filter.go new file mode 100644 index 000000000..56d1a5f3e --- /dev/null +++ b/generated/alerting/model_filter.go @@ -0,0 +1,196 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the Filter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Filter{} + +// Filter A filter written in Elasticsearch Query Domain Specific Language (DSL) as defined in the `kbn-es-query` package. +type Filter struct { + Meta *FilterMeta `json:"meta,omitempty"` + Query map[string]interface{} `json:"query,omitempty"` + State map[string]interface{} `json:"$state,omitempty"` +} + +// NewFilter instantiates a new Filter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilter() *Filter { + this := Filter{} + return &this +} + +// NewFilterWithDefaults instantiates a new Filter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilterWithDefaults() *Filter { + this := Filter{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *Filter) GetMeta() FilterMeta { + if o == nil || IsNil(o.Meta) { + var ret FilterMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filter) GetMetaOk() (*FilterMeta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *Filter) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given FilterMeta and assigns it to the Meta field. +func (o *Filter) SetMeta(v FilterMeta) { + o.Meta = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *Filter) GetQuery() map[string]interface{} { + if o == nil || IsNil(o.Query) { + var ret map[string]interface{} + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filter) GetQueryOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Query) { + return map[string]interface{}{}, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *Filter) HasQuery() bool { + if o != nil && !IsNil(o.Query) { + return true + } + + return false +} + +// SetQuery gets a reference to the given map[string]interface{} and assigns it to the Query field. +func (o *Filter) SetQuery(v map[string]interface{}) { + o.Query = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Filter) GetState() map[string]interface{} { + if o == nil || IsNil(o.State) { + var ret map[string]interface{} + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filter) GetStateOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.State) { + return map[string]interface{}{}, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Filter) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given map[string]interface{} and assigns it to the State field. +func (o *Filter) SetState(v map[string]interface{}) { + o.State = v +} + +func (o Filter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Filter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + if !IsNil(o.Query) { + toSerialize["query"] = o.Query + } + if !IsNil(o.State) { + toSerialize["$state"] = o.State + } + return toSerialize, nil +} + +type NullableFilter struct { + value *Filter + isSet bool +} + +func (v NullableFilter) Get() *Filter { + return v.value +} + +func (v *NullableFilter) Set(val *Filter) { + v.value = val + v.isSet = true +} + +func (v NullableFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilter(val *Filter) *NullableFilter { + return &NullableFilter{value: val, isSet: true} +} + +func (v NullableFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_filter_meta.go b/generated/alerting/model_filter_meta.go new file mode 100644 index 000000000..74d9f7e57 --- /dev/null +++ b/generated/alerting/model_filter_meta.go @@ -0,0 +1,531 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the FilterMeta type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FilterMeta{} + +// FilterMeta struct for FilterMeta +type FilterMeta struct { + Alias NullableString `json:"alias,omitempty"` + ControlledBy *string `json:"controlledBy,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Field *string `json:"field,omitempty"` + Group *string `json:"group,omitempty"` + Index *string `json:"index,omitempty"` + IsMultiIndex *bool `json:"isMultiIndex,omitempty"` + Key *string `json:"key,omitempty"` + Negate *bool `json:"negate,omitempty"` + Params map[string]interface{} `json:"params,omitempty"` + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewFilterMeta instantiates a new FilterMeta object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFilterMeta() *FilterMeta { + this := FilterMeta{} + return &this +} + +// NewFilterMetaWithDefaults instantiates a new FilterMeta object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFilterMetaWithDefaults() *FilterMeta { + this := FilterMeta{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FilterMeta) GetAlias() string { + if o == nil || IsNil(o.Alias.Get()) { + var ret string + return ret + } + return *o.Alias.Get() +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FilterMeta) GetAliasOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Alias.Get(), o.Alias.IsSet() +} + +// HasAlias returns a boolean if a field has been set. +func (o *FilterMeta) HasAlias() bool { + if o != nil && o.Alias.IsSet() { + return true + } + + return false +} + +// SetAlias gets a reference to the given NullableString and assigns it to the Alias field. +func (o *FilterMeta) SetAlias(v string) { + o.Alias.Set(&v) +} + +// SetAliasNil sets the value for Alias to be an explicit nil +func (o *FilterMeta) SetAliasNil() { + o.Alias.Set(nil) +} + +// UnsetAlias ensures that no value is present for Alias, not even an explicit nil +func (o *FilterMeta) UnsetAlias() { + o.Alias.Unset() +} + +// GetControlledBy returns the ControlledBy field value if set, zero value otherwise. +func (o *FilterMeta) GetControlledBy() string { + if o == nil || IsNil(o.ControlledBy) { + var ret string + return ret + } + return *o.ControlledBy +} + +// GetControlledByOk returns a tuple with the ControlledBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetControlledByOk() (*string, bool) { + if o == nil || IsNil(o.ControlledBy) { + return nil, false + } + return o.ControlledBy, true +} + +// HasControlledBy returns a boolean if a field has been set. +func (o *FilterMeta) HasControlledBy() bool { + if o != nil && !IsNil(o.ControlledBy) { + return true + } + + return false +} + +// SetControlledBy gets a reference to the given string and assigns it to the ControlledBy field. +func (o *FilterMeta) SetControlledBy(v string) { + o.ControlledBy = &v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *FilterMeta) GetDisabled() bool { + if o == nil || IsNil(o.Disabled) { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetDisabledOk() (*bool, bool) { + if o == nil || IsNil(o.Disabled) { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *FilterMeta) HasDisabled() bool { + if o != nil && !IsNil(o.Disabled) { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *FilterMeta) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *FilterMeta) GetField() string { + if o == nil || IsNil(o.Field) { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetFieldOk() (*string, bool) { + if o == nil || IsNil(o.Field) { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *FilterMeta) HasField() bool { + if o != nil && !IsNil(o.Field) { + return true + } + + return false +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *FilterMeta) SetField(v string) { + o.Field = &v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *FilterMeta) GetGroup() string { + if o == nil || IsNil(o.Group) { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetGroupOk() (*string, bool) { + if o == nil || IsNil(o.Group) { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *FilterMeta) HasGroup() bool { + if o != nil && !IsNil(o.Group) { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *FilterMeta) SetGroup(v string) { + o.Group = &v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *FilterMeta) GetIndex() string { + if o == nil || IsNil(o.Index) { + var ret string + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetIndexOk() (*string, bool) { + if o == nil || IsNil(o.Index) { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *FilterMeta) HasIndex() bool { + if o != nil && !IsNil(o.Index) { + return true + } + + return false +} + +// SetIndex gets a reference to the given string and assigns it to the Index field. +func (o *FilterMeta) SetIndex(v string) { + o.Index = &v +} + +// GetIsMultiIndex returns the IsMultiIndex field value if set, zero value otherwise. +func (o *FilterMeta) GetIsMultiIndex() bool { + if o == nil || IsNil(o.IsMultiIndex) { + var ret bool + return ret + } + return *o.IsMultiIndex +} + +// GetIsMultiIndexOk returns a tuple with the IsMultiIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetIsMultiIndexOk() (*bool, bool) { + if o == nil || IsNil(o.IsMultiIndex) { + return nil, false + } + return o.IsMultiIndex, true +} + +// HasIsMultiIndex returns a boolean if a field has been set. +func (o *FilterMeta) HasIsMultiIndex() bool { + if o != nil && !IsNil(o.IsMultiIndex) { + return true + } + + return false +} + +// SetIsMultiIndex gets a reference to the given bool and assigns it to the IsMultiIndex field. +func (o *FilterMeta) SetIsMultiIndex(v bool) { + o.IsMultiIndex = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *FilterMeta) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *FilterMeta) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *FilterMeta) SetKey(v string) { + o.Key = &v +} + +// GetNegate returns the Negate field value if set, zero value otherwise. +func (o *FilterMeta) GetNegate() bool { + if o == nil || IsNil(o.Negate) { + var ret bool + return ret + } + return *o.Negate +} + +// GetNegateOk returns a tuple with the Negate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetNegateOk() (*bool, bool) { + if o == nil || IsNil(o.Negate) { + return nil, false + } + return o.Negate, true +} + +// HasNegate returns a boolean if a field has been set. +func (o *FilterMeta) HasNegate() bool { + if o != nil && !IsNil(o.Negate) { + return true + } + + return false +} + +// SetNegate gets a reference to the given bool and assigns it to the Negate field. +func (o *FilterMeta) SetNegate(v bool) { + o.Negate = &v +} + +// GetParams returns the Params field value if set, zero value otherwise. +func (o *FilterMeta) GetParams() map[string]interface{} { + if o == nil || IsNil(o.Params) { + var ret map[string]interface{} + return ret + } + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetParamsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Params) { + return map[string]interface{}{}, false + } + return o.Params, true +} + +// HasParams returns a boolean if a field has been set. +func (o *FilterMeta) HasParams() bool { + if o != nil && !IsNil(o.Params) { + return true + } + + return false +} + +// SetParams gets a reference to the given map[string]interface{} and assigns it to the Params field. +func (o *FilterMeta) SetParams(v map[string]interface{}) { + o.Params = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FilterMeta) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FilterMeta) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FilterMeta) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FilterMeta) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *FilterMeta) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *FilterMeta) SetValue(v string) { + o.Value = &v +} + +func (o FilterMeta) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FilterMeta) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Alias.IsSet() { + toSerialize["alias"] = o.Alias.Get() + } + if !IsNil(o.ControlledBy) { + toSerialize["controlledBy"] = o.ControlledBy + } + if !IsNil(o.Disabled) { + toSerialize["disabled"] = o.Disabled + } + if !IsNil(o.Field) { + toSerialize["field"] = o.Field + } + if !IsNil(o.Group) { + toSerialize["group"] = o.Group + } + if !IsNil(o.Index) { + toSerialize["index"] = o.Index + } + if !IsNil(o.IsMultiIndex) { + toSerialize["isMultiIndex"] = o.IsMultiIndex + } + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Negate) { + toSerialize["negate"] = o.Negate + } + if !IsNil(o.Params) { + toSerialize["params"] = o.Params + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + return toSerialize, nil +} + +type NullableFilterMeta struct { + value *FilterMeta + isSet bool +} + +func (v NullableFilterMeta) Get() *FilterMeta { + return v.value +} + +func (v *NullableFilterMeta) Set(val *FilterMeta) { + v.value = val + v.isSet = true +} + +func (v NullableFilterMeta) IsSet() bool { + return v.isSet +} + +func (v *NullableFilterMeta) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilterMeta(val *FilterMeta) *NullableFilterMeta { + return &NullableFilterMeta{value: val, isSet: true} +} + +func (v NullableFilterMeta) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilterMeta) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_find_rules_200_response.go b/generated/alerting/model_find_rules_200_response.go index 61c8a54eb..f462321e0 100644 --- a/generated/alerting/model_find_rules_200_response.go +++ b/generated/alerting/model_find_rules_200_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_find_rules_has_reference_parameter.go b/generated/alerting/model_find_rules_has_reference_parameter.go index 03945b239..4fa75f8bf 100644 --- a/generated/alerting/model_find_rules_has_reference_parameter.go +++ b/generated/alerting/model_find_rules_has_reference_parameter.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,8 @@ var _ MappedNullable = &FindRulesHasReferenceParameter{} // FindRulesHasReferenceParameter struct for FindRulesHasReferenceParameter type FindRulesHasReferenceParameter struct { - Id *string `json:"id,omitempty"` - Type *string `json:"type,omitempty"` + Id NullableString `json:"id,omitempty"` + Type NullableString `json:"type,omitempty"` } // NewFindRulesHasReferenceParameter instantiates a new FindRulesHasReferenceParameter object @@ -40,68 +40,90 @@ func NewFindRulesHasReferenceParameterWithDefaults() *FindRulesHasReferenceParam return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FindRulesHasReferenceParameter) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil || IsNil(o.Id.Get()) { var ret string return ret } - return *o.Id + return *o.Id.Get() } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *FindRulesHasReferenceParameter) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true + return o.Id.Get(), o.Id.IsSet() } // HasId returns a boolean if a field has been set. func (o *FindRulesHasReferenceParameter) HasId() bool { - if o != nil && !IsNil(o.Id) { + if o != nil && o.Id.IsSet() { return true } return false } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId gets a reference to the given NullableString and assigns it to the Id field. func (o *FindRulesHasReferenceParameter) SetId(v string) { - o.Id = &v + o.Id.Set(&v) } -// GetType returns the Type field value if set, zero value otherwise. +// SetIdNil sets the value for Id to be an explicit nil +func (o *FindRulesHasReferenceParameter) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *FindRulesHasReferenceParameter) UnsetId() { + o.Id.Unset() +} + +// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). func (o *FindRulesHasReferenceParameter) GetType() string { - if o == nil || IsNil(o.Type) { + if o == nil || IsNil(o.Type.Get()) { var ret string return ret } - return *o.Type + return *o.Type.Get() } // GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *FindRulesHasReferenceParameter) GetTypeOk() (*string, bool) { - if o == nil || IsNil(o.Type) { + if o == nil { return nil, false } - return o.Type, true + return o.Type.Get(), o.Type.IsSet() } // HasType returns a boolean if a field has been set. func (o *FindRulesHasReferenceParameter) HasType() bool { - if o != nil && !IsNil(o.Type) { + if o != nil && o.Type.IsSet() { return true } return false } -// SetType gets a reference to the given string and assigns it to the Type field. +// SetType gets a reference to the given NullableString and assigns it to the Type field. func (o *FindRulesHasReferenceParameter) SetType(v string) { - o.Type = &v + o.Type.Set(&v) +} + +// SetTypeNil sets the value for Type to be an explicit nil +func (o *FindRulesHasReferenceParameter) SetTypeNil() { + o.Type.Set(nil) +} + +// UnsetType ensures that no value is present for Type, not even an explicit nil +func (o *FindRulesHasReferenceParameter) UnsetType() { + o.Type.Unset() } func (o FindRulesHasReferenceParameter) MarshalJSON() ([]byte, error) { @@ -114,11 +136,11 @@ func (o FindRulesHasReferenceParameter) MarshalJSON() ([]byte, error) { func (o FindRulesHasReferenceParameter) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() } - if !IsNil(o.Type) { - toSerialize["type"] = o.Type + if o.Type.IsSet() { + toSerialize["type"] = o.Type.Get() } return toSerialize, nil } diff --git a/generated/alerting/model_get_alerting_health_200_response.go b/generated/alerting/model_get_alerting_health_200_response.go index a8df7a576..eb8617e26 100644 --- a/generated/alerting/model_get_alerting_health_200_response.go +++ b/generated/alerting/model_get_alerting_health_200_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,6 @@ var _ MappedNullable = &GetAlertingHealth200Response{} // GetAlertingHealth200Response struct for GetAlertingHealth200Response type GetAlertingHealth200Response struct { - // Deprecated - AlertingFrameworkHeath *GetAlertingHealth200ResponseAlertingFrameworkHeath `json:"alerting_framework_heath,omitempty"` AlertingFrameworkHealth *GetAlertingHealth200ResponseAlertingFrameworkHealth `json:"alerting_framework_health,omitempty"` // If `false`, the encrypted saved object plugin does not have a permanent encryption key. HasPermanentEncryptionKey *bool `json:"has_permanent_encryption_key,omitempty"` @@ -45,41 +43,6 @@ func NewGetAlertingHealth200ResponseWithDefaults() *GetAlertingHealth200Response return &this } -// GetAlertingFrameworkHeath returns the AlertingFrameworkHeath field value if set, zero value otherwise. -// Deprecated -func (o *GetAlertingHealth200Response) GetAlertingFrameworkHeath() GetAlertingHealth200ResponseAlertingFrameworkHeath { - if o == nil || IsNil(o.AlertingFrameworkHeath) { - var ret GetAlertingHealth200ResponseAlertingFrameworkHeath - return ret - } - return *o.AlertingFrameworkHeath -} - -// GetAlertingFrameworkHeathOk returns a tuple with the AlertingFrameworkHeath field value if set, nil otherwise -// and a boolean to check if the value has been set. -// Deprecated -func (o *GetAlertingHealth200Response) GetAlertingFrameworkHeathOk() (*GetAlertingHealth200ResponseAlertingFrameworkHeath, bool) { - if o == nil || IsNil(o.AlertingFrameworkHeath) { - return nil, false - } - return o.AlertingFrameworkHeath, true -} - -// HasAlertingFrameworkHeath returns a boolean if a field has been set. -func (o *GetAlertingHealth200Response) HasAlertingFrameworkHeath() bool { - if o != nil && !IsNil(o.AlertingFrameworkHeath) { - return true - } - - return false -} - -// SetAlertingFrameworkHeath gets a reference to the given GetAlertingHealth200ResponseAlertingFrameworkHeath and assigns it to the AlertingFrameworkHeath field. -// Deprecated -func (o *GetAlertingHealth200Response) SetAlertingFrameworkHeath(v GetAlertingHealth200ResponseAlertingFrameworkHeath) { - o.AlertingFrameworkHeath = &v -} - // GetAlertingFrameworkHealth returns the AlertingFrameworkHealth field value if set, zero value otherwise. func (o *GetAlertingHealth200Response) GetAlertingFrameworkHealth() GetAlertingHealth200ResponseAlertingFrameworkHealth { if o == nil || IsNil(o.AlertingFrameworkHealth) { @@ -186,9 +149,6 @@ func (o GetAlertingHealth200Response) MarshalJSON() ([]byte, error) { func (o GetAlertingHealth200Response) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.AlertingFrameworkHeath) { - toSerialize["alerting_framework_heath"] = o.AlertingFrameworkHeath - } if !IsNil(o.AlertingFrameworkHealth) { toSerialize["alerting_framework_health"] = o.AlertingFrameworkHealth } diff --git a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health.go b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health.go index 02ee51b11..c97fac4a1 100644 --- a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health.go +++ b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_decryption_health.go b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_decryption_health.go index 882b578cc..883874aba 100644 --- a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_decryption_health.go +++ b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_decryption_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_execution_health.go b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_execution_health.go index 16eaf8ebe..1d4037253 100644 --- a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_execution_health.go +++ b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_execution_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_read_health.go b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_read_health.go index 4683fba54..20adbe417 100644 --- a/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_read_health.go +++ b/generated/alerting/model_get_alerting_health_200_response_alerting_framework_health_read_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_get_rule_types_200_response_inner.go b/generated/alerting/model_get_rule_types_200_response_inner.go index 98f7b944f..0cb0a4e8d 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner.go +++ b/generated/alerting/model_get_rule_types_200_response_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,16 +19,21 @@ var _ MappedNullable = &GetRuleTypes200ResponseInner{} // GetRuleTypes200ResponseInner struct for GetRuleTypes200ResponseInner type GetRuleTypes200ResponseInner struct { - // An explicit list of groups for which the rule type can schedule actions, each with the action group's unique ID and human readable name. Rule actions validation uses this configuration to ensure that groups are valid. ActionGroups []GetRuleTypes200ResponseInnerActionGroupsInner `json:"action_groups,omitempty"` ActionVariables *GetRuleTypes200ResponseInnerActionVariables `json:"action_variables,omitempty"` + Alerts *GetRuleTypes200ResponseInnerAlerts `json:"alerts,omitempty"` AuthorizedConsumers *GetRuleTypes200ResponseInnerAuthorizedConsumers `json:"authorized_consumers,omitempty"` + // The rule category, which is used by features such as category-specific maintenance windows. + Category *string `json:"category,omitempty"` // The default identifier for the rule type group. DefaultActionGroupId *string `json:"default_action_group_id,omitempty"` // Indicates whether the rule passes context variables to its recovery action. DoesSetRecoveryContext *bool `json:"does_set_recovery_context,omitempty"` // Indicates whether the rule type is enabled or disabled based on the subscription. EnabledInLicense *bool `json:"enabled_in_license,omitempty"` + // Indicates whether the rule type has custom mappings for the alert data. + HasAlertsMappings *bool `json:"has_alerts_mappings,omitempty"` + HasFieldsForAAD *bool `json:"has_fields_for_a_a_d,omitempty"` // The unique identifier for the rule type. Id *string `json:"id,omitempty"` // Indicates whether the rule type is exportable in **Stack Management > Saved Objects**. @@ -124,6 +129,38 @@ func (o *GetRuleTypes200ResponseInner) SetActionVariables(v GetRuleTypes200Respo o.ActionVariables = &v } +// GetAlerts returns the Alerts field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInner) GetAlerts() GetRuleTypes200ResponseInnerAlerts { + if o == nil || IsNil(o.Alerts) { + var ret GetRuleTypes200ResponseInnerAlerts + return ret + } + return *o.Alerts +} + +// GetAlertsOk returns a tuple with the Alerts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInner) GetAlertsOk() (*GetRuleTypes200ResponseInnerAlerts, bool) { + if o == nil || IsNil(o.Alerts) { + return nil, false + } + return o.Alerts, true +} + +// HasAlerts returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInner) HasAlerts() bool { + if o != nil && !IsNil(o.Alerts) { + return true + } + + return false +} + +// SetAlerts gets a reference to the given GetRuleTypes200ResponseInnerAlerts and assigns it to the Alerts field. +func (o *GetRuleTypes200ResponseInner) SetAlerts(v GetRuleTypes200ResponseInnerAlerts) { + o.Alerts = &v +} + // GetAuthorizedConsumers returns the AuthorizedConsumers field value if set, zero value otherwise. func (o *GetRuleTypes200ResponseInner) GetAuthorizedConsumers() GetRuleTypes200ResponseInnerAuthorizedConsumers { if o == nil || IsNil(o.AuthorizedConsumers) { @@ -156,6 +193,38 @@ func (o *GetRuleTypes200ResponseInner) SetAuthorizedConsumers(v GetRuleTypes200R o.AuthorizedConsumers = &v } +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInner) GetCategory() string { + if o == nil || IsNil(o.Category) { + var ret string + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInner) GetCategoryOk() (*string, bool) { + if o == nil || IsNil(o.Category) { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInner) HasCategory() bool { + if o != nil && !IsNil(o.Category) { + return true + } + + return false +} + +// SetCategory gets a reference to the given string and assigns it to the Category field. +func (o *GetRuleTypes200ResponseInner) SetCategory(v string) { + o.Category = &v +} + // GetDefaultActionGroupId returns the DefaultActionGroupId field value if set, zero value otherwise. func (o *GetRuleTypes200ResponseInner) GetDefaultActionGroupId() string { if o == nil || IsNil(o.DefaultActionGroupId) { @@ -252,6 +321,70 @@ func (o *GetRuleTypes200ResponseInner) SetEnabledInLicense(v bool) { o.EnabledInLicense = &v } +// GetHasAlertsMappings returns the HasAlertsMappings field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInner) GetHasAlertsMappings() bool { + if o == nil || IsNil(o.HasAlertsMappings) { + var ret bool + return ret + } + return *o.HasAlertsMappings +} + +// GetHasAlertsMappingsOk returns a tuple with the HasAlertsMappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInner) GetHasAlertsMappingsOk() (*bool, bool) { + if o == nil || IsNil(o.HasAlertsMappings) { + return nil, false + } + return o.HasAlertsMappings, true +} + +// HasHasAlertsMappings returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInner) HasHasAlertsMappings() bool { + if o != nil && !IsNil(o.HasAlertsMappings) { + return true + } + + return false +} + +// SetHasAlertsMappings gets a reference to the given bool and assigns it to the HasAlertsMappings field. +func (o *GetRuleTypes200ResponseInner) SetHasAlertsMappings(v bool) { + o.HasAlertsMappings = &v +} + +// GetHasFieldsForAAD returns the HasFieldsForAAD field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInner) GetHasFieldsForAAD() bool { + if o == nil || IsNil(o.HasFieldsForAAD) { + var ret bool + return ret + } + return *o.HasFieldsForAAD +} + +// GetHasFieldsForAADOk returns a tuple with the HasFieldsForAAD field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInner) GetHasFieldsForAADOk() (*bool, bool) { + if o == nil || IsNil(o.HasFieldsForAAD) { + return nil, false + } + return o.HasFieldsForAAD, true +} + +// HasHasFieldsForAAD returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInner) HasHasFieldsForAAD() bool { + if o != nil && !IsNil(o.HasFieldsForAAD) { + return true + } + + return false +} + +// SetHasFieldsForAAD gets a reference to the given bool and assigns it to the HasFieldsForAAD field. +func (o *GetRuleTypes200ResponseInner) SetHasFieldsForAAD(v bool) { + o.HasFieldsForAAD = &v +} + // GetId returns the Id field value if set, zero value otherwise. func (o *GetRuleTypes200ResponseInner) GetId() string { if o == nil || IsNil(o.Id) { @@ -492,9 +625,15 @@ func (o GetRuleTypes200ResponseInner) ToMap() (map[string]interface{}, error) { if !IsNil(o.ActionVariables) { toSerialize["action_variables"] = o.ActionVariables } + if !IsNil(o.Alerts) { + toSerialize["alerts"] = o.Alerts + } if !IsNil(o.AuthorizedConsumers) { toSerialize["authorized_consumers"] = o.AuthorizedConsumers } + if !IsNil(o.Category) { + toSerialize["category"] = o.Category + } if !IsNil(o.DefaultActionGroupId) { toSerialize["default_action_group_id"] = o.DefaultActionGroupId } @@ -504,6 +643,12 @@ func (o GetRuleTypes200ResponseInner) ToMap() (map[string]interface{}, error) { if !IsNil(o.EnabledInLicense) { toSerialize["enabled_in_license"] = o.EnabledInLicense } + if !IsNil(o.HasAlertsMappings) { + toSerialize["has_alerts_mappings"] = o.HasAlertsMappings + } + if !IsNil(o.HasFieldsForAAD) { + toSerialize["has_fields_for_a_a_d"] = o.HasFieldsForAAD + } if !IsNil(o.Id) { toSerialize["id"] = o.Id } diff --git a/generated/alerting/model_get_rule_types_200_response_inner_action_groups_inner.go b/generated/alerting/model_get_rule_types_200_response_inner_action_groups_inner.go index 12bd6bfbe..fc9da6c02 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_action_groups_inner.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_action_groups_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,8 @@ var _ MappedNullable = &GetRuleTypes200ResponseInnerActionGroupsInner{} // GetRuleTypes200ResponseInnerActionGroupsInner struct for GetRuleTypes200ResponseInnerActionGroupsInner type GetRuleTypes200ResponseInnerActionGroupsInner struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` + Id NullableString `json:"id,omitempty"` + Name NullableString `json:"name,omitempty"` } // NewGetRuleTypes200ResponseInnerActionGroupsInner instantiates a new GetRuleTypes200ResponseInnerActionGroupsInner object @@ -40,68 +40,90 @@ func NewGetRuleTypes200ResponseInnerActionGroupsInnerWithDefaults() *GetRuleType return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionGroupsInner) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil || IsNil(o.Id.Get()) { var ret string return ret } - return *o.Id + return *o.Id.Get() } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionGroupsInner) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true + return o.Id.Get(), o.Id.IsSet() } // HasId returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionGroupsInner) HasId() bool { - if o != nil && !IsNil(o.Id) { + if o != nil && o.Id.IsSet() { return true } return false } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId gets a reference to the given NullableString and assigns it to the Id field. func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetId(v string) { - o.Id = &v + o.Id.Set(&v) } -// GetName returns the Name field value if set, zero value otherwise. +// SetIdNil sets the value for Id to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionGroupsInner) UnsetId() { + o.Id.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionGroupsInner) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil || IsNil(o.Name.Get()) { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionGroupsInner) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionGroupsInner) HasName() bool { - if o != nil && !IsNil(o.Name) { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetName(v string) { - o.Name = &v + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionGroupsInner) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionGroupsInner) UnsetName() { + o.Name.Unset() } func (o GetRuleTypes200ResponseInnerActionGroupsInner) MarshalJSON() ([]byte, error) { @@ -114,11 +136,11 @@ func (o GetRuleTypes200ResponseInnerActionGroupsInner) MarshalJSON() ([]byte, er func (o GetRuleTypes200ResponseInnerActionGroupsInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } return toSerialize, nil } diff --git a/generated/alerting/model_get_rule_types_200_response_inner_action_variables.go b/generated/alerting/model_get_rule_types_200_response_inner_action_variables.go index 6406265d0..5173c7574 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_action_variables.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_action_variables.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -21,7 +21,7 @@ var _ MappedNullable = &GetRuleTypes200ResponseInnerActionVariables{} type GetRuleTypes200ResponseInnerActionVariables struct { Context []GetRuleTypes200ResponseInnerActionVariablesContextInner `json:"context,omitempty"` Params []GetRuleTypes200ResponseInnerActionVariablesParamsInner `json:"params,omitempty"` - State []GetRuleTypes200ResponseInnerActionVariablesParamsInner `json:"state,omitempty"` + State []GetRuleTypes200ResponseInnerActionVariablesStateInner `json:"state,omitempty"` } // NewGetRuleTypes200ResponseInnerActionVariables instantiates a new GetRuleTypes200ResponseInnerActionVariables object @@ -106,9 +106,9 @@ func (o *GetRuleTypes200ResponseInnerActionVariables) SetParams(v []GetRuleTypes } // GetState returns the State field value if set, zero value otherwise. -func (o *GetRuleTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesParamsInner { +func (o *GetRuleTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesStateInner { if o == nil || IsNil(o.State) { - var ret []GetRuleTypes200ResponseInnerActionVariablesParamsInner + var ret []GetRuleTypes200ResponseInnerActionVariablesStateInner return ret } return o.State @@ -116,7 +116,7 @@ func (o *GetRuleTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes2 // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *GetRuleTypes200ResponseInnerActionVariables) GetStateOk() ([]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool) { +func (o *GetRuleTypes200ResponseInnerActionVariables) GetStateOk() ([]GetRuleTypes200ResponseInnerActionVariablesStateInner, bool) { if o == nil || IsNil(o.State) { return nil, false } @@ -132,8 +132,8 @@ func (o *GetRuleTypes200ResponseInnerActionVariables) HasState() bool { return false } -// SetState gets a reference to the given []GetRuleTypes200ResponseInnerActionVariablesParamsInner and assigns it to the State field. -func (o *GetRuleTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner) { +// SetState gets a reference to the given []GetRuleTypes200ResponseInnerActionVariablesStateInner and assigns it to the State field. +func (o *GetRuleTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesStateInner) { o.State = v } diff --git a/generated/alerting/model_get_rule_types_200_response_inner_action_variables_context_inner.go b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_context_inner.go index 59eaccc0a..f1010c09c 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_action_variables_context_inner.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_context_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,9 +19,9 @@ var _ MappedNullable = &GetRuleTypes200ResponseInnerActionVariablesContextInner{ // GetRuleTypes200ResponseInnerActionVariablesContextInner struct for GetRuleTypes200ResponseInnerActionVariablesContextInner type GetRuleTypes200ResponseInnerActionVariablesContextInner struct { - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - UseWithTripleBracesInTemplates *bool `json:"useWithTripleBracesInTemplates,omitempty"` + Name NullableString `json:"name,omitempty"` + Description NullableString `json:"description,omitempty"` + UseWithTripleBracesInTemplates *bool `json:"useWithTripleBracesInTemplates,omitempty"` } // NewGetRuleTypes200ResponseInnerActionVariablesContextInner instantiates a new GetRuleTypes200ResponseInnerActionVariablesContextInner object @@ -41,68 +41,90 @@ func NewGetRuleTypes200ResponseInnerActionVariablesContextInnerWithDefaults() *G return &this } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil || IsNil(o.Name.Get()) { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) HasName() bool { - if o != nil && !IsNil(o.Name) { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetName(v string) { - o.Name = &v + o.Name.Set(&v) } -// GetDescription returns the Description field value if set, zero value otherwise. +// SetNameNil sets the value for Name to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) UnsetName() { + o.Name.Unset() +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetDescription() string { - if o == nil || IsNil(o.Description) { + if o == nil || IsNil(o.Description.Get()) { var ret string return ret } - return *o.Description + return *o.Description.Get() } // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { + if o == nil { return nil, false } - return o.Description, true + return o.Description.Get(), o.Description.IsSet() } // HasDescription returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) HasDescription() bool { - if o != nil && !IsNil(o.Description) { + if o != nil && o.Description.IsSet() { return true } return false } -// SetDescription gets a reference to the given string and assigns it to the Description field. +// SetDescription gets a reference to the given NullableString and assigns it to the Description field. func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetDescription(v string) { - o.Description = &v + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesContextInner) UnsetDescription() { + o.Description.Unset() } // GetUseWithTripleBracesInTemplates returns the UseWithTripleBracesInTemplates field value if set, zero value otherwise. @@ -147,11 +169,11 @@ func (o GetRuleTypes200ResponseInnerActionVariablesContextInner) MarshalJSON() ( func (o GetRuleTypes200ResponseInnerActionVariablesContextInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } - if !IsNil(o.Description) { - toSerialize["description"] = o.Description + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() } if !IsNil(o.UseWithTripleBracesInTemplates) { toSerialize["useWithTripleBracesInTemplates"] = o.UseWithTripleBracesInTemplates diff --git a/generated/alerting/model_get_rule_types_200_response_inner_action_variables_params_inner.go b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_params_inner.go index 5136020cb..f8ea2131a 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_action_variables_params_inner.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_params_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,8 @@ var _ MappedNullable = &GetRuleTypes200ResponseInnerActionVariablesParamsInner{} // GetRuleTypes200ResponseInnerActionVariablesParamsInner struct for GetRuleTypes200ResponseInnerActionVariablesParamsInner type GetRuleTypes200ResponseInnerActionVariablesParamsInner struct { - Description *string `json:"description,omitempty"` - Name *string `json:"name,omitempty"` + Description NullableString `json:"description,omitempty"` + Name NullableString `json:"name,omitempty"` } // NewGetRuleTypes200ResponseInnerActionVariablesParamsInner instantiates a new GetRuleTypes200ResponseInnerActionVariablesParamsInner object @@ -40,68 +40,90 @@ func NewGetRuleTypes200ResponseInnerActionVariablesParamsInnerWithDefaults() *Ge return &this } -// GetDescription returns the Description field value if set, zero value otherwise. +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) GetDescription() string { - if o == nil || IsNil(o.Description) { + if o == nil || IsNil(o.Description.Get()) { var ret string return ret } - return *o.Description + return *o.Description.Get() } // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { + if o == nil { return nil, false } - return o.Description, true + return o.Description.Get(), o.Description.IsSet() } // HasDescription returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) HasDescription() bool { - if o != nil && !IsNil(o.Description) { + if o != nil && o.Description.IsSet() { return true } return false } -// SetDescription gets a reference to the given string and assigns it to the Description field. +// SetDescription gets a reference to the given NullableString and assigns it to the Description field. func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetDescription(v string) { - o.Description = &v + o.Description.Set(&v) } -// GetName returns the Name field value if set, zero value otherwise. +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) UnsetDescription() { + o.Description.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil || IsNil(o.Name.Get()) { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) HasName() bool { - if o != nil && !IsNil(o.Name) { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetName(v string) { - o.Name = &v + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerActionVariablesParamsInner) UnsetName() { + o.Name.Unset() } func (o GetRuleTypes200ResponseInnerActionVariablesParamsInner) MarshalJSON() ([]byte, error) { @@ -114,11 +136,11 @@ func (o GetRuleTypes200ResponseInnerActionVariablesParamsInner) MarshalJSON() ([ func (o GetRuleTypes200ResponseInnerActionVariablesParamsInner) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Description) { - toSerialize["description"] = o.Description + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } return toSerialize, nil } diff --git a/generated/alerting/model_get_rule_types_200_response_inner_action_variables_state_inner.go b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_state_inner.go new file mode 100644 index 000000000..773c15f58 --- /dev/null +++ b/generated/alerting/model_get_rule_types_200_response_inner_action_variables_state_inner.go @@ -0,0 +1,160 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the GetRuleTypes200ResponseInnerActionVariablesStateInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetRuleTypes200ResponseInnerActionVariablesStateInner{} + +// GetRuleTypes200ResponseInnerActionVariablesStateInner struct for GetRuleTypes200ResponseInnerActionVariablesStateInner +type GetRuleTypes200ResponseInnerActionVariablesStateInner struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewGetRuleTypes200ResponseInnerActionVariablesStateInner instantiates a new GetRuleTypes200ResponseInnerActionVariablesStateInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetRuleTypes200ResponseInnerActionVariablesStateInner() *GetRuleTypes200ResponseInnerActionVariablesStateInner { + this := GetRuleTypes200ResponseInnerActionVariablesStateInner{} + return &this +} + +// NewGetRuleTypes200ResponseInnerActionVariablesStateInnerWithDefaults instantiates a new GetRuleTypes200ResponseInnerActionVariablesStateInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetRuleTypes200ResponseInnerActionVariablesStateInnerWithDefaults() *GetRuleTypes200ResponseInnerActionVariablesStateInner { + this := GetRuleTypes200ResponseInnerActionVariablesStateInner{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetRuleTypes200ResponseInnerActionVariablesStateInner) SetName(v string) { + o.Name = &v +} + +func (o GetRuleTypes200ResponseInnerActionVariablesStateInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetRuleTypes200ResponseInnerActionVariablesStateInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableGetRuleTypes200ResponseInnerActionVariablesStateInner struct { + value *GetRuleTypes200ResponseInnerActionVariablesStateInner + isSet bool +} + +func (v NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) Get() *GetRuleTypes200ResponseInnerActionVariablesStateInner { + return v.value +} + +func (v *NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) Set(val *GetRuleTypes200ResponseInnerActionVariablesStateInner) { + v.value = val + v.isSet = true +} + +func (v NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) IsSet() bool { + return v.isSet +} + +func (v *NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetRuleTypes200ResponseInnerActionVariablesStateInner(val *GetRuleTypes200ResponseInnerActionVariablesStateInner) *NullableGetRuleTypes200ResponseInnerActionVariablesStateInner { + return &NullableGetRuleTypes200ResponseInnerActionVariablesStateInner{value: val, isSet: true} +} + +func (v NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetRuleTypes200ResponseInnerActionVariablesStateInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_get_rule_types_200_response_inner_alerts.go b/generated/alerting/model_get_rule_types_200_response_inner_alerts.go new file mode 100644 index 000000000..496c1f25c --- /dev/null +++ b/generated/alerting/model_get_rule_types_200_response_inner_alerts.go @@ -0,0 +1,387 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the GetRuleTypes200ResponseInnerAlerts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetRuleTypes200ResponseInnerAlerts{} + +// GetRuleTypes200ResponseInnerAlerts Details for writing alerts as data documents for this rule type. +type GetRuleTypes200ResponseInnerAlerts struct { + // The namespace for this rule type. + Context *string `json:"context,omitempty"` + // Indicates whether new fields are added dynamically. + Dynamic *string `json:"dynamic,omitempty"` + // Indicates whether the alerts are space-aware. If true, space-specific alert indices are used. + IsSpaceAware *bool `json:"isSpaceAware,omitempty"` + Mappings *GetRuleTypes200ResponseInnerAlertsMappings `json:"mappings,omitempty"` + // A secondary alias. It is typically used to support the signals alias for detection rules. + SecondaryAlias *string `json:"secondaryAlias,omitempty"` + // Indicates whether the rule should write out alerts as data. + ShouldWrite *bool `json:"shouldWrite,omitempty"` + // Indicates whether to include the ECS component template for the alerts. + UseEcs *bool `json:"useEcs,omitempty"` + // Indicates whether to include the legacy component template for the alerts. + UseLegacyAlerts *bool `json:"useLegacyAlerts,omitempty"` +} + +// NewGetRuleTypes200ResponseInnerAlerts instantiates a new GetRuleTypes200ResponseInnerAlerts object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetRuleTypes200ResponseInnerAlerts() *GetRuleTypes200ResponseInnerAlerts { + this := GetRuleTypes200ResponseInnerAlerts{} + var useLegacyAlerts bool = false + this.UseLegacyAlerts = &useLegacyAlerts + return &this +} + +// NewGetRuleTypes200ResponseInnerAlertsWithDefaults instantiates a new GetRuleTypes200ResponseInnerAlerts object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetRuleTypes200ResponseInnerAlertsWithDefaults() *GetRuleTypes200ResponseInnerAlerts { + this := GetRuleTypes200ResponseInnerAlerts{} + var useLegacyAlerts bool = false + this.UseLegacyAlerts = &useLegacyAlerts + return &this +} + +// GetContext returns the Context field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetContext() string { + if o == nil || IsNil(o.Context) { + var ret string + return ret + } + return *o.Context +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetContextOk() (*string, bool) { + if o == nil || IsNil(o.Context) { + return nil, false + } + return o.Context, true +} + +// HasContext returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasContext() bool { + if o != nil && !IsNil(o.Context) { + return true + } + + return false +} + +// SetContext gets a reference to the given string and assigns it to the Context field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetContext(v string) { + o.Context = &v +} + +// GetDynamic returns the Dynamic field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetDynamic() string { + if o == nil || IsNil(o.Dynamic) { + var ret string + return ret + } + return *o.Dynamic +} + +// GetDynamicOk returns a tuple with the Dynamic field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetDynamicOk() (*string, bool) { + if o == nil || IsNil(o.Dynamic) { + return nil, false + } + return o.Dynamic, true +} + +// HasDynamic returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasDynamic() bool { + if o != nil && !IsNil(o.Dynamic) { + return true + } + + return false +} + +// SetDynamic gets a reference to the given string and assigns it to the Dynamic field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetDynamic(v string) { + o.Dynamic = &v +} + +// GetIsSpaceAware returns the IsSpaceAware field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetIsSpaceAware() bool { + if o == nil || IsNil(o.IsSpaceAware) { + var ret bool + return ret + } + return *o.IsSpaceAware +} + +// GetIsSpaceAwareOk returns a tuple with the IsSpaceAware field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetIsSpaceAwareOk() (*bool, bool) { + if o == nil || IsNil(o.IsSpaceAware) { + return nil, false + } + return o.IsSpaceAware, true +} + +// HasIsSpaceAware returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasIsSpaceAware() bool { + if o != nil && !IsNil(o.IsSpaceAware) { + return true + } + + return false +} + +// SetIsSpaceAware gets a reference to the given bool and assigns it to the IsSpaceAware field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetIsSpaceAware(v bool) { + o.IsSpaceAware = &v +} + +// GetMappings returns the Mappings field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetMappings() GetRuleTypes200ResponseInnerAlertsMappings { + if o == nil || IsNil(o.Mappings) { + var ret GetRuleTypes200ResponseInnerAlertsMappings + return ret + } + return *o.Mappings +} + +// GetMappingsOk returns a tuple with the Mappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetMappingsOk() (*GetRuleTypes200ResponseInnerAlertsMappings, bool) { + if o == nil || IsNil(o.Mappings) { + return nil, false + } + return o.Mappings, true +} + +// HasMappings returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasMappings() bool { + if o != nil && !IsNil(o.Mappings) { + return true + } + + return false +} + +// SetMappings gets a reference to the given GetRuleTypes200ResponseInnerAlertsMappings and assigns it to the Mappings field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetMappings(v GetRuleTypes200ResponseInnerAlertsMappings) { + o.Mappings = &v +} + +// GetSecondaryAlias returns the SecondaryAlias field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetSecondaryAlias() string { + if o == nil || IsNil(o.SecondaryAlias) { + var ret string + return ret + } + return *o.SecondaryAlias +} + +// GetSecondaryAliasOk returns a tuple with the SecondaryAlias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetSecondaryAliasOk() (*string, bool) { + if o == nil || IsNil(o.SecondaryAlias) { + return nil, false + } + return o.SecondaryAlias, true +} + +// HasSecondaryAlias returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasSecondaryAlias() bool { + if o != nil && !IsNil(o.SecondaryAlias) { + return true + } + + return false +} + +// SetSecondaryAlias gets a reference to the given string and assigns it to the SecondaryAlias field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetSecondaryAlias(v string) { + o.SecondaryAlias = &v +} + +// GetShouldWrite returns the ShouldWrite field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetShouldWrite() bool { + if o == nil || IsNil(o.ShouldWrite) { + var ret bool + return ret + } + return *o.ShouldWrite +} + +// GetShouldWriteOk returns a tuple with the ShouldWrite field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetShouldWriteOk() (*bool, bool) { + if o == nil || IsNil(o.ShouldWrite) { + return nil, false + } + return o.ShouldWrite, true +} + +// HasShouldWrite returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasShouldWrite() bool { + if o != nil && !IsNil(o.ShouldWrite) { + return true + } + + return false +} + +// SetShouldWrite gets a reference to the given bool and assigns it to the ShouldWrite field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetShouldWrite(v bool) { + o.ShouldWrite = &v +} + +// GetUseEcs returns the UseEcs field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetUseEcs() bool { + if o == nil || IsNil(o.UseEcs) { + var ret bool + return ret + } + return *o.UseEcs +} + +// GetUseEcsOk returns a tuple with the UseEcs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetUseEcsOk() (*bool, bool) { + if o == nil || IsNil(o.UseEcs) { + return nil, false + } + return o.UseEcs, true +} + +// HasUseEcs returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasUseEcs() bool { + if o != nil && !IsNil(o.UseEcs) { + return true + } + + return false +} + +// SetUseEcs gets a reference to the given bool and assigns it to the UseEcs field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetUseEcs(v bool) { + o.UseEcs = &v +} + +// GetUseLegacyAlerts returns the UseLegacyAlerts field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAlerts) GetUseLegacyAlerts() bool { + if o == nil || IsNil(o.UseLegacyAlerts) { + var ret bool + return ret + } + return *o.UseLegacyAlerts +} + +// GetUseLegacyAlertsOk returns a tuple with the UseLegacyAlerts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) GetUseLegacyAlertsOk() (*bool, bool) { + if o == nil || IsNil(o.UseLegacyAlerts) { + return nil, false + } + return o.UseLegacyAlerts, true +} + +// HasUseLegacyAlerts returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlerts) HasUseLegacyAlerts() bool { + if o != nil && !IsNil(o.UseLegacyAlerts) { + return true + } + + return false +} + +// SetUseLegacyAlerts gets a reference to the given bool and assigns it to the UseLegacyAlerts field. +func (o *GetRuleTypes200ResponseInnerAlerts) SetUseLegacyAlerts(v bool) { + o.UseLegacyAlerts = &v +} + +func (o GetRuleTypes200ResponseInnerAlerts) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetRuleTypes200ResponseInnerAlerts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Context) { + toSerialize["context"] = o.Context + } + if !IsNil(o.Dynamic) { + toSerialize["dynamic"] = o.Dynamic + } + if !IsNil(o.IsSpaceAware) { + toSerialize["isSpaceAware"] = o.IsSpaceAware + } + if !IsNil(o.Mappings) { + toSerialize["mappings"] = o.Mappings + } + if !IsNil(o.SecondaryAlias) { + toSerialize["secondaryAlias"] = o.SecondaryAlias + } + if !IsNil(o.ShouldWrite) { + toSerialize["shouldWrite"] = o.ShouldWrite + } + if !IsNil(o.UseEcs) { + toSerialize["useEcs"] = o.UseEcs + } + if !IsNil(o.UseLegacyAlerts) { + toSerialize["useLegacyAlerts"] = o.UseLegacyAlerts + } + return toSerialize, nil +} + +type NullableGetRuleTypes200ResponseInnerAlerts struct { + value *GetRuleTypes200ResponseInnerAlerts + isSet bool +} + +func (v NullableGetRuleTypes200ResponseInnerAlerts) Get() *GetRuleTypes200ResponseInnerAlerts { + return v.value +} + +func (v *NullableGetRuleTypes200ResponseInnerAlerts) Set(val *GetRuleTypes200ResponseInnerAlerts) { + v.value = val + v.isSet = true +} + +func (v NullableGetRuleTypes200ResponseInnerAlerts) IsSet() bool { + return v.isSet +} + +func (v *NullableGetRuleTypes200ResponseInnerAlerts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetRuleTypes200ResponseInnerAlerts(val *GetRuleTypes200ResponseInnerAlerts) *NullableGetRuleTypes200ResponseInnerAlerts { + return &NullableGetRuleTypes200ResponseInnerAlerts{value: val, isSet: true} +} + +func (v NullableGetRuleTypes200ResponseInnerAlerts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetRuleTypes200ResponseInnerAlerts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_get_rule_types_200_response_inner_alerts_mappings.go b/generated/alerting/model_get_rule_types_200_response_inner_alerts_mappings.go new file mode 100644 index 000000000..a88253f92 --- /dev/null +++ b/generated/alerting/model_get_rule_types_200_response_inner_alerts_mappings.go @@ -0,0 +1,126 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the GetRuleTypes200ResponseInnerAlertsMappings type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetRuleTypes200ResponseInnerAlertsMappings{} + +// GetRuleTypes200ResponseInnerAlertsMappings struct for GetRuleTypes200ResponseInnerAlertsMappings +type GetRuleTypes200ResponseInnerAlertsMappings struct { + // Mapping information for each field supported in alerts as data documents for this rule type. For more information about mapping parameters, refer to the Elasticsearch documentation. + FieldMap map[string]FieldmapProperties `json:"fieldMap,omitempty"` +} + +// NewGetRuleTypes200ResponseInnerAlertsMappings instantiates a new GetRuleTypes200ResponseInnerAlertsMappings object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetRuleTypes200ResponseInnerAlertsMappings() *GetRuleTypes200ResponseInnerAlertsMappings { + this := GetRuleTypes200ResponseInnerAlertsMappings{} + return &this +} + +// NewGetRuleTypes200ResponseInnerAlertsMappingsWithDefaults instantiates a new GetRuleTypes200ResponseInnerAlertsMappings object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetRuleTypes200ResponseInnerAlertsMappingsWithDefaults() *GetRuleTypes200ResponseInnerAlertsMappings { + this := GetRuleTypes200ResponseInnerAlertsMappings{} + return &this +} + +// GetFieldMap returns the FieldMap field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GetRuleTypes200ResponseInnerAlertsMappings) GetFieldMap() map[string]FieldmapProperties { + if o == nil { + var ret map[string]FieldmapProperties + return ret + } + return o.FieldMap +} + +// GetFieldMapOk returns a tuple with the FieldMap field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetRuleTypes200ResponseInnerAlertsMappings) GetFieldMapOk() (*map[string]FieldmapProperties, bool) { + if o == nil || IsNil(o.FieldMap) { + return nil, false + } + return &o.FieldMap, true +} + +// HasFieldMap returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAlertsMappings) HasFieldMap() bool { + if o != nil && IsNil(o.FieldMap) { + return true + } + + return false +} + +// SetFieldMap gets a reference to the given map[string]FieldmapProperties and assigns it to the FieldMap field. +func (o *GetRuleTypes200ResponseInnerAlertsMappings) SetFieldMap(v map[string]FieldmapProperties) { + o.FieldMap = v +} + +func (o GetRuleTypes200ResponseInnerAlertsMappings) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetRuleTypes200ResponseInnerAlertsMappings) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.FieldMap != nil { + toSerialize["fieldMap"] = o.FieldMap + } + return toSerialize, nil +} + +type NullableGetRuleTypes200ResponseInnerAlertsMappings struct { + value *GetRuleTypes200ResponseInnerAlertsMappings + isSet bool +} + +func (v NullableGetRuleTypes200ResponseInnerAlertsMappings) Get() *GetRuleTypes200ResponseInnerAlertsMappings { + return v.value +} + +func (v *NullableGetRuleTypes200ResponseInnerAlertsMappings) Set(val *GetRuleTypes200ResponseInnerAlertsMappings) { + v.value = val + v.isSet = true +} + +func (v NullableGetRuleTypes200ResponseInnerAlertsMappings) IsSet() bool { + return v.isSet +} + +func (v *NullableGetRuleTypes200ResponseInnerAlertsMappings) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetRuleTypes200ResponseInnerAlertsMappings(val *GetRuleTypes200ResponseInnerAlertsMappings) *NullableGetRuleTypes200ResponseInnerAlertsMappings { + return &NullableGetRuleTypes200ResponseInnerAlertsMappings{value: val, isSet: true} +} + +func (v NullableGetRuleTypes200ResponseInnerAlertsMappings) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetRuleTypes200ResponseInnerAlertsMappings) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers.go b/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers.go index 21f8675a4..b10c72a8b 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,6 +27,7 @@ type GetRuleTypes200ResponseInnerAuthorizedConsumers struct { Ml *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"ml,omitempty"` Monitoring *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"monitoring,omitempty"` Siem *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"siem,omitempty"` + Slo *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"slo,omitempty"` StackAlerts *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"stackAlerts,omitempty"` Uptime *GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts `json:"uptime,omitempty"` } @@ -304,6 +305,38 @@ func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) SetSiem(v GetRuleTypes o.Siem = &v } +// GetSlo returns the Slo field value if set, zero value otherwise. +func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetSlo() GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts { + if o == nil || IsNil(o.Slo) { + var ret GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts + return ret + } + return *o.Slo +} + +// GetSloOk returns a tuple with the Slo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetSloOk() (*GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts, bool) { + if o == nil || IsNil(o.Slo) { + return nil, false + } + return o.Slo, true +} + +// HasSlo returns a boolean if a field has been set. +func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) HasSlo() bool { + if o != nil && !IsNil(o.Slo) { + return true + } + + return false +} + +// SetSlo gets a reference to the given GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts and assigns it to the Slo field. +func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) SetSlo(v GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts) { + o.Slo = &v +} + // GetStackAlerts returns the StackAlerts field value if set, zero value otherwise. func (o *GetRuleTypes200ResponseInnerAuthorizedConsumers) GetStackAlerts() GetRuleTypes200ResponseInnerAuthorizedConsumersAlerts { if o == nil || IsNil(o.StackAlerts) { @@ -402,6 +435,9 @@ func (o GetRuleTypes200ResponseInnerAuthorizedConsumers) ToMap() (map[string]int if !IsNil(o.Siem) { toSerialize["siem"] = o.Siem } + if !IsNil(o.Slo) { + toSerialize["slo"] = o.Slo + } if !IsNil(o.StackAlerts) { toSerialize["stackAlerts"] = o.StackAlerts } diff --git a/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers_alerts.go b/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers_alerts.go index 58d382e84..560f41194 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers_alerts.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_authorized_consumers_alerts.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_get_rule_types_200_response_inner_recovery_action_group.go b/generated/alerting/model_get_rule_types_200_response_inner_recovery_action_group.go index 53e9243bb..f68eb4428 100644 --- a/generated/alerting/model_get_rule_types_200_response_inner_recovery_action_group.go +++ b/generated/alerting/model_get_rule_types_200_response_inner_recovery_action_group.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,8 @@ var _ MappedNullable = &GetRuleTypes200ResponseInnerRecoveryActionGroup{} // GetRuleTypes200ResponseInnerRecoveryActionGroup An action group to use when an alert goes from an active state to an inactive one. type GetRuleTypes200ResponseInnerRecoveryActionGroup struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` + Id NullableString `json:"id,omitempty"` + Name NullableString `json:"name,omitempty"` } // NewGetRuleTypes200ResponseInnerRecoveryActionGroup instantiates a new GetRuleTypes200ResponseInnerRecoveryActionGroup object @@ -40,68 +40,90 @@ func NewGetRuleTypes200ResponseInnerRecoveryActionGroupWithDefaults() *GetRuleTy return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil || IsNil(o.Id.Get()) { var ret string return ret } - return *o.Id + return *o.Id.Get() } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true + return o.Id.Get(), o.Id.IsSet() } // HasId returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) HasId() bool { - if o != nil && !IsNil(o.Id) { + if o != nil && o.Id.IsSet() { return true } return false } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId gets a reference to the given NullableString and assigns it to the Id field. func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetId(v string) { - o.Id = &v + o.Id.Set(&v) } -// GetName returns the Name field value if set, zero value otherwise. +// SetIdNil sets the value for Id to be an explicit nil +func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) UnsetId() { + o.Id.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil || IsNil(o.Name.Get()) { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) HasName() bool { - if o != nil && !IsNil(o.Name) { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetName(v string) { - o.Name = &v + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil +func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *GetRuleTypes200ResponseInnerRecoveryActionGroup) UnsetName() { + o.Name.Unset() } func (o GetRuleTypes200ResponseInnerRecoveryActionGroup) MarshalJSON() ([]byte, error) { @@ -114,11 +136,11 @@ func (o GetRuleTypes200ResponseInnerRecoveryActionGroup) MarshalJSON() ([]byte, func (o GetRuleTypes200ResponseInnerRecoveryActionGroup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } return toSerialize, nil } diff --git a/generated/alerting/model_legacy_create_alert_request_properties.go b/generated/alerting/model_legacy_create_alert_request_properties.go index df02db423..abbe2897f 100644 --- a/generated/alerting/model_legacy_create_alert_request_properties.go +++ b/generated/alerting/model_legacy_create_alert_request_properties.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -32,9 +32,8 @@ type LegacyCreateAlertRequestProperties struct { NotifyWhen string `json:"notifyWhen"` // The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. Params map[string]interface{} `json:"params"` - Schedule LegacyCreateAlertRequestPropertiesSchedule `json:"schedule"` - // A list of keywords to reference and search. - Tags []string `json:"tags,omitempty"` + Schedule LegacyUpdateAlertRequestPropertiesSchedule `json:"schedule"` + Tags []string `json:"tags,omitempty"` // How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. Throttle *string `json:"throttle,omitempty"` } @@ -43,7 +42,7 @@ type LegacyCreateAlertRequestProperties struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewLegacyCreateAlertRequestProperties(alertTypeId string, consumer string, name string, notifyWhen string, params map[string]interface{}, schedule LegacyCreateAlertRequestPropertiesSchedule) *LegacyCreateAlertRequestProperties { +func NewLegacyCreateAlertRequestProperties(alertTypeId string, consumer string, name string, notifyWhen string, params map[string]interface{}, schedule LegacyUpdateAlertRequestPropertiesSchedule) *LegacyCreateAlertRequestProperties { this := LegacyCreateAlertRequestProperties{} this.AlertTypeId = alertTypeId this.Consumer = consumer @@ -247,9 +246,9 @@ func (o *LegacyCreateAlertRequestProperties) SetParams(v map[string]interface{}) } // GetSchedule returns the Schedule field value -func (o *LegacyCreateAlertRequestProperties) GetSchedule() LegacyCreateAlertRequestPropertiesSchedule { +func (o *LegacyCreateAlertRequestProperties) GetSchedule() LegacyUpdateAlertRequestPropertiesSchedule { if o == nil { - var ret LegacyCreateAlertRequestPropertiesSchedule + var ret LegacyUpdateAlertRequestPropertiesSchedule return ret } @@ -258,7 +257,7 @@ func (o *LegacyCreateAlertRequestProperties) GetSchedule() LegacyCreateAlertRequ // GetScheduleOk returns a tuple with the Schedule field value // and a boolean to check if the value has been set. -func (o *LegacyCreateAlertRequestProperties) GetScheduleOk() (*LegacyCreateAlertRequestPropertiesSchedule, bool) { +func (o *LegacyCreateAlertRequestProperties) GetScheduleOk() (*LegacyUpdateAlertRequestPropertiesSchedule, bool) { if o == nil { return nil, false } @@ -266,7 +265,7 @@ func (o *LegacyCreateAlertRequestProperties) GetScheduleOk() (*LegacyCreateAlert } // SetSchedule sets field value -func (o *LegacyCreateAlertRequestProperties) SetSchedule(v LegacyCreateAlertRequestPropertiesSchedule) { +func (o *LegacyCreateAlertRequestProperties) SetSchedule(v LegacyUpdateAlertRequestPropertiesSchedule) { o.Schedule = v } diff --git a/generated/alerting/model_legacy_find_alerts_200_response.go b/generated/alerting/model_legacy_find_alerts_200_response.go index 25ba62714..deb744cf3 100644 --- a/generated/alerting/model_legacy_find_alerts_200_response.go +++ b/generated/alerting/model_legacy_find_alerts_200_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_find_alerts_has_reference_parameter.go b/generated/alerting/model_legacy_find_alerts_has_reference_parameter.go new file mode 100644 index 000000000..8f52bc6c5 --- /dev/null +++ b/generated/alerting/model_legacy_find_alerts_has_reference_parameter.go @@ -0,0 +1,160 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the LegacyFindAlertsHasReferenceParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LegacyFindAlertsHasReferenceParameter{} + +// LegacyFindAlertsHasReferenceParameter struct for LegacyFindAlertsHasReferenceParameter +type LegacyFindAlertsHasReferenceParameter struct { + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` +} + +// NewLegacyFindAlertsHasReferenceParameter instantiates a new LegacyFindAlertsHasReferenceParameter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLegacyFindAlertsHasReferenceParameter() *LegacyFindAlertsHasReferenceParameter { + this := LegacyFindAlertsHasReferenceParameter{} + return &this +} + +// NewLegacyFindAlertsHasReferenceParameterWithDefaults instantiates a new LegacyFindAlertsHasReferenceParameter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLegacyFindAlertsHasReferenceParameterWithDefaults() *LegacyFindAlertsHasReferenceParameter { + this := LegacyFindAlertsHasReferenceParameter{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LegacyFindAlertsHasReferenceParameter) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LegacyFindAlertsHasReferenceParameter) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LegacyFindAlertsHasReferenceParameter) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LegacyFindAlertsHasReferenceParameter) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LegacyFindAlertsHasReferenceParameter) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LegacyFindAlertsHasReferenceParameter) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LegacyFindAlertsHasReferenceParameter) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LegacyFindAlertsHasReferenceParameter) SetType(v string) { + o.Type = &v +} + +func (o LegacyFindAlertsHasReferenceParameter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LegacyFindAlertsHasReferenceParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + return toSerialize, nil +} + +type NullableLegacyFindAlertsHasReferenceParameter struct { + value *LegacyFindAlertsHasReferenceParameter + isSet bool +} + +func (v NullableLegacyFindAlertsHasReferenceParameter) Get() *LegacyFindAlertsHasReferenceParameter { + return v.value +} + +func (v *NullableLegacyFindAlertsHasReferenceParameter) Set(val *LegacyFindAlertsHasReferenceParameter) { + v.value = val + v.isSet = true +} + +func (v NullableLegacyFindAlertsHasReferenceParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableLegacyFindAlertsHasReferenceParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLegacyFindAlertsHasReferenceParameter(val *LegacyFindAlertsHasReferenceParameter) *NullableLegacyFindAlertsHasReferenceParameter { + return &NullableLegacyFindAlertsHasReferenceParameter{value: val, isSet: true} +} + +func (v NullableLegacyFindAlertsHasReferenceParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLegacyFindAlertsHasReferenceParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_legacy_get_alert_types_200_response_inner.go b/generated/alerting/model_legacy_get_alert_types_200_response_inner.go index 4b78046ff..9e215f7a5 100644 --- a/generated/alerting/model_legacy_get_alert_types_200_response_inner.go +++ b/generated/alerting/model_legacy_get_alert_types_200_response_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,9 +19,8 @@ var _ MappedNullable = &LegacyGetAlertTypes200ResponseInner{} // LegacyGetAlertTypes200ResponseInner struct for LegacyGetAlertTypes200ResponseInner type LegacyGetAlertTypes200ResponseInner struct { - // An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid. - ActionGroups []GetRuleTypes200ResponseInnerActionGroupsInner `json:"actionGroups,omitempty"` - ActionVariables *LegacyGetAlertTypes200ResponseInnerActionVariables `json:"actionVariables,omitempty"` + ActionGroups []LegacyGetAlertTypes200ResponseInnerActionGroupsInner `json:"actionGroups,omitempty"` + ActionVariables *LegacyGetAlertTypes200ResponseInnerActionVariables `json:"actionVariables,omitempty"` // The list of the plugins IDs that have access to the alert type. AuthorizedConsumers map[string]interface{} `json:"authorizedConsumers,omitempty"` // The default identifier for the alert type group. @@ -59,9 +58,9 @@ func NewLegacyGetAlertTypes200ResponseInnerWithDefaults() *LegacyGetAlertTypes20 } // GetActionGroups returns the ActionGroups field value if set, zero value otherwise. -func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroups() []GetRuleTypes200ResponseInnerActionGroupsInner { +func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroups() []LegacyGetAlertTypes200ResponseInnerActionGroupsInner { if o == nil || IsNil(o.ActionGroups) { - var ret []GetRuleTypes200ResponseInnerActionGroupsInner + var ret []LegacyGetAlertTypes200ResponseInnerActionGroupsInner return ret } return o.ActionGroups @@ -69,7 +68,7 @@ func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroups() []GetRuleTypes20 // GetActionGroupsOk returns a tuple with the ActionGroups field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroupsOk() ([]GetRuleTypes200ResponseInnerActionGroupsInner, bool) { +func (o *LegacyGetAlertTypes200ResponseInner) GetActionGroupsOk() ([]LegacyGetAlertTypes200ResponseInnerActionGroupsInner, bool) { if o == nil || IsNil(o.ActionGroups) { return nil, false } @@ -85,8 +84,8 @@ func (o *LegacyGetAlertTypes200ResponseInner) HasActionGroups() bool { return false } -// SetActionGroups gets a reference to the given []GetRuleTypes200ResponseInnerActionGroupsInner and assigns it to the ActionGroups field. -func (o *LegacyGetAlertTypes200ResponseInner) SetActionGroups(v []GetRuleTypes200ResponseInnerActionGroupsInner) { +// SetActionGroups gets a reference to the given []LegacyGetAlertTypes200ResponseInnerActionGroupsInner and assigns it to the ActionGroups field. +func (o *LegacyGetAlertTypes200ResponseInner) SetActionGroups(v []LegacyGetAlertTypes200ResponseInnerActionGroupsInner) { o.ActionGroups = v } diff --git a/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_groups_inner.go b/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_groups_inner.go new file mode 100644 index 000000000..4868d427b --- /dev/null +++ b/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_groups_inner.go @@ -0,0 +1,160 @@ +/* +Alerting + +OpenAPI schema for alerting endpoints + +API version: 0.2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package alerting + +import ( + "encoding/json" +) + +// checks if the LegacyGetAlertTypes200ResponseInnerActionGroupsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LegacyGetAlertTypes200ResponseInnerActionGroupsInner{} + +// LegacyGetAlertTypes200ResponseInnerActionGroupsInner struct for LegacyGetAlertTypes200ResponseInnerActionGroupsInner +type LegacyGetAlertTypes200ResponseInnerActionGroupsInner struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewLegacyGetAlertTypes200ResponseInnerActionGroupsInner instantiates a new LegacyGetAlertTypes200ResponseInnerActionGroupsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLegacyGetAlertTypes200ResponseInnerActionGroupsInner() *LegacyGetAlertTypes200ResponseInnerActionGroupsInner { + this := LegacyGetAlertTypes200ResponseInnerActionGroupsInner{} + return &this +} + +// NewLegacyGetAlertTypes200ResponseInnerActionGroupsInnerWithDefaults instantiates a new LegacyGetAlertTypes200ResponseInnerActionGroupsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLegacyGetAlertTypes200ResponseInnerActionGroupsInnerWithDefaults() *LegacyGetAlertTypes200ResponseInnerActionGroupsInner { + this := LegacyGetAlertTypes200ResponseInnerActionGroupsInner{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) SetName(v string) { + o.Name = &v +} + +func (o LegacyGetAlertTypes200ResponseInnerActionGroupsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LegacyGetAlertTypes200ResponseInnerActionGroupsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner struct { + value *LegacyGetAlertTypes200ResponseInnerActionGroupsInner + isSet bool +} + +func (v NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) Get() *LegacyGetAlertTypes200ResponseInnerActionGroupsInner { + return v.value +} + +func (v *NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) Set(val *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) { + v.value = val + v.isSet = true +} + +func (v NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner(val *LegacyGetAlertTypes200ResponseInnerActionGroupsInner) *NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner { + return &NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner{value: val, isSet: true} +} + +func (v NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLegacyGetAlertTypes200ResponseInnerActionGroupsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_variables.go b/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_variables.go index b6d12648c..34049df19 100644 --- a/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_variables.go +++ b/generated/alerting/model_legacy_get_alert_types_200_response_inner_action_variables.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,9 +19,9 @@ var _ MappedNullable = &LegacyGetAlertTypes200ResponseInnerActionVariables{} // LegacyGetAlertTypes200ResponseInnerActionVariables A list of action variables that the alert type makes available via context and state in action parameter templates, and a short human readable description. The Alert UI will use this information to prompt users for these variables in action parameter editors. type LegacyGetAlertTypes200ResponseInnerActionVariables struct { - Context []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner `json:"context,omitempty"` - Params []GetRuleTypes200ResponseInnerActionVariablesParamsInner `json:"params,omitempty"` - State []GetRuleTypes200ResponseInnerActionVariablesParamsInner `json:"state,omitempty"` + Context []GetRuleTypes200ResponseInnerActionVariablesStateInner `json:"context,omitempty"` + Params interface{} `json:"params,omitempty"` + State interface{} `json:"state,omitempty"` } // NewLegacyGetAlertTypes200ResponseInnerActionVariables instantiates a new LegacyGetAlertTypes200ResponseInnerActionVariables object @@ -42,9 +42,9 @@ func NewLegacyGetAlertTypes200ResponseInnerActionVariablesWithDefaults() *Legacy } // GetContext returns the Context field value if set, zero value otherwise. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContext() []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner { +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContext() []GetRuleTypes200ResponseInnerActionVariablesStateInner { if o == nil || IsNil(o.Context) { - var ret []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner + var ret []GetRuleTypes200ResponseInnerActionVariablesStateInner return ret } return o.Context @@ -52,7 +52,7 @@ func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContext() []Lega // GetContextOk returns a tuple with the Context field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContextOk() ([]LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner, bool) { +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetContextOk() ([]GetRuleTypes200ResponseInnerActionVariablesStateInner, bool) { if o == nil || IsNil(o.Context) { return nil, false } @@ -68,15 +68,15 @@ func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) HasContext() bool { return false } -// SetContext gets a reference to the given []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner and assigns it to the Context field. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetContext(v []LegacyGetAlertTypes200ResponseInnerActionVariablesContextInner) { +// SetContext gets a reference to the given []GetRuleTypes200ResponseInnerActionVariablesStateInner and assigns it to the Context field. +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetContext(v []GetRuleTypes200ResponseInnerActionVariablesStateInner) { o.Context = v } -// GetParams returns the Params field value if set, zero value otherwise. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParams() []GetRuleTypes200ResponseInnerActionVariablesParamsInner { - if o == nil || IsNil(o.Params) { - var ret []GetRuleTypes200ResponseInnerActionVariablesParamsInner +// GetParams returns the Params field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParams() interface{} { + if o == nil { + var ret interface{} return ret } return o.Params @@ -84,31 +84,32 @@ func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParams() []GetRu // GetParamsOk returns a tuple with the Params field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParamsOk() ([]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool) { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetParamsOk() (*interface{}, bool) { if o == nil || IsNil(o.Params) { return nil, false } - return o.Params, true + return &o.Params, true } // HasParams returns a boolean if a field has been set. func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) HasParams() bool { - if o != nil && !IsNil(o.Params) { + if o != nil && IsNil(o.Params) { return true } return false } -// SetParams gets a reference to the given []GetRuleTypes200ResponseInnerActionVariablesParamsInner and assigns it to the Params field. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetParams(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner) { +// SetParams gets a reference to the given interface{} and assigns it to the Params field. +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetParams(v interface{}) { o.Params = v } -// GetState returns the State field value if set, zero value otherwise. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetState() []GetRuleTypes200ResponseInnerActionVariablesParamsInner { - if o == nil || IsNil(o.State) { - var ret []GetRuleTypes200ResponseInnerActionVariablesParamsInner +// GetState returns the State field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetState() interface{} { + if o == nil { + var ret interface{} return ret } return o.State @@ -116,24 +117,25 @@ func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetState() []GetRul // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetStateOk() ([]GetRuleTypes200ResponseInnerActionVariablesParamsInner, bool) { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) GetStateOk() (*interface{}, bool) { if o == nil || IsNil(o.State) { return nil, false } - return o.State, true + return &o.State, true } // HasState returns a boolean if a field has been set. func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) HasState() bool { - if o != nil && !IsNil(o.State) { + if o != nil && IsNil(o.State) { return true } return false } -// SetState gets a reference to the given []GetRuleTypes200ResponseInnerActionVariablesParamsInner and assigns it to the State field. -func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetState(v []GetRuleTypes200ResponseInnerActionVariablesParamsInner) { +// SetState gets a reference to the given interface{} and assigns it to the State field. +func (o *LegacyGetAlertTypes200ResponseInnerActionVariables) SetState(v interface{}) { o.State = v } @@ -150,10 +152,10 @@ func (o LegacyGetAlertTypes200ResponseInnerActionVariables) ToMap() (map[string] if !IsNil(o.Context) { toSerialize["context"] = o.Context } - if !IsNil(o.Params) { + if o.Params != nil { toSerialize["params"] = o.Params } - if !IsNil(o.State) { + if o.State != nil { toSerialize["state"] = o.State } return toSerialize, nil diff --git a/generated/alerting/model_legacy_get_alert_types_200_response_inner_recovery_action_group.go b/generated/alerting/model_legacy_get_alert_types_200_response_inner_recovery_action_group.go index 7e975bd80..68e1914d7 100644 --- a/generated/alerting/model_legacy_get_alert_types_200_response_inner_recovery_action_group.go +++ b/generated/alerting/model_legacy_get_alert_types_200_response_inner_recovery_action_group.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,8 +19,8 @@ var _ MappedNullable = &LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup{} // LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup An action group to use when an alert instance goes from an active state to an inactive one. If it is not specified, the default recovered action group is used. type LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` + Id NullableString `json:"id,omitempty"` + Name NullableString `json:"name,omitempty"` } // NewLegacyGetAlertTypes200ResponseInnerRecoveryActionGroup instantiates a new LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup object @@ -40,68 +40,90 @@ func NewLegacyGetAlertTypes200ResponseInnerRecoveryActionGroupWithDefaults() *Le return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil || IsNil(o.Id.Get()) { var ret string return ret } - return *o.Id + return *o.Id.Get() } // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true + return o.Id.Get(), o.Id.IsSet() } // HasId returns a boolean if a field has been set. func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) HasId() bool { - if o != nil && !IsNil(o.Id) { + if o != nil && o.Id.IsSet() { return true } return false } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId gets a reference to the given NullableString and assigns it to the Id field. func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetId(v string) { - o.Id = &v + o.Id.Set(&v) } -// GetName returns the Name field value if set, zero value otherwise. +// SetIdNil sets the value for Id to be an explicit nil +func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) UnsetId() { + o.Id.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil || IsNil(o.Name.Get()) { var ret string return ret } - return *o.Name + return *o.Name.Get() } // GetNameOk returns a tuple with the Name field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return o.Name.Get(), o.Name.IsSet() } // HasName returns a boolean if a field has been set. func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) HasName() bool { - if o != nil && !IsNil(o.Name) { + if o != nil && o.Name.IsSet() { return true } return false } -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName gets a reference to the given NullableString and assigns it to the Name field. func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetName(v string) { - o.Name = &v + o.Name.Set(&v) +} + +// SetNameNil sets the value for Name to be an explicit nil +func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) UnsetName() { + o.Name.Unset() } func (o LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) MarshalJSON() ([]byte, error) { @@ -114,11 +136,11 @@ func (o LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) MarshalJSON() ([ func (o LegacyGetAlertTypes200ResponseInnerRecoveryActionGroup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() } return toSerialize, nil } diff --git a/generated/alerting/model_legacy_get_alerting_health_200_response.go b/generated/alerting/model_legacy_get_alerting_health_200_response.go index 46a942c95..260329f68 100644 --- a/generated/alerting/model_legacy_get_alerting_health_200_response.go +++ b/generated/alerting/model_legacy_get_alerting_health_200_response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health.go b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health.go index 536ee4749..a7be69086 100644 --- a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health.go +++ b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_decryption_health.go b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_decryption_health.go index ee845db72..08e5f5bc1 100644 --- a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_decryption_health.go +++ b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_decryption_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_execution_health.go b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_execution_health.go index 4037079f0..daf97dfe4 100644 --- a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_execution_health.go +++ b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_execution_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_read_health.go b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_read_health.go index fce0a4f10..52d3237e9 100644 --- a/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_read_health.go +++ b/generated/alerting/model_legacy_get_alerting_health_200_response_alerting_framework_health_read_health.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_update_alert_request_properties.go b/generated/alerting/model_legacy_update_alert_request_properties.go index 52c0cc513..627011b3e 100644 --- a/generated/alerting/model_legacy_update_alert_request_properties.go +++ b/generated/alerting/model_legacy_update_alert_request_properties.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,8 +27,7 @@ type LegacyUpdateAlertRequestProperties struct { // The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. Params map[string]interface{} `json:"params"` Schedule LegacyUpdateAlertRequestPropertiesSchedule `json:"schedule"` - // A list of keywords to reference and search. - Tags []string `json:"tags,omitempty"` + Tags []*string `json:"tags,omitempty"` // How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. Throttle *string `json:"throttle,omitempty"` } @@ -183,9 +182,9 @@ func (o *LegacyUpdateAlertRequestProperties) SetSchedule(v LegacyUpdateAlertRequ } // GetTags returns the Tags field value if set, zero value otherwise. -func (o *LegacyUpdateAlertRequestProperties) GetTags() []string { +func (o *LegacyUpdateAlertRequestProperties) GetTags() []*string { if o == nil || IsNil(o.Tags) { - var ret []string + var ret []*string return ret } return o.Tags @@ -193,7 +192,7 @@ func (o *LegacyUpdateAlertRequestProperties) GetTags() []string { // GetTagsOk returns a tuple with the Tags field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *LegacyUpdateAlertRequestProperties) GetTagsOk() ([]string, bool) { +func (o *LegacyUpdateAlertRequestProperties) GetTagsOk() ([]*string, bool) { if o == nil || IsNil(o.Tags) { return nil, false } @@ -209,8 +208,8 @@ func (o *LegacyUpdateAlertRequestProperties) HasTags() bool { return false } -// SetTags gets a reference to the given []string and assigns it to the Tags field. -func (o *LegacyUpdateAlertRequestProperties) SetTags(v []string) { +// SetTags gets a reference to the given []*string and assigns it to the Tags field. +func (o *LegacyUpdateAlertRequestProperties) SetTags(v []*string) { o.Tags = v } diff --git a/generated/alerting/model_legacy_update_alert_request_properties_actions_inner.go b/generated/alerting/model_legacy_update_alert_request_properties_actions_inner.go index d7395b789..e3fdd7888 100644 --- a/generated/alerting/model_legacy_update_alert_request_properties_actions_inner.go +++ b/generated/alerting/model_legacy_update_alert_request_properties_actions_inner.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_legacy_update_alert_request_properties_schedule.go b/generated/alerting/model_legacy_update_alert_request_properties_schedule.go index 15d1b6fb6..f41e8f36b 100644 --- a/generated/alerting/model_legacy_update_alert_request_properties_schedule.go +++ b/generated/alerting/model_legacy_update_alert_request_properties_schedule.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_notify_when.go b/generated/alerting/model_notify_when.go index 87d1b5b9f..054b38e45 100644 --- a/generated/alerting/model_notify_when.go +++ b/generated/alerting/model_notify_when.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,7 +15,7 @@ import ( "fmt" ) -// NotifyWhen Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. +// NotifyWhen Deprecated in 8.13.0. Use the `notify_when` property in the action `frequency` object instead. Indicates how often alerts generate actions. NOTE: You cannot specify `notify_when` at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. type NotifyWhen string // List of notify_when diff --git a/generated/alerting/model_rule_response_properties.go b/generated/alerting/model_rule_response_properties.go index 5c5a40603..ec65cf966 100644 --- a/generated/alerting/model_rule_response_properties.go +++ b/generated/alerting/model_rule_response_properties.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,7 +20,11 @@ var _ MappedNullable = &RuleResponseProperties{} // RuleResponseProperties struct for RuleResponseProperties type RuleResponseProperties struct { - Actions []ActionsInner `json:"actions"` + Actions []ActionsInner `json:"actions"` + AlertDelay *AlertDelay `json:"alert_delay,omitempty"` + // Indicates whether the API key that is associated with the rule was created by the user. + ApiKeyCreatedByUser *bool `json:"api_key_created_by_user,omitempty"` + // The owner of the API key that is associated with the rule and used to run background tasks. ApiKeyOwner NullableString `json:"api_key_owner"` // The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. Consumer string `json:"consumer"` @@ -37,20 +41,23 @@ type RuleResponseProperties struct { MutedAlertIds []string `json:"muted_alert_ids"` MuteAll bool `json:"mute_all"` // The name of the rule. - Name string `json:"name"` - NextRun NullableTime `json:"next_run,omitempty"` - NotifyWhen *NotifyWhen `json:"notify_when,omitempty"` + Name string `json:"name"` + NextRun NullableTime `json:"next_run,omitempty"` + // Indicates how often alerts generate actions. + NotifyWhen NullableString `json:"notify_when,omitempty"` // The parameters for the rule. Params map[string]interface{} `json:"params"` + // The rule revision number. + Revision *int32 `json:"revision,omitempty"` // The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. RuleTypeId string `json:"rule_type_id"` // Indicates whether the rule is running. Running *bool `json:"running,omitempty"` Schedule Schedule `json:"schedule"` ScheduledTaskId *string `json:"scheduled_task_id,omitempty"` - // The tags for the rule. - Tags []string `json:"tags"` - // The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. + Tags []string `json:"tags"` + // Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + // Deprecated Throttle NullableString `json:"throttle"` // The date and time that the rule was updated most recently. UpdatedAt string `json:"updated_at"` @@ -94,7 +101,6 @@ func NewRuleResponsePropertiesWithDefaults() *RuleResponseProperties { } // GetActions returns the Actions field value -// If the value is explicit nil, the zero value for []ActionsInner will be returned func (o *RuleResponseProperties) GetActions() []ActionsInner { if o == nil { var ret []ActionsInner @@ -106,9 +112,8 @@ func (o *RuleResponseProperties) GetActions() []ActionsInner { // GetActionsOk returns a tuple with the Actions field value // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RuleResponseProperties) GetActionsOk() ([]ActionsInner, bool) { - if o == nil || IsNil(o.Actions) { + if o == nil { return nil, false } return o.Actions, true @@ -119,6 +124,70 @@ func (o *RuleResponseProperties) SetActions(v []ActionsInner) { o.Actions = v } +// GetAlertDelay returns the AlertDelay field value if set, zero value otherwise. +func (o *RuleResponseProperties) GetAlertDelay() AlertDelay { + if o == nil || IsNil(o.AlertDelay) { + var ret AlertDelay + return ret + } + return *o.AlertDelay +} + +// GetAlertDelayOk returns a tuple with the AlertDelay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuleResponseProperties) GetAlertDelayOk() (*AlertDelay, bool) { + if o == nil || IsNil(o.AlertDelay) { + return nil, false + } + return o.AlertDelay, true +} + +// HasAlertDelay returns a boolean if a field has been set. +func (o *RuleResponseProperties) HasAlertDelay() bool { + if o != nil && !IsNil(o.AlertDelay) { + return true + } + + return false +} + +// SetAlertDelay gets a reference to the given AlertDelay and assigns it to the AlertDelay field. +func (o *RuleResponseProperties) SetAlertDelay(v AlertDelay) { + o.AlertDelay = &v +} + +// GetApiKeyCreatedByUser returns the ApiKeyCreatedByUser field value if set, zero value otherwise. +func (o *RuleResponseProperties) GetApiKeyCreatedByUser() bool { + if o == nil || IsNil(o.ApiKeyCreatedByUser) { + var ret bool + return ret + } + return *o.ApiKeyCreatedByUser +} + +// GetApiKeyCreatedByUserOk returns a tuple with the ApiKeyCreatedByUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuleResponseProperties) GetApiKeyCreatedByUserOk() (*bool, bool) { + if o == nil || IsNil(o.ApiKeyCreatedByUser) { + return nil, false + } + return o.ApiKeyCreatedByUser, true +} + +// HasApiKeyCreatedByUser returns a boolean if a field has been set. +func (o *RuleResponseProperties) HasApiKeyCreatedByUser() bool { + if o != nil && !IsNil(o.ApiKeyCreatedByUser) { + return true + } + + return false +} + +// SetApiKeyCreatedByUser gets a reference to the given bool and assigns it to the ApiKeyCreatedByUser field. +func (o *RuleResponseProperties) SetApiKeyCreatedByUser(v bool) { + o.ApiKeyCreatedByUser = &v +} + // GetApiKeyOwner returns the ApiKeyOwner field value // If the value is explicit nil, the zero value for string will be returned func (o *RuleResponseProperties) GetApiKeyOwner() string { @@ -324,7 +393,6 @@ func (o *RuleResponseProperties) SetLastRun(v RuleResponsePropertiesLastRun) { } // GetMutedAlertIds returns the MutedAlertIds field value -// If the value is explicit nil, the zero value for []string will be returned func (o *RuleResponseProperties) GetMutedAlertIds() []string { if o == nil { var ret []string @@ -336,9 +404,8 @@ func (o *RuleResponseProperties) GetMutedAlertIds() []string { // GetMutedAlertIdsOk returns a tuple with the MutedAlertIds field value // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *RuleResponseProperties) GetMutedAlertIdsOk() ([]string, bool) { - if o == nil || IsNil(o.MutedAlertIds) { + if o == nil { return nil, false } return o.MutedAlertIds, true @@ -440,36 +507,47 @@ func (o *RuleResponseProperties) UnsetNextRun() { o.NextRun.Unset() } -// GetNotifyWhen returns the NotifyWhen field value if set, zero value otherwise. -func (o *RuleResponseProperties) GetNotifyWhen() NotifyWhen { - if o == nil || IsNil(o.NotifyWhen) { - var ret NotifyWhen +// GetNotifyWhen returns the NotifyWhen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RuleResponseProperties) GetNotifyWhen() string { + if o == nil || IsNil(o.NotifyWhen.Get()) { + var ret string return ret } - return *o.NotifyWhen + return *o.NotifyWhen.Get() } // GetNotifyWhenOk returns a tuple with the NotifyWhen field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *RuleResponseProperties) GetNotifyWhenOk() (*NotifyWhen, bool) { - if o == nil || IsNil(o.NotifyWhen) { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RuleResponseProperties) GetNotifyWhenOk() (*string, bool) { + if o == nil { return nil, false } - return o.NotifyWhen, true + return o.NotifyWhen.Get(), o.NotifyWhen.IsSet() } // HasNotifyWhen returns a boolean if a field has been set. func (o *RuleResponseProperties) HasNotifyWhen() bool { - if o != nil && !IsNil(o.NotifyWhen) { + if o != nil && o.NotifyWhen.IsSet() { return true } return false } -// SetNotifyWhen gets a reference to the given NotifyWhen and assigns it to the NotifyWhen field. -func (o *RuleResponseProperties) SetNotifyWhen(v NotifyWhen) { - o.NotifyWhen = &v +// SetNotifyWhen gets a reference to the given NullableString and assigns it to the NotifyWhen field. +func (o *RuleResponseProperties) SetNotifyWhen(v string) { + o.NotifyWhen.Set(&v) +} + +// SetNotifyWhenNil sets the value for NotifyWhen to be an explicit nil +func (o *RuleResponseProperties) SetNotifyWhenNil() { + o.NotifyWhen.Set(nil) +} + +// UnsetNotifyWhen ensures that no value is present for NotifyWhen, not even an explicit nil +func (o *RuleResponseProperties) UnsetNotifyWhen() { + o.NotifyWhen.Unset() } // GetParams returns the Params field value @@ -496,6 +574,38 @@ func (o *RuleResponseProperties) SetParams(v map[string]interface{}) { o.Params = v } +// GetRevision returns the Revision field value if set, zero value otherwise. +func (o *RuleResponseProperties) GetRevision() int32 { + if o == nil || IsNil(o.Revision) { + var ret int32 + return ret + } + return *o.Revision +} + +// GetRevisionOk returns a tuple with the Revision field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuleResponseProperties) GetRevisionOk() (*int32, bool) { + if o == nil || IsNil(o.Revision) { + return nil, false + } + return o.Revision, true +} + +// HasRevision returns a boolean if a field has been set. +func (o *RuleResponseProperties) HasRevision() bool { + if o != nil && !IsNil(o.Revision) { + return true + } + + return false +} + +// SetRevision gets a reference to the given int32 and assigns it to the Revision field. +func (o *RuleResponseProperties) SetRevision(v int32) { + o.Revision = &v +} + // GetRuleTypeId returns the RuleTypeId field value func (o *RuleResponseProperties) GetRuleTypeId() string { if o == nil { @@ -634,6 +744,7 @@ func (o *RuleResponseProperties) SetTags(v []string) { // GetThrottle returns the Throttle field value // If the value is explicit nil, the zero value for string will be returned +// Deprecated func (o *RuleResponseProperties) GetThrottle() string { if o == nil || o.Throttle.Get() == nil { var ret string @@ -646,6 +757,7 @@ func (o *RuleResponseProperties) GetThrottle() string { // GetThrottleOk returns a tuple with the Throttle field value // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated func (o *RuleResponseProperties) GetThrottleOk() (*string, bool) { if o == nil { return nil, false @@ -654,6 +766,7 @@ func (o *RuleResponseProperties) GetThrottleOk() (*string, bool) { } // SetThrottle sets field value +// Deprecated func (o *RuleResponseProperties) SetThrottle(v string) { o.Throttle.Set(&v) } @@ -718,8 +831,12 @@ func (o RuleResponseProperties) MarshalJSON() ([]byte, error) { func (o RuleResponseProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Actions != nil { - toSerialize["actions"] = o.Actions + toSerialize["actions"] = o.Actions + if !IsNil(o.AlertDelay) { + toSerialize["alert_delay"] = o.AlertDelay + } + if !IsNil(o.ApiKeyCreatedByUser) { + toSerialize["api_key_created_by_user"] = o.ApiKeyCreatedByUser } toSerialize["api_key_owner"] = o.ApiKeyOwner.Get() toSerialize["consumer"] = o.Consumer @@ -731,18 +848,19 @@ func (o RuleResponseProperties) ToMap() (map[string]interface{}, error) { if !IsNil(o.LastRun) { toSerialize["last_run"] = o.LastRun } - if o.MutedAlertIds != nil { - toSerialize["muted_alert_ids"] = o.MutedAlertIds - } + toSerialize["muted_alert_ids"] = o.MutedAlertIds toSerialize["mute_all"] = o.MuteAll toSerialize["name"] = o.Name if o.NextRun.IsSet() { toSerialize["next_run"] = o.NextRun.Get() } - if !IsNil(o.NotifyWhen) { - toSerialize["notify_when"] = o.NotifyWhen + if o.NotifyWhen.IsSet() { + toSerialize["notify_when"] = o.NotifyWhen.Get() } toSerialize["params"] = o.Params + if !IsNil(o.Revision) { + toSerialize["revision"] = o.Revision + } toSerialize["rule_type_id"] = o.RuleTypeId if !IsNil(o.Running) { toSerialize["running"] = o.Running diff --git a/generated/alerting/model_rule_response_properties_execution_status.go b/generated/alerting/model_rule_response_properties_execution_status.go index b8dd26842..16139f3cc 100644 --- a/generated/alerting/model_rule_response_properties_execution_status.go +++ b/generated/alerting/model_rule_response_properties_execution_status.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_rule_response_properties_last_run.go b/generated/alerting/model_rule_response_properties_last_run.go index 019e57e93..d9c404345 100644 --- a/generated/alerting/model_rule_response_properties_last_run.go +++ b/generated/alerting/model_rule_response_properties_last_run.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,10 +19,11 @@ var _ MappedNullable = &RuleResponsePropertiesLastRun{} // RuleResponsePropertiesLastRun struct for RuleResponsePropertiesLastRun type RuleResponsePropertiesLastRun struct { - AlertsCount *RuleResponsePropertiesLastRunAlertsCount `json:"alerts_count,omitempty"` - Outcome *string `json:"outcome,omitempty"` - OutcomeMsg NullableString `json:"outcome_msg,omitempty"` - Warning NullableString `json:"warning,omitempty"` + AlertsCount *RuleResponsePropertiesLastRunAlertsCount `json:"alerts_count,omitempty"` + Outcome *string `json:"outcome,omitempty"` + OutcomeMsg []string `json:"outcome_msg,omitempty"` + OutcomeOrder *int32 `json:"outcome_order,omitempty"` + Warning NullableString `json:"warning,omitempty"` } // NewRuleResponsePropertiesLastRun instantiates a new RuleResponsePropertiesLastRun object @@ -106,47 +107,68 @@ func (o *RuleResponsePropertiesLastRun) SetOutcome(v string) { o.Outcome = &v } -// GetOutcomeMsg returns the OutcomeMsg field value if set, zero value otherwise (both if not set or set to explicit null). -func (o *RuleResponsePropertiesLastRun) GetOutcomeMsg() string { - if o == nil || IsNil(o.OutcomeMsg.Get()) { - var ret string +// GetOutcomeMsg returns the OutcomeMsg field value if set, zero value otherwise. +func (o *RuleResponsePropertiesLastRun) GetOutcomeMsg() []string { + if o == nil || IsNil(o.OutcomeMsg) { + var ret []string return ret } - return *o.OutcomeMsg.Get() + return o.OutcomeMsg } // GetOutcomeMsgOk returns a tuple with the OutcomeMsg field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned -func (o *RuleResponsePropertiesLastRun) GetOutcomeMsgOk() (*string, bool) { - if o == nil { +func (o *RuleResponsePropertiesLastRun) GetOutcomeMsgOk() ([]string, bool) { + if o == nil || IsNil(o.OutcomeMsg) { return nil, false } - return o.OutcomeMsg.Get(), o.OutcomeMsg.IsSet() + return o.OutcomeMsg, true } // HasOutcomeMsg returns a boolean if a field has been set. func (o *RuleResponsePropertiesLastRun) HasOutcomeMsg() bool { - if o != nil && o.OutcomeMsg.IsSet() { + if o != nil && !IsNil(o.OutcomeMsg) { return true } return false } -// SetOutcomeMsg gets a reference to the given NullableString and assigns it to the OutcomeMsg field. -func (o *RuleResponsePropertiesLastRun) SetOutcomeMsg(v string) { - o.OutcomeMsg.Set(&v) +// SetOutcomeMsg gets a reference to the given []string and assigns it to the OutcomeMsg field. +func (o *RuleResponsePropertiesLastRun) SetOutcomeMsg(v []string) { + o.OutcomeMsg = v } -// SetOutcomeMsgNil sets the value for OutcomeMsg to be an explicit nil -func (o *RuleResponsePropertiesLastRun) SetOutcomeMsgNil() { - o.OutcomeMsg.Set(nil) +// GetOutcomeOrder returns the OutcomeOrder field value if set, zero value otherwise. +func (o *RuleResponsePropertiesLastRun) GetOutcomeOrder() int32 { + if o == nil || IsNil(o.OutcomeOrder) { + var ret int32 + return ret + } + return *o.OutcomeOrder } -// UnsetOutcomeMsg ensures that no value is present for OutcomeMsg, not even an explicit nil -func (o *RuleResponsePropertiesLastRun) UnsetOutcomeMsg() { - o.OutcomeMsg.Unset() +// GetOutcomeOrderOk returns a tuple with the OutcomeOrder field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RuleResponsePropertiesLastRun) GetOutcomeOrderOk() (*int32, bool) { + if o == nil || IsNil(o.OutcomeOrder) { + return nil, false + } + return o.OutcomeOrder, true +} + +// HasOutcomeOrder returns a boolean if a field has been set. +func (o *RuleResponsePropertiesLastRun) HasOutcomeOrder() bool { + if o != nil && !IsNil(o.OutcomeOrder) { + return true + } + + return false +} + +// SetOutcomeOrder gets a reference to the given int32 and assigns it to the OutcomeOrder field. +func (o *RuleResponsePropertiesLastRun) SetOutcomeOrder(v int32) { + o.OutcomeOrder = &v } // GetWarning returns the Warning field value if set, zero value otherwise (both if not set or set to explicit null). @@ -208,8 +230,11 @@ func (o RuleResponsePropertiesLastRun) ToMap() (map[string]interface{}, error) { if !IsNil(o.Outcome) { toSerialize["outcome"] = o.Outcome } - if o.OutcomeMsg.IsSet() { - toSerialize["outcome_msg"] = o.OutcomeMsg.Get() + if !IsNil(o.OutcomeMsg) { + toSerialize["outcome_msg"] = o.OutcomeMsg + } + if !IsNil(o.OutcomeOrder) { + toSerialize["outcome_order"] = o.OutcomeOrder } if o.Warning.IsSet() { toSerialize["warning"] = o.Warning.Get() diff --git a/generated/alerting/model_rule_response_properties_last_run_alerts_count.go b/generated/alerting/model_rule_response_properties_last_run_alerts_count.go index 168ab0a34..19d8bb664 100644 --- a/generated/alerting/model_rule_response_properties_last_run_alerts_count.go +++ b/generated/alerting/model_rule_response_properties_last_run_alerts_count.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_schedule.go b/generated/alerting/model_schedule.go index 8a2c4b274..6026bf3e3 100644 --- a/generated/alerting/model_schedule.go +++ b/generated/alerting/model_schedule.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/model_update_rule_request.go b/generated/alerting/model_update_rule_request.go index e2239b119..0a195f146 100644 --- a/generated/alerting/model_update_rule_request.go +++ b/generated/alerting/model_update_rule_request.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,16 +19,18 @@ var _ MappedNullable = &UpdateRuleRequest{} // UpdateRuleRequest The update rule API request body varies depending on the type of rule and actions. type UpdateRuleRequest struct { - Actions []ActionsInner `json:"actions,omitempty"` + Actions []ActionsInner `json:"actions,omitempty"` + AlertDelay *AlertDelay `json:"alert_delay,omitempty"` // The name of the rule. - Name string `json:"name"` + Name string `json:"name"` + // Deprecated NotifyWhen *NotifyWhen `json:"notify_when,omitempty"` // The parameters for the rule. Params map[string]interface{} `json:"params"` Schedule Schedule `json:"schedule"` - // The tags for the rule. - Tags []string `json:"tags,omitempty"` - // The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. + Tags []string `json:"tags,omitempty"` + // Deprecated in 8.13.0. Use the `throttle` property in the action `frequency` object instead. The throttle interval, which defines how often an alert generates repeated actions. NOTE: You cannot specify the throttle interval at both the rule and action level. If you set it at the rule level then update the rule in Kibana, it is automatically changed to use action-specific values. + // Deprecated Throttle NullableString `json:"throttle,omitempty"` } @@ -52,9 +54,9 @@ func NewUpdateRuleRequestWithDefaults() *UpdateRuleRequest { return &this } -// GetActions returns the Actions field value if set, zero value otherwise (both if not set or set to explicit null). +// GetActions returns the Actions field value if set, zero value otherwise. func (o *UpdateRuleRequest) GetActions() []ActionsInner { - if o == nil { + if o == nil || IsNil(o.Actions) { var ret []ActionsInner return ret } @@ -63,7 +65,6 @@ func (o *UpdateRuleRequest) GetActions() []ActionsInner { // GetActionsOk returns a tuple with the Actions field value if set, nil otherwise // and a boolean to check if the value has been set. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UpdateRuleRequest) GetActionsOk() ([]ActionsInner, bool) { if o == nil || IsNil(o.Actions) { return nil, false @@ -73,7 +74,7 @@ func (o *UpdateRuleRequest) GetActionsOk() ([]ActionsInner, bool) { // HasActions returns a boolean if a field has been set. func (o *UpdateRuleRequest) HasActions() bool { - if o != nil && IsNil(o.Actions) { + if o != nil && !IsNil(o.Actions) { return true } @@ -85,6 +86,38 @@ func (o *UpdateRuleRequest) SetActions(v []ActionsInner) { o.Actions = v } +// GetAlertDelay returns the AlertDelay field value if set, zero value otherwise. +func (o *UpdateRuleRequest) GetAlertDelay() AlertDelay { + if o == nil || IsNil(o.AlertDelay) { + var ret AlertDelay + return ret + } + return *o.AlertDelay +} + +// GetAlertDelayOk returns a tuple with the AlertDelay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRuleRequest) GetAlertDelayOk() (*AlertDelay, bool) { + if o == nil || IsNil(o.AlertDelay) { + return nil, false + } + return o.AlertDelay, true +} + +// HasAlertDelay returns a boolean if a field has been set. +func (o *UpdateRuleRequest) HasAlertDelay() bool { + if o != nil && !IsNil(o.AlertDelay) { + return true + } + + return false +} + +// SetAlertDelay gets a reference to the given AlertDelay and assigns it to the AlertDelay field. +func (o *UpdateRuleRequest) SetAlertDelay(v AlertDelay) { + o.AlertDelay = &v +} + // GetName returns the Name field value func (o *UpdateRuleRequest) GetName() string { if o == nil { @@ -110,6 +143,7 @@ func (o *UpdateRuleRequest) SetName(v string) { } // GetNotifyWhen returns the NotifyWhen field value if set, zero value otherwise. +// Deprecated func (o *UpdateRuleRequest) GetNotifyWhen() NotifyWhen { if o == nil || IsNil(o.NotifyWhen) { var ret NotifyWhen @@ -120,6 +154,7 @@ func (o *UpdateRuleRequest) GetNotifyWhen() NotifyWhen { // GetNotifyWhenOk returns a tuple with the NotifyWhen field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated func (o *UpdateRuleRequest) GetNotifyWhenOk() (*NotifyWhen, bool) { if o == nil || IsNil(o.NotifyWhen) { return nil, false @@ -137,6 +172,7 @@ func (o *UpdateRuleRequest) HasNotifyWhen() bool { } // SetNotifyWhen gets a reference to the given NotifyWhen and assigns it to the NotifyWhen field. +// Deprecated func (o *UpdateRuleRequest) SetNotifyWhen(v NotifyWhen) { o.NotifyWhen = &v } @@ -222,6 +258,7 @@ func (o *UpdateRuleRequest) SetTags(v []string) { } // GetThrottle returns the Throttle field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated func (o *UpdateRuleRequest) GetThrottle() string { if o == nil || IsNil(o.Throttle.Get()) { var ret string @@ -233,6 +270,7 @@ func (o *UpdateRuleRequest) GetThrottle() string { // GetThrottleOk returns a tuple with the Throttle field value if set, nil otherwise // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated func (o *UpdateRuleRequest) GetThrottleOk() (*string, bool) { if o == nil { return nil, false @@ -250,6 +288,7 @@ func (o *UpdateRuleRequest) HasThrottle() bool { } // SetThrottle gets a reference to the given NullableString and assigns it to the Throttle field. +// Deprecated func (o *UpdateRuleRequest) SetThrottle(v string) { o.Throttle.Set(&v) } @@ -274,9 +313,12 @@ func (o UpdateRuleRequest) MarshalJSON() ([]byte, error) { func (o UpdateRuleRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Actions != nil { + if !IsNil(o.Actions) { toSerialize["actions"] = o.Actions } + if !IsNil(o.AlertDelay) { + toSerialize["alert_delay"] = o.AlertDelay + } toSerialize["name"] = o.Name if !IsNil(o.NotifyWhen) { toSerialize["notify_when"] = o.NotifyWhen diff --git a/generated/alerting/response.go b/generated/alerting/response.go index 43f4b0ab1..4f28febd1 100644 --- a/generated/alerting/response.go +++ b/generated/alerting/response.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/alerting/utils.go b/generated/alerting/utils.go index 0086541e6..20efec359 100644 --- a/generated/alerting/utils.go +++ b/generated/alerting/utils.go @@ -3,7 +3,7 @@ Alerting OpenAPI schema for alerting endpoints -API version: 0.1 +API version: 0.2 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/internal/clients/kibana/alerting.go b/internal/clients/kibana/alerting.go index 657f218e3..2228a9278 100644 --- a/internal/clients/kibana/alerting.go +++ b/internal/clients/kibana/alerting.go @@ -21,18 +21,29 @@ func ruleResponseToModel(spaceID string, res *alerting.RuleResponseProperties) * actions := []models.AlertingRuleAction{} for _, action := range res.Actions { actions = append(actions, models.AlertingRuleAction{ - Group: *action.Group, - ID: *action.Id, + Group: action.Group, + ID: action.Id, Params: action.Params, }) } + var alertDelay *float32 + alertDelayActive := unwrapOptionalField(res.AlertDelay).Active + + if alerting.IsNil(res.AlertDelay) { + alertDelay = nil + } else { + alertDelay = &alertDelayActive + } + return &models.AlertingRule{ - RuleID: res.Id, - SpaceID: spaceID, - Name: res.Name, - Consumer: res.Consumer, - NotifyWhen: string(unwrapOptionalField(res.NotifyWhen)), + RuleID: res.Id, + SpaceID: spaceID, + Name: res.Name, + Consumer: res.Consumer, + + // DEPRECATED + NotifyWhen: res.NotifyWhen.Get(), Params: res.Params, RuleTypeID: res.RuleTypeId, @@ -47,7 +58,8 @@ func ruleResponseToModel(spaceID string, res *alerting.RuleResponseProperties) * LastExecutionDate: res.ExecutionStatus.LastExecutionDate, Status: res.ExecutionStatus.Status, }, - Actions: actions, + Actions: actions, + AlertDelay: alertDelay, } } @@ -57,8 +69,8 @@ func ruleActionsToActionsInner(ruleActions []models.AlertingRuleAction) []alerti for index := range ruleActions { action := ruleActions[index] actions = append(actions, alerting.ActionsInner{ - Group: &action.Group, - Id: &action.ID, + Group: action.Group, + Id: action.ID, Params: action.Params, }) } @@ -78,23 +90,33 @@ func CreateAlertingRule(ctx context.Context, apiClient ApiClient, rule models.Al ctxWithAuth := apiClient.SetAlertingAuthContext(ctx) + var alertDelay *alerting.AlertDelay + + if alerting.IsNil(rule.AlertDelay) { + alertDelay = nil + } else { + alertDelay = &alerting.AlertDelay{ + Active: *rule.AlertDelay, + } + } + reqModel := alerting.CreateRuleRequest{ Consumer: rule.Consumer, Actions: ruleActionsToActionsInner(rule.Actions), Enabled: rule.Enabled, Name: rule.Name, - NotifyWhen: (*alerting.NotifyWhen)(&rule.NotifyWhen), + NotifyWhen: (*alerting.NotifyWhen)(rule.NotifyWhen), Params: rule.Params, RuleTypeId: rule.RuleTypeID, Schedule: alerting.Schedule{ Interval: &rule.Schedule.Interval, }, - Tags: rule.Tags, - Throttle: *alerting.NewNullableString(rule.Throttle), + Tags: rule.Tags, + Throttle: *alerting.NewNullableString(rule.Throttle), + AlertDelay: alertDelay, } - req := client.CreateRule(ctxWithAuth, rule.SpaceID, rule.RuleID).KbnXsrf("true").CreateRuleRequest(reqModel) - + req := client.CreateRuleId(ctxWithAuth, rule.SpaceID, rule.RuleID).KbnXsrf("true").CreateRuleRequest(reqModel) ruleRes, res, err := req.Execute() if err != nil && res == nil { return nil, diag.FromErr(err) @@ -136,7 +158,7 @@ func UpdateAlertingRule(ctx context.Context, apiClient ApiClient, rule models.Al reqModel := alerting.UpdateRuleRequest{ Actions: ruleActionsToActionsInner((rule.Actions)), Name: rule.Name, - NotifyWhen: (*alerting.NotifyWhen)(&rule.NotifyWhen), + NotifyWhen: (*alerting.NotifyWhen)(rule.NotifyWhen), Params: rule.Params, Schedule: alerting.Schedule{ Interval: &rule.Schedule.Interval, diff --git a/internal/clients/kibana/alerting_test.go b/internal/clients/kibana/alerting_test.go index 2a9d0b4d2..90ce90454 100644 --- a/internal/clients/kibana/alerting_test.go +++ b/internal/clients/kibana/alerting_test.go @@ -65,16 +65,16 @@ func Test_ruleResponseToModel(t *testing.T) { RuleTypeId: "rule-type-id", Enabled: true, Tags: []string{"hello"}, - NotifyWhen: makePtr(alerting.NotifyWhen("broken")), + NotifyWhen: *alerting.NewNullableString(makePtr("broken")), Actions: []alerting.ActionsInner{ { - Group: makePtr("group-1"), - Id: makePtr("id"), + Group: "group-1", + Id: "id", Params: map[string]interface{}{}, }, { - Group: makePtr("group-2"), - Id: makePtr("id"), + Group: "group-2", + Id: "id", Params: map[string]interface{}{}, }, }, @@ -87,6 +87,9 @@ func Test_ruleResponseToModel(t *testing.T) { Interval: makePtr("1m"), }, Throttle: *alerting.NewNullableString(makePtr("throttle")), + AlertDelay: &alerting.AlertDelay{ + Active: float32(4), + }, }, expectedModel: &models.AlertingRule{ RuleID: "id", @@ -97,7 +100,7 @@ func Test_ruleResponseToModel(t *testing.T) { RuleTypeID: "rule-type-id", Enabled: makePtr(true), Tags: []string{"hello"}, - NotifyWhen: "broken", + NotifyWhen: makePtr("broken"), Schedule: models.AlertingRuleSchedule{Interval: "1m"}, Throttle: makePtr("throttle"), ScheduledTaskID: makePtr("scheduled-task-id"), @@ -117,6 +120,7 @@ func Test_ruleResponseToModel(t *testing.T) { Params: map[string]interface{}{}, }, }, + AlertDelay: makePtr(float32(4)), }, }, } @@ -154,10 +158,10 @@ func Test_CreateUpdateAlertingRule(t *testing.T) { testFunc: CreateAlertingRule, client: func() ApiClient { apiClient, alertingClient := getApiClient() - alertingClient.EXPECT().CreateRule(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, spaceId string, ruleId string) alerting.ApiCreateRuleRequest { - return alerting.ApiCreateRuleRequest{ApiService: alertingClient} + alertingClient.EXPECT().CreateRuleId(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, spaceId string, ruleId string) alerting.ApiCreateRuleIdRequest { + return alerting.ApiCreateRuleIdRequest{ApiService: alertingClient} }) - alertingClient.EXPECT().CreateRuleExecute(gomock.Any()).DoAndReturn(func(r alerting.ApiCreateRuleRequest) (*alerting.RuleResponseProperties, *http.Response, error) { + alertingClient.EXPECT().CreateRuleIdExecute(gomock.Any()).DoAndReturn(func(r alerting.ApiCreateRuleIdRequest) (*alerting.RuleResponseProperties, *http.Response, error) { return nil, &http.Response{ StatusCode: 401, Body: io.NopCloser(strings.NewReader("some error")), @@ -194,10 +198,10 @@ func Test_CreateUpdateAlertingRule(t *testing.T) { testFunc: CreateAlertingRule, client: func() ApiClient { apiClient, alertingClient := getApiClient() - alertingClient.EXPECT().CreateRule(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, spaceId string, ruleId string) alerting.ApiCreateRuleRequest { - return alerting.ApiCreateRuleRequest{ApiService: alertingClient} + alertingClient.EXPECT().CreateRuleId(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, spaceId string, ruleId string) alerting.ApiCreateRuleIdRequest { + return alerting.ApiCreateRuleIdRequest{ApiService: alertingClient} }) - alertingClient.EXPECT().CreateRuleExecute(gomock.Any()).DoAndReturn(func(r alerting.ApiCreateRuleRequest) (*alerting.RuleResponseProperties, *http.Response, error) { + alertingClient.EXPECT().CreateRuleIdExecute(gomock.Any()).DoAndReturn(func(r alerting.ApiCreateRuleIdRequest) (*alerting.RuleResponseProperties, *http.Response, error) { return nil, &http.Response{ StatusCode: 200, Body: io.NopCloser(strings.NewReader("everything seems fine")), diff --git a/internal/kibana/alerting.go b/internal/kibana/alerting.go index efd9d24c1..a0db6c607 100644 --- a/internal/kibana/alerting.go +++ b/internal/kibana/alerting.go @@ -9,11 +9,14 @@ import ( "github.com/elastic/terraform-provider-elasticstack/internal/clients/kibana" "github.com/elastic/terraform-provider-elasticstack/internal/models" "github.com/elastic/terraform-provider-elasticstack/internal/utils" + "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) +var alertDelayMinSupportedVersion = version.Must(version.NewVersion("8.13.0")) + func ResourceAlertingRule() *schema.Resource { apikeySchema := map[string]*schema.Schema{ "rule_id": { @@ -128,6 +131,11 @@ func ResourceAlertingRule() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "alert_delay": { + Description: "A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur.", + Type: schema.TypeFloat, + Optional: true, + }, } return &schema.Resource{ @@ -146,13 +154,12 @@ func ResourceAlertingRule() *schema.Resource { } } -func getAlertingRuleFromResourceData(d *schema.ResourceData) (models.AlertingRule, diag.Diagnostics) { +func getAlertingRuleFromResourceData(d *schema.ResourceData, serverVersion *version.Version) (models.AlertingRule, diag.Diagnostics) { var diags diag.Diagnostics rule := models.AlertingRule{ SpaceID: d.Get("space_id").(string), Name: d.Get("name").(string), Consumer: d.Get("consumer").(string), - NotifyWhen: d.Get("notify_when").(string), RuleTypeID: d.Get("rule_type_id").(string), Schedule: models.AlertingRuleSchedule{ Interval: d.Get("interval").(string), @@ -181,6 +188,25 @@ func getAlertingRuleFromResourceData(d *schema.ResourceData) (models.AlertingRul rule.Throttle = &t } + if v, ok := d.GetOk("notify_when"); ok { + rule.NotifyWhen = utils.Pointer(v.(string)) + } + + if v, ok := d.GetOk("alert_delay"); ok { + if serverVersion.LessThan(alertDelayMinSupportedVersion) { + return models.AlertingRule{}, diag.Diagnostics{ + diag.Diagnostic{ + Severity: diag.Error, + Summary: "alert_delay is only supported for Elasticsearch v8.13 or higher", + Detail: "alert_delay is only supported for Elasticsearch v8.13 or higher", + }, + } + + } + + rule.AlertDelay = utils.Pointer(float32(v.(float64))) + } + actions, diags := getActionsFromResourceData(d) if diags.HasError() { return models.AlertingRule{}, diags @@ -226,7 +252,12 @@ func resourceRuleCreate(ctx context.Context, d *schema.ResourceData, meta interf return diags } - rule, diags := getAlertingRuleFromResourceData(d) + serverVersion, diags := client.ServerVersion(ctx) + if diags.HasError() { + return diags + } + + rule, diags := getAlertingRuleFromResourceData(d, serverVersion) if diags.HasError() { return diags } @@ -249,7 +280,12 @@ func resourceRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interf return diags } - rule, diags := getAlertingRuleFromResourceData(d) + serverVersion, diags := client.ServerVersion(ctx) + if diags.HasError() { + return diags + } + + rule, diags := getAlertingRuleFromResourceData(d, serverVersion) if diags.HasError() { return diags } diff --git a/internal/kibana/alerting_test.go b/internal/kibana/alerting_test.go index 4137c6cc5..385b273c1 100644 --- a/internal/kibana/alerting_test.go +++ b/internal/kibana/alerting_test.go @@ -17,6 +17,7 @@ import ( func TestAccResourceAlertingRule(t *testing.T) { minSupportedVersion := version.Must(version.NewSemver("7.14.0")) + minSupportedAlertDelayVersion := version.Must(version.NewSemver("8.13.0")) t.Setenv("KIBANA_API_KEY", "") @@ -55,6 +56,36 @@ func TestAccResourceAlertingRule(t *testing.T) { resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "tags.1", "second"), ), }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minSupportedAlertDelayVersion), + Config: testAccResourceAlertingRuleWithAlertDelayCreate(ruleName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "name", ruleName), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "rule_id", "af22bd1c-8fb3-4020-9249-a4ac5471624b"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "consumer", "alerts"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "notify_when", "onActiveAlert"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "rule_type_id", ".index-threshold"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "interval", "1m"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "enabled", "true"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "alert_delay", "4"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minSupportedAlertDelayVersion), + Config: testAccResourceAlertingRuleWithAlertDelayUpdate(ruleName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "name", fmt.Sprintf("Updated %s", ruleName)), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "rule_id", "af22bd1c-8fb3-4020-9249-a4ac5471624b"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "consumer", "alerts"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "notify_when", "onActiveAlert"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "rule_type_id", ".index-threshold"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "interval", "10m"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "enabled", "false"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "tags.0", "first"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "tags.1", "second"), + resource.TestCheckResourceAttr("elasticstack_kibana_alerting_rule.test_rule", "alert_delay", "4"), + ), + }, }, }) } @@ -124,6 +155,73 @@ resource "elasticstack_kibana_alerting_rule" "test_rule" { `, name) } +func testAccResourceAlertingRuleWithAlertDelayCreate(name string) string { + return fmt.Sprintf(` +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +resource "elasticstack_kibana_alerting_rule" "test_rule" { + name = "%s" + rule_id = "af22bd1c-8fb3-4020-9249-a4ac5471624b" + consumer = "alerts" + notify_when = "onActiveAlert" + params = jsonencode({ + aggType = "avg" + groupBy = "top" + termSize = 10 + timeWindowSize = 10 + timeWindowUnit = "s" + threshold = [10] + thresholdComparator = ">" + index = ["test-index"] + timeField = "@timestamp" + aggField = "version" + termField = "name" + }) + rule_type_id = ".index-threshold" + interval = "1m" + enabled = true + alert_delay = 4 +} + `, name) +} + +func testAccResourceAlertingRuleWithAlertDelayUpdate(name string) string { + return fmt.Sprintf(` +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +resource "elasticstack_kibana_alerting_rule" "test_rule" { + name = "Updated %s" + rule_id = "af22bd1c-8fb3-4020-9249-a4ac5471624b" + consumer = "alerts" + notify_when = "onActiveAlert" + params = jsonencode({ + aggType = "avg" + groupBy = "top" + termSize = 10 + timeWindowSize = 10 + timeWindowUnit = "s" + threshold = [10] + thresholdComparator = ">" + index = ["test-index"] + timeField = "@timestamp" + aggField = "version" + termField = "name" + }) + rule_type_id = ".index-threshold" + interval = "10m" + enabled = false + tags = ["first", "second"] + alert_delay = 4 +} + `, name) +} + func checkResourceAlertingRuleDestroy(s *terraform.State) error { client, err := clients.NewAcceptanceTestingClient() if err != nil { diff --git a/internal/models/alert_rule.go b/internal/models/alert_rule.go index 9fdca956b..1bbae824a 100644 --- a/internal/models/alert_rule.go +++ b/internal/models/alert_rule.go @@ -7,7 +7,7 @@ type AlertingRule struct { SpaceID string Name string Consumer string - NotifyWhen string + NotifyWhen *string Params map[string]interface{} RuleTypeID string Schedule AlertingRuleSchedule @@ -18,6 +18,7 @@ type AlertingRule struct { ScheduledTaskID *string ExecutionStatus AlertingRuleExecutionStatus + AlertDelay *float32 } type AlertingRuleSchedule struct {