Skip to content

Commit

Permalink
Merge pull request #718 from SumoLogic/SUMO-254230-unable-to-create-p…
Browse files Browse the repository at this point in the history
…artition-in-flex-org-without-mentioning-partiition

create partitions api payload changes
  • Loading branch information
ErikAtSumo authored Jan 24, 2025
2 parents 5a1e5b0 + c5fde93 commit 787d726
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
10 changes: 9 additions & 1 deletion sumologic/resource_sumologic_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ func resourceToPartition(d *schema.ResourceData) Partition {
analyticsTier := strings.ToLower(d.Get("analytics_tier").(string))
isIncludedInDefaultSearch := d.Get("is_included_in_default_search").(bool)

var analyticsTierPtr *string

if analyticsTier == "" {
analyticsTierPtr = nil
} else {
analyticsTierPtr = &analyticsTier
}

var isIncludedInDefaultSearchPtr *bool
if analyticsTier == "flex" || analyticsTier == "" {
isIncludedInDefaultSearchPtr = new(bool)
Expand All @@ -164,7 +172,7 @@ func resourceToPartition(d *schema.ResourceData) Partition {
ID: d.Id(),
Name: d.Get("name").(string),
RoutingExpression: d.Get("routing_expression").(string),
AnalyticsTier: analyticsTier,
AnalyticsTier: analyticsTierPtr,
RetentionPeriod: d.Get("retention_period").(int),
IsCompliant: d.Get("is_compliant").(bool),
DataForwardingId: d.Get("data_forwarding_id").(string),
Expand Down
24 changes: 12 additions & 12 deletions sumologic/sumologic_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ func (s *Client) UpdatePartition(spartition Partition) error {
}

type Partition struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
RoutingExpression string `json:"routingExpression,omitempty"`
AnalyticsTier string `json:"analyticsTier"`
RetentionPeriod int `json:"retentionPeriod"`
IsCompliant bool `json:"isCompliant"`
DataForwardingId string `json:"dataForwardingId"`
IsActive bool `json:"isActive"`
TotalBytes int `json:"totalBytes"`
IndexType string `json:"indexType"`
ReduceRetentionPeriodImmediately bool `json:"reduceRetentionPeriodImmediately,omitempty"`
IsIncludedInDefaultSearch *bool `json:"isIncludedInDefaultSearch,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name"`
RoutingExpression string `json:"routingExpression,omitempty"`
AnalyticsTier *string `json:"analyticsTier"`
RetentionPeriod int `json:"retentionPeriod"`
IsCompliant bool `json:"isCompliant"`
DataForwardingId string `json:"dataForwardingId"`
IsActive bool `json:"isActive"`
TotalBytes int `json:"totalBytes"`
IndexType string `json:"indexType"`
ReduceRetentionPeriodImmediately bool `json:"reduceRetentionPeriodImmediately,omitempty"`
IsIncludedInDefaultSearch *bool `json:"isIncludedInDefaultSearch,omitempty"`
}

0 comments on commit 787d726

Please sign in to comment.