From cc42738a56e260fd2779d74717fab0ad99742f9d Mon Sep 17 00:00:00 2001 From: talsabagport Date: Wed, 1 May 2024 13:23:09 +0300 Subject: [PATCH] remove comments --- port/action/actionStateToPortBody.go | 84 ----------- port/action/model.go | 77 +++------- port/action/refreshActionState.go | 81 ---------- port/action/resource_test.go | 212 --------------------------- port/action/schema.go | 155 -------------------- 5 files changed, 24 insertions(+), 585 deletions(-) diff --git a/port/action/actionStateToPortBody.go b/port/action/actionStateToPortBody.go index 282e32d3..5d4228ec 100644 --- a/port/action/actionStateToPortBody.go +++ b/port/action/actionStateToPortBody.go @@ -101,59 +101,6 @@ func triggerToBody(ctx context.Context, data *ActionModel) (*cli.Trigger, error) return selfServiceTrigger, nil } - // TODO: return when frontend for automations is ready - //if data.AutomationTrigger != nil { - // automationTrigger := &cli.Trigger{ - // Type: consts.Automation, - // } - // - // if data.AutomationTrigger.JqCondition != nil { - // automationTrigger.Condition = &cli.TriggerCondition{ - // Type: consts.JqCondition, - // Expressions: flex.TerraformStringListToGoArray(data.AutomationTrigger.JqCondition.Expressions), - // Combinator: data.AutomationTrigger.JqCondition.Combinator.ValueStringPointer(), - // } - // } - // - // if data.AutomationTrigger.EntityCreatedEvent != nil { - // automationTrigger.Event = &cli.TriggerEvent{ - // Type: consts.EntityCreated, - // BlueprintIdentifier: data.AutomationTrigger.EntityCreatedEvent.BlueprintIdentifier.ValueStringPointer(), - // } - // } - // - // if data.AutomationTrigger.EntityUpdatedEvent != nil { - // automationTrigger.Event = &cli.TriggerEvent{ - // Type: consts.EntityUpdated, - // BlueprintIdentifier: data.AutomationTrigger.EntityUpdatedEvent.BlueprintIdentifier.ValueStringPointer(), - // } - // } - // - // if data.AutomationTrigger.EntityDeletedEvent != nil { - // automationTrigger.Event = &cli.TriggerEvent{ - // Type: consts.EntityDeleted, - // BlueprintIdentifier: data.AutomationTrigger.EntityDeletedEvent.BlueprintIdentifier.ValueStringPointer(), - // } - // } - // - // if data.AutomationTrigger.AnyEntityChangeEvent != nil { - // automationTrigger.Event = &cli.TriggerEvent{ - // Type: consts.AnyEntityChange, - // BlueprintIdentifier: data.AutomationTrigger.AnyEntityChangeEvent.BlueprintIdentifier.ValueStringPointer(), - // } - // } - // - // if data.AutomationTrigger.TimerPropertyExpiredEvent != nil { - // automationTrigger.Event = &cli.TriggerEvent{ - // Type: consts.TimerPropertyExpired, - // BlueprintIdentifier: data.AutomationTrigger.TimerPropertyExpiredEvent.BlueprintIdentifier.ValueStringPointer(), - // PropertyIdentifier: data.AutomationTrigger.TimerPropertyExpiredEvent.PropertyIdentifier.ValueStringPointer(), - // } - // } - // - // return automationTrigger, nil - //} - return nil, nil } @@ -301,36 +248,5 @@ func invocationMethodToBody(ctx context.Context, data *ActionModel) (*cli.Invoca return azureInvocation, nil } - // TODO: return when frontend for upsert entity is ready - //if data.UpsertEntityMethod != nil { - // var team interface{} - // if data.UpsertEntityMethod.Teams != nil { - // team = flex.TerraformStringListToGoArray(data.UpsertEntityMethod.Teams) - // } - // p, err := utils.TerraformStringToGoObject(data.UpsertEntityMethod.Properties) - // if err != nil { - // return nil, err - // } - // properties, _ := p.(map[string]interface{}) - // r, err := utils.TerraformStringToGoObject(data.UpsertEntityMethod.Relations) - // if err != nil { - // return nil, err - // } - // relations, _ := r.(map[string]interface{}) - // - // upsertEntityInvocation := &cli.InvocationMethod{ - // Type: consts.UpsertEntity, - // Identifier: data.UpsertEntityMethod.Identifier.ValueStringPointer(), - // Title: data.UpsertEntityMethod.Title.ValueStringPointer(), - // BlueprintIdentifier: data.UpsertEntityMethod.BlueprintIdentifier.ValueStringPointer(), - // Team: team, - // Icon: data.UpsertEntityMethod.Icon.ValueStringPointer(), - // Properties: properties, - // Relations: relations, - // } - // - // return upsertEntityInvocation, nil - //} - return nil, nil } diff --git a/port/action/model.go b/port/action/model.go index 7e591847..8ace9dc9 100644 --- a/port/action/model.go +++ b/port/action/model.go @@ -303,16 +303,6 @@ type JqConditionModel struct { Combinator types.String `tfsdk:"combinator"` } -// TODO: return when frontend for automations is ready -//type AutomationTriggerModel struct { -// EntityCreatedEvent *EntityCreatedEventModel `tfsdk:"entity_created_event"` -// EntityUpdatedEvent *EntityUpdatedEventModel `tfsdk:"entity_updated_event"` -// EntityDeletedEvent *EntityDeletedEventModel `tfsdk:"entity_deleted_event"` -// AnyEntityChangeEvent *AnyEntityChangeEventModel `tfsdk:"any_entity_change_event"` -// TimerPropertyExpiredEvent *TimerPropertyExpiredEventModel `tfsdk:"timer_property_expired_event"` -// JqCondition *JqConditionModel `tfsdk:"jq_condition"` -//} - type KafkaMethodModel struct { Payload types.String `tfsdk:"payload"` } @@ -347,39 +337,24 @@ type AzureMethodModel struct { Payload types.String `tfsdk:"payload"` } -// TODO: return when frontend for upsert entity is ready -//type UpsertEntityMethodModel struct { -// Identifier types.String `tfsdk:"identifier"` -// Title types.String `tfsdk:"title"` -// BlueprintIdentifier types.String `tfsdk:"blueprint_identifier"` -// Teams []types.String `tfsdk:"teams"` -// Icon types.String `tfsdk:"icon"` -// Properties types.String `tfsdk:"properties"` -// Relations types.String `tfsdk:"relations"` -//} - type ApprovalWebhookNotificationModel struct { Url types.String `tfsdk:"url"` Format types.String `tfsdk:"format"` } type ActionModel struct { - ID types.String `tfsdk:"id"` - Identifier types.String `tfsdk:"identifier"` - Blueprint types.String `tfsdk:"blueprint"` - Title types.String `tfsdk:"title"` - Icon types.String `tfsdk:"icon"` - Description types.String `tfsdk:"description"` - SelfServiceTrigger *SelfServiceTriggerModel `tfsdk:"self_service_trigger"` - // TODO: return when frontend for automations is ready - //AutomationTrigger *AutomationTriggerModel `tfsdk:"automation_trigger"` - KafkaMethod *KafkaMethodModel `tfsdk:"kafka_method"` - WebhookMethod *WebhookMethodModel `tfsdk:"webhook_method"` - GithubMethod *GithubMethodModel `tfsdk:"github_method"` - GitlabMethod *GitlabMethodModel `tfsdk:"gitlab_method"` - AzureMethod *AzureMethodModel `tfsdk:"azure_method"` - // TODO: return when frontend for upsert entity is ready - //UpsertEntityMethod *UpsertEntityMethodModel `tfsdk:"upsert_entity_method"` + ID types.String `tfsdk:"id"` + Identifier types.String `tfsdk:"identifier"` + Blueprint types.String `tfsdk:"blueprint"` + Title types.String `tfsdk:"title"` + Icon types.String `tfsdk:"icon"` + Description types.String `tfsdk:"description"` + SelfServiceTrigger *SelfServiceTriggerModel `tfsdk:"self_service_trigger"` + KafkaMethod *KafkaMethodModel `tfsdk:"kafka_method"` + WebhookMethod *WebhookMethodModel `tfsdk:"webhook_method"` + GithubMethod *GithubMethodModel `tfsdk:"github_method"` + GitlabMethod *GitlabMethodModel `tfsdk:"gitlab_method"` + AzureMethod *AzureMethodModel `tfsdk:"azure_method"` RequiredApproval types.Bool `tfsdk:"required_approval"` ApprovalWebhookNotification *ApprovalWebhookNotificationModel `tfsdk:"approval_webhook_notification"` ApprovalEmailNotification types.Object `tfsdk:"approval_email_notification"` @@ -388,22 +363,18 @@ type ActionModel struct { // ActionValidationModel is a model used for the validation of ActionModel resources type ActionValidationModel struct { - ID types.String `tfsdk:"id"` - Identifier types.String `tfsdk:"identifier"` - Blueprint types.String `tfsdk:"blueprint"` - Title types.String `tfsdk:"title"` - Icon types.String `tfsdk:"icon"` - Description types.String `tfsdk:"description"` - SelfServiceTrigger types.Object `tfsdk:"self_service_trigger"` - // TODO: return when frontend for automations is ready - //AutomationTrigger types.Object `tfsdk:"automation_trigger"` - KafkaMethod types.Object `tfsdk:"kafka_method"` - WebhookMethod types.Object `tfsdk:"webhook_method"` - GithubMethod types.Object `tfsdk:"github_method"` - GitlabMethod types.Object `tfsdk:"gitlab_method"` - AzureMethod types.Object `tfsdk:"azure_method"` - // TODO: return when frontend for upsert entity is ready - //UpsertEntityMethod types.Object `tfsdk:"upsert_entity_method"` + ID types.String `tfsdk:"id"` + Identifier types.String `tfsdk:"identifier"` + Blueprint types.String `tfsdk:"blueprint"` + Title types.String `tfsdk:"title"` + Icon types.String `tfsdk:"icon"` + Description types.String `tfsdk:"description"` + SelfServiceTrigger types.Object `tfsdk:"self_service_trigger"` + KafkaMethod types.Object `tfsdk:"kafka_method"` + WebhookMethod types.Object `tfsdk:"webhook_method"` + GithubMethod types.Object `tfsdk:"github_method"` + GitlabMethod types.Object `tfsdk:"gitlab_method"` + AzureMethod types.Object `tfsdk:"azure_method"` RequiredApproval types.Bool `tfsdk:"required_approval"` ApprovalWebhookNotification types.Object `tfsdk:"approval_webhook_notification"` ApprovalEmailNotification types.Object `tfsdk:"approval_email_notification"` diff --git a/port/action/refreshActionState.go b/port/action/refreshActionState.go index 32eefc13..c2b50637 100644 --- a/port/action/refreshActionState.go +++ b/port/action/refreshActionState.go @@ -97,38 +97,6 @@ func writeInvocationMethodToResource(ctx context.Context, a *cli.Action, state * } } - // TODO: return when frontend for upsert entity is ready - //if a.InvocationMethod.Type == consts.UpsertEntity { - // var teams []types.String - // switch team := a.InvocationMethod.Team.(type) { - // case string: - // teams = append(teams, types.StringValue(team)) - // case []interface{}: - // teams = make([]types.String, 0) - // for _, t := range team { - // teams = append(teams, types.StringValue(t.(string))) - // } - // } - // properties, err := utils.GoObjectToTerraformString(a.InvocationMethod.Properties) - // if err != nil { - // return err - // } - // relations, err := utils.GoObjectToTerraformString(a.InvocationMethod.Relations) - // if err != nil { - // return err - // } - // - // state.UpsertEntityMethod = &UpsertEntityMethodModel{ - // Identifier: types.StringValue(*a.InvocationMethod.Identifier), - // Title: flex.GoStringToFramework(a.InvocationMethod.Title), - // BlueprintIdentifier: types.StringValue(*a.InvocationMethod.BlueprintIdentifier), - // Teams: teams, - // Icon: flex.GoStringToFramework(a.InvocationMethod.Icon), - // Properties: properties, - // Relations: relations, - // } - //} - return nil } @@ -329,55 +297,6 @@ func writeTriggerToResource(ctx context.Context, a *cli.Action, state *ActionMod } } - // TODO: return when frontend for automations is ready - //if a.Trigger.Type == consts.Automation { - // automationTrigger := &AutomationTriggerModel{} - // - // var expressions []types.String - // if a.Trigger.Condition != nil { - // for _, e := range a.Trigger.Condition.Expressions { - // expressions = append(expressions, types.StringValue(e)) - // } - // automationTrigger.JqCondition = &JqConditionModel{ - // Expressions: expressions, - // Combinator: flex.GoStringToFramework(a.Trigger.Condition.Combinator), - // } - // } - // - // if a.Trigger.Event.Type == consts.EntityCreated { - // automationTrigger.EntityCreatedEvent = &EntityCreatedEventModel{ - // BlueprintIdentifier: types.StringValue(*a.Trigger.Event.BlueprintIdentifier), - // } - // } - // - // if a.Trigger.Event.Type == consts.EntityUpdated { - // automationTrigger.EntityUpdatedEvent = &EntityUpdatedEventModel{ - // BlueprintIdentifier: types.StringValue(*a.Trigger.Event.BlueprintIdentifier), - // } - // } - // - // if a.Trigger.Event.Type == consts.EntityDeleted { - // automationTrigger.EntityDeletedEvent = &EntityDeletedEventModel{ - // BlueprintIdentifier: types.StringValue(*a.Trigger.Event.BlueprintIdentifier), - // } - // } - // - // if a.Trigger.Event.Type == consts.AnyEntityChange { - // automationTrigger.AnyEntityChangeEvent = &AnyEntityChangeEventModel{ - // BlueprintIdentifier: types.StringValue(*a.Trigger.Event.BlueprintIdentifier), - // } - // } - // - // if a.Trigger.Event.Type == consts.TimerPropertyExpired { - // automationTrigger.TimerPropertyExpiredEvent = &TimerPropertyExpiredEventModel{ - // BlueprintIdentifier: types.StringValue(*a.Trigger.Event.BlueprintIdentifier), - // PropertyIdentifier: types.StringValue(*a.Trigger.Event.PropertyIdentifier), - // } - // } - // - // state.AutomationTrigger = automationTrigger - //} - return nil } diff --git a/port/action/resource_test.go b/port/action/resource_test.go index aef895da..20fd2c4e 100644 --- a/port/action/resource_test.go +++ b/port/action/resource_test.go @@ -398,55 +398,6 @@ func TestAccPortActionAzureInvocation(t *testing.T) { }) } -// TODO: return when frontend for upsert entity is ready -//func TestAccPortActionUpsertEntityInvocation(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// self_service_trigger = { -// operation = "DAY-2" -// blueprint_identifier = port_blueprint.microservice.identifier -// } -// upsert_entity_method = { -// identifier = "test-entity" -// title = "Test Entity" -// blueprint_identifier = port_blueprint.microservice.identifier -// teams = [] -// icon = "Terraform" -// properties = jsonencode({"text": "test"}) -// relations = jsonencode({"test-rel": "target-bp"}) -// } -// }`, actionIdentifier) -// -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.blueprint_identifier", identifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "self_service_trigger.operation", "DAY-2"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.identifier", "test-entity"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.title", "Test Entity"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.blueprint_identifier", identifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.teams.#", "0"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.properties", "{\"text\":\"test\"}"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "upsert_entity_method.relations", "{\"test-rel\":\"target-bp\"}"), -// ), -// }, -// }, -// }) -//} - func TestAccPortActionImport(t *testing.T) { blueprintIdentifier := utils.GenID() actionIdentifier := utils.GenID() @@ -1404,169 +1355,6 @@ func TestAccPortActionRequiredFalseAndNull(t *testing.T) { }) } -// TODO: return when frontend for automations is ready -//func TestAccPortAutomationEntityCreated(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// automation_trigger = { -// entity_created_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// } -// } -// kafka_method = {} -// }`, actionIdentifier) -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.entity_created_event.blueprint_identifier", identifier), -// ), -// }, -// }, -// }) -//} -// -//func TestAccPortAutomationEntityUpdated(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// automation_trigger = { -// entity_updated_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// } -// } -// kafka_method = {} -// }`, actionIdentifier) -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.entity_updated_event.blueprint_identifier", identifier), -// ), -// }, -// }, -// }) -//} -// -//func TestAccPortAutomationEntityDeleted(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// automation_trigger = { -// entity_deleted_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// } -// } -// kafka_method = {} -// }`, actionIdentifier) -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.entity_deleted_event.blueprint_identifier", identifier), -// ), -// }, -// }, -// }) -//} -// -//func TestAccPortAutomationAnyEntityChange(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// automation_trigger = { -// any_entity_change_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// } -// } -// kafka_method = {} -// }`, actionIdentifier) -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.any_entity_change_event.blueprint_identifier", identifier), -// ), -// }, -// }, -// }) -//} -// -//func TestAccPortAutomationTimerPropertyExpired(t *testing.T) { -// identifier := utils.GenID() -// actionIdentifier := utils.GenID() -// var testAccActionConfigCreate = testAccCreateBlueprintConfig(identifier) + fmt.Sprintf(` -// resource "port_action" "create_microservice" { -// title = "TF Provider Test" -// identifier = "%s" -// icon = "Terraform" -// automation_trigger = { -// timer_property_expired_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// property_identifier = "timer" -// } -// } -// kafka_method = {} -// }`, actionIdentifier) -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { acctest.TestAccPreCheck(t) }, -// ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, -// Steps: []resource.TestStep{ -// { -// Config: acctest.ProviderConfig + testAccActionConfigCreate, -// Check: resource.ComposeTestCheckFunc( -// resource.TestCheckResourceAttr("port_action.create_microservice", "title", "TF Provider Test"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "identifier", actionIdentifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "icon", "Terraform"), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.timer_property_expired_event.blueprint_identifier", identifier), -// resource.TestCheckResourceAttr("port_action.create_microservice", "automation_trigger.timer_property_expired_event.property_identifier", "timer"), -// ), -// }, -// }, -// }) -//} - func TestAccPortWebhookApproval(t *testing.T) { identifier := utils.GenID() actionIdentifier := utils.GenID() diff --git a/port/action/schema.go b/port/action/schema.go index 5bca3300..a1eec1ca 100644 --- a/port/action/schema.go +++ b/port/action/schema.go @@ -130,101 +130,9 @@ func ActionSchema() map[string]schema.Attribute { Validators: []validator.Object{ objectvalidator.ExactlyOneOf( path.MatchRoot("self_service_trigger"), - // TODO: return when frontend for automations is ready - //path.MatchRoot("automation_trigger"), ), }, }, - // TODO: return when frontend for automations is ready - //"automation_trigger": schema.SingleNestedAttribute{ - // MarkdownDescription: "Automation trigger for the action", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "entity_created_event": schema.SingleNestedAttribute{ - // MarkdownDescription: "Entity created event trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "The blueprint identifier of the created entity", - // Required: true, - // }, - // }, - // Validators: []validator.Object{ - // objectvalidator.ExactlyOneOf( - // path.MatchRelative().AtParent().AtName("entity_created_event"), - // path.MatchRelative().AtParent().AtName("entity_updated_event"), - // path.MatchRelative().AtParent().AtName("entity_deleted_event"), - // path.MatchRelative().AtParent().AtName("any_entity_change_event"), - // path.MatchRelative().AtParent().AtName("timer_property_expired_event"), - // ), - // }, - // }, - // "entity_updated_event": schema.SingleNestedAttribute{ - // MarkdownDescription: "Entity updated event trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "The blueprint identifier of the updated entity", - // Required: true, - // }, - // }, - // }, - // "entity_deleted_event": schema.SingleNestedAttribute{ - // MarkdownDescription: "Entity deleted event trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "The blueprint identifier of the deleted entity", - // Required: true, - // }, - // }, - // }, - // "any_entity_change_event": schema.SingleNestedAttribute{ - // MarkdownDescription: "Any entity change event trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "The blueprint identifier of the changed entity", - // Required: true, - // }, - // }, - // }, - // "timer_property_expired_event": schema.SingleNestedAttribute{ - // MarkdownDescription: "Timer property expired event trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "The blueprint identifier of the expired timer property", - // Required: true, - // }, - // "property_identifier": schema.StringAttribute{ - // MarkdownDescription: "The property identifier of the expired timer property", - // Required: true, - // }, - // }, - // }, - // "jq_condition": schema.SingleNestedAttribute{ - // MarkdownDescription: "JQ condition for automation trigger", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "expressions": schema.ListAttribute{ - // MarkdownDescription: "The jq expressions of the condition", - // ElementType: types.StringType, - // Required: true, - // }, - // "combinator": schema.StringAttribute{ - // MarkdownDescription: "The combinator of the condition", - // Optional: true, - // Computed: true, - // Default: stringdefault.StaticString("and"), - // Validators: []validator.String{ - // stringvalidator.OneOf("and", "or"), - // }, - // }, - // }, - // }, - // }, - //}, "kafka_method": schema.SingleNestedAttribute{ MarkdownDescription: "Kafka invocation method", Optional: true, @@ -241,8 +149,6 @@ func ActionSchema() map[string]schema.Attribute { path.MatchRoot("github_method"), path.MatchRoot("gitlab_method"), path.MatchRoot("azure_method"), - // TODO: return when frontend for upsert entity is ready - //path.MatchRoot("upsert_entity_method"), ), }, }, @@ -346,42 +252,6 @@ func ActionSchema() map[string]schema.Attribute { }, }, }, - // TODO: return when frontend for upsert entity is ready - //"upsert_entity_method": schema.SingleNestedAttribute{ - // MarkdownDescription: "Upsert Entity invocation method", - // Optional: true, - // Attributes: map[string]schema.Attribute{ - // "identifier": schema.StringAttribute{ - // MarkdownDescription: "Required when selecting type Upsert Entity. The entity identifier for the upsert", - // Required: true, - // }, - // "title": schema.StringAttribute{ - // MarkdownDescription: "The title of the entity", - // Optional: true, - // }, - // "blueprint_identifier": schema.StringAttribute{ - // MarkdownDescription: "Required when selecting type Upsert Entity. The blueprint identifier of the entity for the upsert", - // Required: true, - // }, - // "teams": schema.ListAttribute{ - // MarkdownDescription: "The teams the entity belongs to", - // ElementType: types.StringType, - // Optional: true, - // }, - // "icon": schema.StringAttribute{ - // MarkdownDescription: "The icon of the entity", - // Optional: true, - // }, - // "properties": schema.StringAttribute{ - // MarkdownDescription: "The properties of the entity (key-value object encoded to a string)", - // Optional: true, - // }, - // "relations": schema.StringAttribute{ - // MarkdownDescription: "The relations of the entity (key-value object encoded to a string)", - // Optional: true, - // }, - // }, - //}, "required_approval": schema.BoolAttribute{ MarkdownDescription: "Require approval before invoking the action", Optional: true, @@ -1097,28 +967,3 @@ resource "port_action" "create_microservice" { }) } }` + "\n```" - -// TODO: return when frontend for automations is ready -//+ ` -// -//## Example Usage with Automation trigger -// -//Port allows setting an automation trigger to an action, for executing an action based on event occurred to an entity in Port. -// -//` + "```hcl" + ` -//resource "port_action" "delete_temporary_microservice" { -// title = "Delete Temporary Microservice" -// identifier = "delete-temp-microservice" -// icon = "Terraform" -// automation_trigger = { -// timer_property_expired_event = { -// blueprint_identifier = port_blueprint.microservice.identifier -// property_identifier = "ttl" -// } -// } -// kafka_method = { -// payload = jsonencode({ -// runId: "{{"{{.run.id}}"}}" -// }) -// } -//}` + "\n```"