-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(teams): enable on IBM secure (#361)
- Loading branch information
1 parent
af3f215
commit edc0967
Showing
8 changed files
with
124 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build tf_acc_ibm_secure | ||
|
||
package buildinfo | ||
|
||
func init() { | ||
IBMSecure = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ var ( | |
SysdigMonitor bool | ||
SysdigSecure bool | ||
IBMMonitor bool | ||
IBMSecure bool | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package sysdig | ||
|
||
import ( | ||
v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func resourceSysdigTeamReadIBM(d *schema.ResourceData, t *v2.Team) { | ||
var ibmPlatformMetrics *string | ||
if t.NamespaceFilters != nil { | ||
ibmPlatformMetrics = t.NamespaceFilters.IBMPlatformMetrics | ||
} | ||
_ = d.Set("enable_ibm_platform_metrics", t.CanUseBeaconMetrics) | ||
_ = d.Set("ibm_platform_metrics", ibmPlatformMetrics) | ||
} | ||
|
||
func updateNamespaceFilters(filters *v2.NamespaceFilters, update v2.NamespaceFilters) *v2.NamespaceFilters { | ||
if filters == nil { | ||
filters = &v2.NamespaceFilters{} | ||
} | ||
|
||
if update.IBMPlatformMetrics != nil { | ||
filters.IBMPlatformMetrics = update.IBMPlatformMetrics | ||
} | ||
|
||
return filters | ||
} | ||
|
||
func teamFromResourceDataIBM(d *schema.ResourceData, t *v2.Team) { | ||
canUseBeaconMetrics := d.Get("enable_ibm_platform_metrics").(bool) | ||
t.CanUseBeaconMetrics = &canUseBeaconMetrics | ||
|
||
if v, ok := d.GetOk("ibm_platform_metrics"); ok { | ||
metrics := v.(string) | ||
t.NamespaceFilters = updateNamespaceFilters(t.NamespaceFilters, v2.NamespaceFilters{ | ||
IBMPlatformMetrics: &metrics, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters