Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
talsabagport committed May 1, 2024
1 parent 12ffb73 commit cc42738
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 585 deletions.
84 changes: 0 additions & 84 deletions port/action/actionStateToPortBody.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
77 changes: 24 additions & 53 deletions port/action/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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"`
Expand All @@ -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"`
Expand Down
81 changes: 0 additions & 81 deletions port/action/refreshActionState.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
Loading

0 comments on commit cc42738

Please sign in to comment.