-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Aggregation Property resource to Aggregation Properties resource #99
Change Aggregation Property resource to Aggregation Properties resource #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! left some comments 🚀
return | ||
} | ||
|
||
//blueprintIdentifier := state.BlueprintIdentifier.ValueString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment
internal/cli/blueprint.go
Outdated
@@ -66,6 +66,27 @@ func (c *PortClient) UpdateBlueprint(ctx context.Context, b *Blueprint, id strin | |||
return &pb.Blueprint, nil | |||
} | |||
|
|||
func (c *PortClient) PatchBlueprint(ctx context.Context, b *Blueprint, id string) (*Blueprint, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not being used (?)
return | ||
} | ||
|
||
err = refreshAggregationPropertyState(state, bp.AggregationProperties) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why refresh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
return | ||
} | ||
|
||
err = refreshAggregationPropertyState(state, bp.AggregationProperties) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why refresh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
for aggregationPropertyIdentifier, aggregationProperty := range aggregationProperties { | ||
|
||
state.Properties[aggregationPropertyIdentifier] = &AggregationPropertyModel{ | ||
types.StringPointerValue(aggregationProperty.Title), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to specify the struct keys explicitly
} | ||
|
||
if aggregationProperty.Query != nil { | ||
query, err := json.Marshal(aggregationProperty.Query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can use GoObjectToTerraformString
util
"func": "count", | ||
"calculationBy": "entities", | ||
} | ||
} else if aggregationProperty.Method.AverageEntities != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The elses are redundant no? Can be just serial ifs
MarkdownDescription: "Function to count the entities of the target entities", | ||
Optional: true, | ||
Validators: []validator.Bool{ | ||
boolvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("average_entities")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want ExactlyOneOf
and not ConflictsWith
, because otherwise you also support an empty method. And also using ExactlyOneOf
you can specify the validators once (maybe right also with ConflictsWith
)
icon = "Terraform" | ||
identifier = "%s" | ||
description = "" | ||
relations = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something seems not right with the identation of relations throughout the file, it seems like because here the indentation is with spaces, and other places with tabs
parentBlueprintIdentifier := utils.GenID() | ||
childBlueprintIdentifier := utils.GenID() | ||
var testAccActionConfigCreate = fmt.Sprintf(` | ||
resource "port_blueprint" "parent_blueprint" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can extract the parent and child blueprint definition and reuse, it will be more difficult to maintain it in the future like this
Description
What -
Why -
How -
Type of change
Please leave one option from the following and delete the rest: