From 8719cf3ee5c857ef733f84fe69effce43436133f Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 5 Sep 2023 14:43:55 -0700 Subject: [PATCH 1/6] SSPROD-29302: Provider support for organization resource --- sysdig/internal/client/v2/model.go | 26 +++ sysdig/internal/client/v2/organization.go | 108 +++++++++++++ sysdig/internal/client/v2/sysdig.go | 1 + sysdig/provider.go | 1 + sysdig/resource_sysdig_secure_organization.go | 151 ++++++++++++++++++ 5 files changed, 287 insertions(+) create mode 100644 sysdig/internal/client/v2/organization.go create mode 100644 sysdig/resource_sysdig_secure_organization.go diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index 0094d81a..312842c9 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -777,3 +777,29 @@ type SilenceRule struct { Version int `json:"version,omitempty"` ID int `json:"id,omitempty"` } + +type CloudAccountSecure2 struct { +} + +type Timestamp struct { + Seconds int64 `json:"seconds,omitempty"` + Nanos int32 `json:"nanos,omitempty"` +} + +type OrganizationSecure struct { + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + ManagementAccountId string `json:"management_account_id,omitempty"` + Accounts []*CloudAccountSecure2 `json:"accounts,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ProviderId string `json:"provider_id,omitempty"` // cloud provider's organization identifier + Provider int32 `json:"provider,omitempty"` // cloud provider type + CustomerId uint64 `json:"customer_id,omitempty"` // the associated customer id + OrganizationalUnitIds []string `json:"organizational_unit_ids,omitempty"` +} + +// TODO: Required only if we need to expose this out +type OrganizationSecureList struct { + Organizations []*OrganizationSecure `json:"organizations,omitempty"` +} diff --git a/sysdig/internal/client/v2/organization.go b/sysdig/internal/client/v2/organization.go new file mode 100644 index 00000000..24c323a4 --- /dev/null +++ b/sysdig/internal/client/v2/organization.go @@ -0,0 +1,108 @@ +package v2 + +import ( + "context" + "fmt" + "net/http" +) + +const ( + organizationsPath = "%s/api/cloudauth/v1/organizations" + organizationPath = "%s/api/cloudauth/v1/organizations/%s" +) + +type OrganizationSecureInterface interface { + Base + CreateOrganizationSecure(ctx context.Context, org *OrganizationSecure) (*OrganizationSecure, error) + GetOrganizationSecure(ctx context.Context, orgID string) (*OrganizationSecure, error) + DeleteOrganizationSecure(ctx context.Context, orgID string) error + UpdateOrganizationSecure(ctx context.Context, orgID string, org *OrganizationSecure) (*OrganizationSecure, error) + ListOrganizationsSecure(ctx context.Context) (*OrganizationSecureList, error) // TODO: Not sure if we need this from TF +} + +func (client *Client) CreateOrganizationSecure(ctx context.Context, org *OrganizationSecure) (*OrganizationSecure, error) { + payload, err := Marshal(org) + if err != nil { + return nil, err + } + + response, err := client.requester.Request(ctx, http.MethodPost, client.organizationsURL(), payload) + if err != nil { + return nil, err + } + defer response.Body.Close() + + if response.StatusCode != http.StatusOK && response.StatusCode != http.StatusCreated { + err = client.ErrorFromResponse(response) + return nil, err + } + + return Unmarshal[*OrganizationSecure](response.Body) +} + +func (client *Client) GetOrganizationSecure(ctx context.Context, orgID string) (*OrganizationSecure, error) { + response, err := client.requester.Request(ctx, http.MethodGet, client.organizationURL(orgID), nil) + if err != nil { + return nil, err + } + defer response.Body.Close() + + if response.StatusCode != http.StatusOK { + return nil, client.ErrorFromResponse(response) + } + + return Unmarshal[*OrganizationSecure](response.Body) +} + +func (client *Client) DeleteOrganizationSecure(ctx context.Context, orgID string) error { + response, err := client.requester.Request(ctx, http.MethodDelete, client.organizationURL(orgID), nil) + if err != nil { + return err + } + defer response.Body.Close() + + if response.StatusCode != http.StatusNoContent && response.StatusCode != http.StatusOK { + return client.ErrorFromResponse(response) + } + return nil +} + +func (client *Client) UpdateOrganizationSecure(ctx context.Context, orgID string, org *OrganizationSecure) (*OrganizationSecure, error) { + payload, err := Marshal(org) + if err != nil { + return nil, err + } + + response, err := client.requester.Request(ctx, http.MethodPut, client.organizationURL(orgID), payload) + if err != nil { + return nil, err + } + defer response.Body.Close() + + if response.StatusCode != http.StatusOK { + err = client.ErrorFromResponse(response) + return nil, err + } + + return Unmarshal[*OrganizationSecure](response.Body) +} +func (client *Client) ListOrganizationsSecure(ctx context.Context) ([]OrganizationSecure, error) { + response, err := client.requester.Request(ctx, http.MethodGet, client.organizationsURL(), nil) + if err != nil { + return nil, err + } + defer response.Body.Close() + + if response.StatusCode != http.StatusOK { + return nil, client.ErrorFromResponse(response) + } + + return Unmarshal[[]OrganizationSecure](response.Body) +} +func (client *Client) organizationsURL() string { + return fmt.Sprintf(organizationPath, client.config.url) +} + +func (client *Client) organizationURL(orgId string) string { + return fmt.Sprintf(organizationPath, client.config.url, orgId) +} diff --git a/sysdig/internal/client/v2/sysdig.go b/sysdig/internal/client/v2/sysdig.go index 0e896a0c..12b949a5 100644 --- a/sysdig/internal/client/v2/sysdig.go +++ b/sysdig/internal/client/v2/sysdig.go @@ -43,6 +43,7 @@ type SysdigSecure interface { VulnerabilityExceptionListInterface VulnerabilityExceptionInterface CloudAccountSecureInterface + OrganizationSecureInterface } func (sr *SysdigRequest) Request(ctx context.Context, method string, url string, payload io.Reader) (*http.Response, error) { diff --git a/sysdig/provider.go b/sysdig/provider.go index 47afe8ca..e75654ad 100644 --- a/sysdig/provider.go +++ b/sysdig/provider.go @@ -165,6 +165,7 @@ func Provider() *schema.Provider { "sysdig_monitor_team": resourceSysdigMonitorTeam(), "sysdig_monitor_cloud_account": resourceSysdigMonitorCloudAccount(), "sysdig_secure_posture_zone": resourceSysdigSecurePostureZone(), + "sysdig_secure_organization": resourceSysdigSecureOrganization(), }, DataSourcesMap: map[string]*schema.Resource{ "sysdig_secure_trusted_cloud_identity": dataSourceSysdigSecureTrustedCloudIdentity(), diff --git a/sysdig/resource_sysdig_secure_organization.go b/sysdig/resource_sysdig_secure_organization.go new file mode 100644 index 00000000..31bcbd24 --- /dev/null +++ b/sysdig/resource_sysdig_secure_organization.go @@ -0,0 +1,151 @@ +package sysdig + +import ( + "context" + v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "time" +) + +func resourceSysdigSecureOrganization() *schema.Resource { + timeout := 5 * time.Minute + + return &schema.Resource{ + CreateContext: resourceSysdigSecureOrganizationCreate, + DeleteContext: resourceSysdigSecureOrganizationDelete, + ReadContext: resourceSysdigSecureOrganizationRead, + UpdateContext: resourceSysdigSecureOrganizationUpdate, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(timeout), + Update: schema.DefaultTimeout(timeout), + Read: schema.DefaultTimeout(timeout), + Delete: schema.DefaultTimeout(timeout), + }, + Schema: map[string]*schema.Schema{ + "cloud_provider_id": { + Type: schema.TypeString, + Required: true, + }, + "cloud_provider_type": { + Type: schema.TypeInt, + Required: true, + }, + "customer_id": { + Type: schema.TypeInt, + Required: true, + }, + "organization_id": { + Type: schema.TypeString, + Optional: true, + }, + }, + } +} + +func getSecureOrganizationClient(c SysdigClients) (v2.OrganizationSecureInterface, error) { + return c.sysdigSecureClientV2() +} + +func resourceSysdigSecureOrganizationCreate(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { + client, err := getSecureOrganizationClient(i.(SysdigClients)) + if err != nil { + return diag.FromErr(err) + } + + org := secureOrganizationFromResourceData(data) + + orgCreated, err := client.CreateOrganizationSecure(ctx, &org) + if err != nil { + return diag.FromErr(err) + } + + data.SetId(orgCreated.Id) + + return nil +} + +func resourceSysdigSecureOrganizationDelete(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { + client, err := getSecureOrganizationClient(i.(SysdigClients)) + if err != nil { + return diag.FromErr(err) + } + + err = client.DeleteOrganizationSecure(ctx, data.Id()) + if err != nil { + return diag.FromErr(err) + } + + return nil +} + +func resourceSysdigSecureOrganizationRead(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { + client, err := getSecureOrganizationClient(i.(SysdigClients)) + if err != nil { + return diag.FromErr(err) + } + + org, err := client.GetOrganizationSecure(ctx, data.Id()) + if err != nil { + return diag.FromErr(err) + } + + err = secureOrganizationToResourceData(data, org) + if err != nil { + return diag.FromErr(err) + } + + return nil +} +func resourceSysdigSecureOrganizationUpdate(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { + client, err := getSecureOrganizationClient(i.(SysdigClients)) + if err != nil { + return diag.FromErr(err) + } + + org := secureOrganizationFromResourceData(data) + + _, err = client.UpdateOrganizationSecure(ctx, data.Id(), &org) + if err != nil { + return diag.FromErr(err) + } + + return nil +} + +/* TODO: Make sure these are right inputs for the api */ +func secureOrganizationFromResourceData(data *schema.ResourceData) v2.OrganizationSecure { + return v2.OrganizationSecure{ + Id: data.Get("organization_id").(string), + ProviderId: data.Get("cloud_provider_id").(string), + Provider: data.Get("cloud_provider_type").(int32), + CustomerId: data.Get("customer_id").(uint64), + } +} + +func secureOrganizationToResourceData(data *schema.ResourceData, org *v2.OrganizationSecure) error { + err := data.Set("cloud_provider_id", org.ProviderId) + if err != nil { + return err + } + + err = data.Set("cloud_provider_type", org.Provider) + if err != nil { + return err + } + + err = data.Set("customer_id", org.CustomerId) + if err != nil { + return err + } + + err = data.Set("organization_id", org.Id) + if err != nil { + return err + } + + return nil +} From dce9ad31490a70472d6adeb5ecaac106dcd84951 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 5 Sep 2023 14:59:19 -0700 Subject: [PATCH 2/6] SSPROD-29302: Add comment --- sysdig/internal/client/v2/model.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index 312842c9..772fd5f0 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -779,6 +779,7 @@ type SilenceRule struct { } type CloudAccountSecure2 struct { + // TODO: Temporarily adding this to support till we add CloudAccountSecure here } type Timestamp struct { From 159a8c36e4e9fb5496136010e1f2f8c907ea13b8 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 5 Sep 2023 15:07:11 -0700 Subject: [PATCH 3/6] SSPROD-29302: Correct payload --- sysdig/internal/client/v2/organization.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdig/internal/client/v2/organization.go b/sysdig/internal/client/v2/organization.go index 24c323a4..eb969d1d 100644 --- a/sysdig/internal/client/v2/organization.go +++ b/sysdig/internal/client/v2/organization.go @@ -86,7 +86,7 @@ func (client *Client) UpdateOrganizationSecure(ctx context.Context, orgID string return Unmarshal[*OrganizationSecure](response.Body) } -func (client *Client) ListOrganizationsSecure(ctx context.Context) ([]OrganizationSecure, error) { +func (client *Client) ListOrganizationsSecure(ctx context.Context) (*OrganizationSecureList, error) { response, err := client.requester.Request(ctx, http.MethodGet, client.organizationsURL(), nil) if err != nil { return nil, err @@ -97,7 +97,7 @@ func (client *Client) ListOrganizationsSecure(ctx context.Context) ([]Organizati return nil, client.ErrorFromResponse(response) } - return Unmarshal[[]OrganizationSecure](response.Body) + return Unmarshal[*OrganizationSecureList](response.Body) } func (client *Client) organizationsURL() string { return fmt.Sprintf(organizationPath, client.config.url) From 8210c9bb94a8cd8dc204bb79ae4d00c4d5cf5a2a Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 6 Sep 2023 13:30:06 -0700 Subject: [PATCH 4/6] SSPROD-29302: using proto def --- go.mod | 3 +- go.sum | 53 ++----------------- sysdig/internal/client/v2/model.go | 31 ++--------- sysdig/resource_sysdig_secure_organization.go | 9 ++-- 4 files changed, 17 insertions(+), 79 deletions(-) diff --git a/go.mod b/go.mod index d59310fd..f7ce97bb 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.19 require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/aws/aws-sdk-go v1.44.280 + github.com/draios/protorepo/cloudauth/go v0.0.0-20230901163632-fcbfe0cb84e0 github.com/falcosecurity/kilt/runtimes/cloudformation v0.0.0-20230606123839-2e4c434d5d88 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-retryablehttp v0.7.4 @@ -75,7 +76,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect + google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 13a96b63..54369694 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Jeffail/gabs/v2 v2.7.0 h1:Y2edYaTcE8ZpRsR2AtmPu5xQdFDIthFG0jYhu5PY8kg= @@ -25,8 +24,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/aws/aws-sdk-go v1.44.280 h1:UYl/yxhDxP8naok6ftWyQ9/9ZzNwjC9dvEs/j8BkGhw= github.com/aws/aws-sdk-go v1.44.280/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/containerd/stargz-snapshotter/estargz v0.12.1 h1:+7nYmHJb0tEkcRaAW+MHqoKaJYZmkikupxCqVtmPuY0= github.com/containerd/stargz-snapshotter/estargz v0.12.1/go.mod h1:12VUuCq3qPq4y8yUW+l5w3+oXV3cx2Po3KSe/SmPGqw= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -43,10 +40,10 @@ github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPa github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= +github.com/draios/protorepo/cloudauth/go v0.0.0-20230901163632-fcbfe0cb84e0 h1:LKBglxJ55sl7NuP5IrC/SD89ZQFwN8ejh8XGJ0dj5P0= +github.com/draios/protorepo/cloudauth/go v0.0.0-20230901163632-fcbfe0cb84e0/go.mod h1:JmBZh3AOhz4gg83qMw9p2QDCIiLSH9YCyyvDVClIynU= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/falcosecurity/kilt/pkg v0.0.0-20230111165949-b36cdd622de1 h1:7JOAJwPA4FEtowSP133pgicOu+nOfo0wGuXapXKhafk= github.com/falcosecurity/kilt/pkg v0.0.0-20230111165949-b36cdd622de1/go.mod h1:5vLX/acsvZ4KmzUSewi2KVKt6MAm50NIaPB87ofs9j4= github.com/falcosecurity/kilt/runtimes/cloudformation v0.0.0-20230606123839-2e4c434d5d88 h1:vyeIOHLAt+3rBWVBx+eDYiKgiFwoC32dCAKE86HUQKw= @@ -69,26 +66,15 @@ github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -208,7 +194,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= @@ -263,20 +248,13 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -290,17 +268,14 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -339,10 +314,6 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= @@ -353,24 +324,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc= -google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70= +google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= @@ -393,5 +350,3 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index 772fd5f0..79d1b8cb 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -1,5 +1,9 @@ package v2 +import ( + proto "github.com/draios/protorepo/cloudauth/go" +) + type Team struct { UserRoles []UserRoles `json:"userRoles,omitempty"` Description string `json:"description"` @@ -778,29 +782,4 @@ type SilenceRule struct { ID int `json:"id,omitempty"` } -type CloudAccountSecure2 struct { - // TODO: Temporarily adding this to support till we add CloudAccountSecure here -} - -type Timestamp struct { - Seconds int64 `json:"seconds,omitempty"` - Nanos int32 `json:"nanos,omitempty"` -} - -type OrganizationSecure struct { - Id string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - ManagementAccountId string `json:"management_account_id,omitempty"` - Accounts []*CloudAccountSecure2 `json:"accounts,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ProviderId string `json:"provider_id,omitempty"` // cloud provider's organization identifier - Provider int32 `json:"provider,omitempty"` // cloud provider type - CustomerId uint64 `json:"customer_id,omitempty"` // the associated customer id - OrganizationalUnitIds []string `json:"organizational_unit_ids,omitempty"` -} - -// TODO: Required only if we need to expose this out -type OrganizationSecureList struct { - Organizations []*OrganizationSecure `json:"organizations,omitempty"` -} +type OrganizationSecure proto.CloudOrganization diff --git a/sysdig/resource_sysdig_secure_organization.go b/sysdig/resource_sysdig_secure_organization.go index 31bcbd24..73d3e7b3 100644 --- a/sysdig/resource_sysdig_secure_organization.go +++ b/sysdig/resource_sysdig_secure_organization.go @@ -2,9 +2,11 @@ package sysdig import ( "context" + proto "github.com/draios/protorepo/cloudauth/go" v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "time" ) @@ -31,8 +33,9 @@ func resourceSysdigSecureOrganization() *schema.Resource { Required: true, }, "cloud_provider_type": { - Type: schema.TypeInt, - Required: true, + Type: schema.TypeInt, + Required: true, + ValidateFunc: validation.StringInSlice([]string{proto.Provider_PROVIDER_AWS.String(), proto.Provider_PROVIDER_GCP.String(), proto.Provider_PROVIDER_AZURE.String()}, false), }, "customer_id": { Type: schema.TypeInt, @@ -121,7 +124,7 @@ func secureOrganizationFromResourceData(data *schema.ResourceData) v2.Organizati return v2.OrganizationSecure{ Id: data.Get("organization_id").(string), ProviderId: data.Get("cloud_provider_id").(string), - Provider: data.Get("cloud_provider_type").(int32), + Provider: proto.Provider(data.Get("cloud_provider_type").(int32)), CustomerId: data.Get("customer_id").(uint64), } } From 7c80bb7321e7bb6a48a49ace5f9518630ee7a77e Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 6 Sep 2023 16:17:18 -0700 Subject: [PATCH 5/6] SSPROD-29302: Local copy of pb code --- go.mod | 1 - .../v2/cloudauth/go/cloud_account.pb.go | 649 ++++++++++++++++++ .../v2/cloudauth/go/cloud_organization.pb.go | 258 +++++++ sysdig/internal/client/v2/model.go | 6 +- sysdig/internal/client/v2/organization.go | 13 - sysdig/resource_sysdig_secure_organization.go | 6 +- 6 files changed, 912 insertions(+), 21 deletions(-) create mode 100644 sysdig/internal/client/v2/cloudauth/go/cloud_account.pb.go create mode 100644 sysdig/internal/client/v2/cloudauth/go/cloud_organization.pb.go diff --git a/go.mod b/go.mod index f7ce97bb..f9f1b819 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.19 require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/aws/aws-sdk-go v1.44.280 - github.com/draios/protorepo/cloudauth/go v0.0.0-20230901163632-fcbfe0cb84e0 github.com/falcosecurity/kilt/runtimes/cloudformation v0.0.0-20230606123839-2e4c434d5d88 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-retryablehttp v0.7.4 diff --git a/sysdig/internal/client/v2/cloudauth/go/cloud_account.pb.go b/sysdig/internal/client/v2/cloudauth/go/cloud_account.pb.go new file mode 100644 index 00000000..3b62a5c4 --- /dev/null +++ b/sysdig/internal/client/v2/cloudauth/go/cloud_account.pb.go @@ -0,0 +1,649 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: cloud_account.proto + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Provider enumerates the vendor, platform, and service class of the cloud account +type Provider int32 + +const ( + Provider_PROVIDER_UNSPECIFIED Provider = 0 + Provider_PROVIDER_AWS Provider = 1 + Provider_PROVIDER_AZURE Provider = 2 + Provider_PROVIDER_GCP Provider = 3 + Provider_PROVIDER_OKTA Provider = 4 + Provider_PROVIDER_GITHUB Provider = 5 +) + +// Enum value maps for Provider. +var ( + Provider_name = map[int32]string{ + 0: "PROVIDER_UNSPECIFIED", + 1: "PROVIDER_AWS", + 2: "PROVIDER_AZURE", + 3: "PROVIDER_GCP", + 4: "PROVIDER_OKTA", + 5: "PROVIDER_GITHUB", + } + Provider_value = map[string]int32{ + "PROVIDER_UNSPECIFIED": 0, + "PROVIDER_AWS": 1, + "PROVIDER_AZURE": 2, + "PROVIDER_GCP": 3, + "PROVIDER_OKTA": 4, + "PROVIDER_GITHUB": 5, + } +) + +func (x Provider) Enum() *Provider { + p := new(Provider) + *p = x + return p +} + +func (x Provider) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Provider) Descriptor() protoreflect.EnumDescriptor { + return file_cloud_account_proto_enumTypes[0].Descriptor() +} + +func (Provider) Type() protoreflect.EnumType { + return &file_cloud_account_proto_enumTypes[0] +} + +func (x Provider) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Provider.Descriptor instead. +func (Provider) EnumDescriptor() ([]byte, []int) { + return file_cloud_account_proto_rawDescGZIP(), []int{0} +} + +// Feature enumerates all available feature types across monitor and secure +type Feature int32 + +const ( + Feature_FEATURE_UNSPECIFIED Feature = 0 // noop feature; default value + Feature_FEATURE_SECURE_THREAT_DETECTION Feature = 1 + Feature_FEATURE_SECURE_CONFIG_POSTURE Feature = 2 + Feature_FEATURE_SECURE_IDENTITY_ENTITLEMENT Feature = 3 + Feature_FEATURE_MONITOR_CLOUD_METRICS Feature = 4 + Feature_FEATURE_SECURE_AGENTLESS_SCANNING Feature = 5 +) + +// Enum value maps for Feature. +var ( + Feature_name = map[int32]string{ + 0: "FEATURE_UNSPECIFIED", + 1: "FEATURE_SECURE_THREAT_DETECTION", + 2: "FEATURE_SECURE_CONFIG_POSTURE", + 3: "FEATURE_SECURE_IDENTITY_ENTITLEMENT", + 4: "FEATURE_MONITOR_CLOUD_METRICS", + 5: "FEATURE_SECURE_AGENTLESS_SCANNING", + } + Feature_value = map[string]int32{ + "FEATURE_UNSPECIFIED": 0, + "FEATURE_SECURE_THREAT_DETECTION": 1, + "FEATURE_SECURE_CONFIG_POSTURE": 2, + "FEATURE_SECURE_IDENTITY_ENTITLEMENT": 3, + "FEATURE_MONITOR_CLOUD_METRICS": 4, + "FEATURE_SECURE_AGENTLESS_SCANNING": 5, + } +) + +func (x Feature) Enum() *Feature { + p := new(Feature) + *p = x + return p +} + +func (x Feature) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Feature) Descriptor() protoreflect.EnumDescriptor { + return file_cloud_account_proto_enumTypes[1].Descriptor() +} + +func (Feature) Type() protoreflect.EnumType { + return &file_cloud_account_proto_enumTypes[1] +} + +func (x Feature) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Feature.Descriptor instead. +func (Feature) EnumDescriptor() ([]byte, []int) { + return file_cloud_account_proto_rawDescGZIP(), []int{1} +} + +// CloudAccount captures a snapshot of basic metadata fields associated with a cloud. +type CloudAccount struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // unique identifier for the customer's cloud account + CustomerId uint64 `protobuf:"varint,2,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"` // the associated customer id + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` // enablement of the account + OrganizationId string `protobuf:"bytes,4,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` // string identifier of the owning Cloud Organization + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` // name of the cloud account. typically AWS alias/GCP Project/Azure subscription + ProviderId string `protobuf:"bytes,6,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"` // cloud provider's account identifier + ProviderAlias string `protobuf:"bytes,7,opt,name=provider_alias,json=providerAlias,proto3" json:"provider_alias,omitempty"` // cloud provider's account alias + Provider Provider `protobuf:"varint,8,opt,name=provider,proto3,enum=draiosproto.Provider" json:"provider,omitempty"` // cloud provider type + Feature *AccountFeatures `protobuf:"bytes,9,opt,name=feature,proto3" json:"feature,omitempty"` // features of the account + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // account create time + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // account update time + Components []string `protobuf:"bytes,12,rep,name=components,proto3" json:"components,omitempty"` // string identifiers of installed components +} + +func (x *CloudAccount) Reset() { + *x = CloudAccount{} + if protoimpl.UnsafeEnabled { + mi := &file_cloud_account_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudAccount) ProtoMessage() {} + +func (x *CloudAccount) ProtoReflect() protoreflect.Message { + mi := &file_cloud_account_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudAccount.ProtoReflect.Descriptor instead. +func (*CloudAccount) Descriptor() ([]byte, []int) { + return file_cloud_account_proto_rawDescGZIP(), []int{0} +} + +func (x *CloudAccount) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CloudAccount) GetCustomerId() uint64 { + if x != nil { + return x.CustomerId + } + return 0 +} + +func (x *CloudAccount) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *CloudAccount) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *CloudAccount) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CloudAccount) GetProviderId() string { + if x != nil { + return x.ProviderId + } + return "" +} + +func (x *CloudAccount) GetProviderAlias() string { + if x != nil { + return x.ProviderAlias + } + return "" +} + +func (x *CloudAccount) GetProvider() Provider { + if x != nil { + return x.Provider + } + return Provider_PROVIDER_UNSPECIFIED +} + +func (x *CloudAccount) GetFeature() *AccountFeatures { + if x != nil { + return x.Feature + } + return nil +} + +func (x *CloudAccount) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *CloudAccount) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *CloudAccount) GetComponents() []string { + if x != nil { + return x.Components + } + return nil +} + +type AccountFeatures struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SecureThreatDetection *AccountFeature `protobuf:"bytes,1,opt,name=secure_threat_detection,json=secureThreatDetection,proto3" json:"secure_threat_detection,omitempty"` + SecureConfigPosture *AccountFeature `protobuf:"bytes,2,opt,name=secure_config_posture,json=secureConfigPosture,proto3" json:"secure_config_posture,omitempty"` + SecureIdentityEntitlement *AccountFeature `protobuf:"bytes,3,opt,name=secure_identity_entitlement,json=secureIdentityEntitlement,proto3" json:"secure_identity_entitlement,omitempty"` + MonitorCloudMetrics *AccountFeature `protobuf:"bytes,4,opt,name=monitor_cloud_metrics,json=monitorCloudMetrics,proto3" json:"monitor_cloud_metrics,omitempty"` + SecureAgentlessScanning *AccountFeature `protobuf:"bytes,5,opt,name=secure_agentless_scanning,json=secureAgentlessScanning,proto3" json:"secure_agentless_scanning,omitempty"` +} + +func (x *AccountFeatures) Reset() { + *x = AccountFeatures{} + if protoimpl.UnsafeEnabled { + mi := &file_cloud_account_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccountFeatures) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountFeatures) ProtoMessage() {} + +func (x *AccountFeatures) ProtoReflect() protoreflect.Message { + mi := &file_cloud_account_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccountFeatures.ProtoReflect.Descriptor instead. +func (*AccountFeatures) Descriptor() ([]byte, []int) { + return file_cloud_account_proto_rawDescGZIP(), []int{1} +} + +func (x *AccountFeatures) GetSecureThreatDetection() *AccountFeature { + if x != nil { + return x.SecureThreatDetection + } + return nil +} + +func (x *AccountFeatures) GetSecureConfigPosture() *AccountFeature { + if x != nil { + return x.SecureConfigPosture + } + return nil +} + +func (x *AccountFeatures) GetSecureIdentityEntitlement() *AccountFeature { + if x != nil { + return x.SecureIdentityEntitlement + } + return nil +} + +func (x *AccountFeatures) GetMonitorCloudMetrics() *AccountFeature { + if x != nil { + return x.MonitorCloudMetrics + } + return nil +} + +func (x *AccountFeatures) GetSecureAgentlessScanning() *AccountFeature { + if x != nil { + return x.SecureAgentlessScanning + } + return nil +} + +// AccountFeature captures a sysdig feature enabled on a cloud account +type AccountFeature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type Feature `protobuf:"varint,1,opt,name=type,proto3,enum=draiosproto.Feature" json:"type,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + Available bool `protobuf:"varint,3,opt,name=available,proto3" json:"available,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Components []string `protobuf:"bytes,5,rep,name=components,proto3" json:"components,omitempty"` // string identifiers of components associated with the feature +} + +func (x *AccountFeature) Reset() { + *x = AccountFeature{} + if protoimpl.UnsafeEnabled { + mi := &file_cloud_account_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccountFeature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccountFeature) ProtoMessage() {} + +func (x *AccountFeature) ProtoReflect() protoreflect.Message { + mi := &file_cloud_account_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AccountFeature.ProtoReflect.Descriptor instead. +func (*AccountFeature) Descriptor() ([]byte, []int) { + return file_cloud_account_proto_rawDescGZIP(), []int{2} +} + +func (x *AccountFeature) GetType() Feature { + if x != nil { + return x.Type + } + return Feature_FEATURE_UNSPECIFIED +} + +func (x *AccountFeature) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +func (x *AccountFeature) GetAvailable() bool { + if x != nil { + return x.Available + } + return false +} + +func (x *AccountFeature) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *AccountFeature) GetComponents() []string { + if x != nil { + return x.Components + } + return nil +} + +var File_cloud_account_proto protoreflect.FileDescriptor + +var file_cloud_account_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x03, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, + 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x25, 0x0a, + 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x41, + 0x6c, 0x69, 0x61, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, + 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x65, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x52, 0x07, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xbe, 0x03, 0x0a, 0x0f, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x53, 0x0a, 0x17, 0x73, 0x65, 0x63, + 0x75, 0x72, 0x65, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x64, 0x72, 0x61, + 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x15, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x54, + 0x68, 0x72, 0x65, 0x61, 0x74, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, + 0x0a, 0x15, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, + 0x70, 0x6f, 0x73, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x13, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x6f, 0x73, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x5b, 0x0a, 0x1b, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x52, 0x19, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x15, + 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x64, 0x72, + 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x13, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, + 0x72, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x57, 0x0a, + 0x19, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x6c, 0x65, 0x73, + 0x73, 0x5f, 0x73, 0x63, 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x17, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x6c, 0x65, 0x73, 0x73, 0x53, 0x63, + 0x61, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0xcd, 0x01, 0x0a, 0x0e, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0x84, 0x01, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, + 0x0c, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x41, 0x57, 0x53, 0x10, 0x01, 0x12, + 0x12, 0x0a, 0x0e, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, 0x41, 0x5a, 0x55, 0x52, + 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x52, 0x5f, + 0x47, 0x43, 0x50, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, + 0x52, 0x5f, 0x4f, 0x4b, 0x54, 0x41, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x52, 0x4f, 0x56, + 0x49, 0x44, 0x45, 0x52, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x05, 0x2a, 0xdd, 0x01, + 0x0a, 0x07, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x45, 0x41, + 0x54, 0x55, 0x52, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x45, + 0x43, 0x55, 0x52, 0x45, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x41, 0x54, 0x5f, 0x44, 0x45, 0x54, 0x45, + 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x21, 0x0a, 0x1d, 0x46, 0x45, 0x41, 0x54, 0x55, + 0x52, 0x45, 0x5f, 0x53, 0x45, 0x43, 0x55, 0x52, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, + 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x55, 0x52, 0x45, 0x10, 0x02, 0x12, 0x27, 0x0a, 0x23, 0x46, 0x45, + 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x45, 0x43, 0x55, 0x52, 0x45, 0x5f, 0x49, 0x44, 0x45, + 0x4e, 0x54, 0x49, 0x54, 0x59, 0x5f, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x4c, 0x45, 0x4d, 0x45, 0x4e, + 0x54, 0x10, 0x03, 0x12, 0x21, 0x0a, 0x1d, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f, 0x4d, + 0x4f, 0x4e, 0x49, 0x54, 0x4f, 0x52, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x5f, 0x4d, 0x45, 0x54, + 0x52, 0x49, 0x43, 0x53, 0x10, 0x04, 0x12, 0x25, 0x0a, 0x21, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, + 0x45, 0x5f, 0x53, 0x45, 0x43, 0x55, 0x52, 0x45, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x4c, 0x45, + 0x53, 0x53, 0x5f, 0x53, 0x43, 0x41, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x42, 0x56, 0x0a, + 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x41, 0x75, 0x74, 0x68, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x48, 0x01, 0x5a, 0x25, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x61, + 0x75, 0x74, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cloud_account_proto_rawDescOnce sync.Once + file_cloud_account_proto_rawDescData = file_cloud_account_proto_rawDesc +) + +func file_cloud_account_proto_rawDescGZIP() []byte { + file_cloud_account_proto_rawDescOnce.Do(func() { + file_cloud_account_proto_rawDescData = protoimpl.X.CompressGZIP(file_cloud_account_proto_rawDescData) + }) + return file_cloud_account_proto_rawDescData +} + +var file_cloud_account_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_cloud_account_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_cloud_account_proto_goTypes = []interface{}{ + (Provider)(0), // 0: draiosproto.Provider + (Feature)(0), // 1: draiosproto.Feature + (*CloudAccount)(nil), // 2: draiosproto.CloudAccount + (*AccountFeatures)(nil), // 3: draiosproto.AccountFeatures + (*AccountFeature)(nil), // 4: draiosproto.AccountFeature + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp +} +var file_cloud_account_proto_depIdxs = []int32{ + 0, // 0: draiosproto.CloudAccount.provider:type_name -> draiosproto.Provider + 3, // 1: draiosproto.CloudAccount.feature:type_name -> draiosproto.AccountFeatures + 5, // 2: draiosproto.CloudAccount.created_at:type_name -> google.protobuf.Timestamp + 5, // 3: draiosproto.CloudAccount.updated_at:type_name -> google.protobuf.Timestamp + 4, // 4: draiosproto.AccountFeatures.secure_threat_detection:type_name -> draiosproto.AccountFeature + 4, // 5: draiosproto.AccountFeatures.secure_config_posture:type_name -> draiosproto.AccountFeature + 4, // 6: draiosproto.AccountFeatures.secure_identity_entitlement:type_name -> draiosproto.AccountFeature + 4, // 7: draiosproto.AccountFeatures.monitor_cloud_metrics:type_name -> draiosproto.AccountFeature + 4, // 8: draiosproto.AccountFeatures.secure_agentless_scanning:type_name -> draiosproto.AccountFeature + 1, // 9: draiosproto.AccountFeature.type:type_name -> draiosproto.Feature + 5, // 10: draiosproto.AccountFeature.created_at:type_name -> google.protobuf.Timestamp + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_cloud_account_proto_init() } +func file_cloud_account_proto_init() { + if File_cloud_account_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cloud_account_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudAccount); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cloud_account_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccountFeatures); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cloud_account_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AccountFeature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cloud_account_proto_rawDesc, + NumEnums: 2, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cloud_account_proto_goTypes, + DependencyIndexes: file_cloud_account_proto_depIdxs, + EnumInfos: file_cloud_account_proto_enumTypes, + MessageInfos: file_cloud_account_proto_msgTypes, + }.Build() + File_cloud_account_proto = out.File + file_cloud_account_proto_rawDesc = nil + file_cloud_account_proto_goTypes = nil + file_cloud_account_proto_depIdxs = nil +} diff --git a/sysdig/internal/client/v2/cloudauth/go/cloud_organization.pb.go b/sysdig/internal/client/v2/cloudauth/go/cloud_organization.pb.go new file mode 100644 index 00000000..f9ba2d71 --- /dev/null +++ b/sysdig/internal/client/v2/cloudauth/go/cloud_organization.pb.go @@ -0,0 +1,258 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: cloud_organization.proto + +package v2 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CloudOrganization struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + ManagementAccountId string `protobuf:"bytes,3,opt,name=management_account_id,json=managementAccountId,proto3" json:"management_account_id,omitempty"` + Accounts []*CloudAccount `protobuf:"bytes,4,rep,name=accounts,proto3" json:"accounts,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + ProviderId string `protobuf:"bytes,7,opt,name=provider_id,json=providerId,proto3" json:"provider_id,omitempty"` // cloud provider's organization identifier + Provider Provider `protobuf:"varint,8,opt,name=provider,proto3,enum=draiosproto.Provider" json:"provider,omitempty"` // cloud provider type + CustomerId uint64 `protobuf:"varint,9,opt,name=customer_id,json=customerId,proto3" json:"customer_id,omitempty"` // the associated customer id + OrganizationalUnitIds []string `protobuf:"bytes,10,rep,name=organizational_unit_ids,json=organizationalUnitIds,proto3" json:"organizational_unit_ids,omitempty"` // an optional sub OU to target for the organization +} + +func (x *CloudOrganization) Reset() { + *x = CloudOrganization{} + if protoimpl.UnsafeEnabled { + mi := &file_cloud_organization_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudOrganization) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudOrganization) ProtoMessage() {} + +func (x *CloudOrganization) ProtoReflect() protoreflect.Message { + mi := &file_cloud_organization_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudOrganization.ProtoReflect.Descriptor instead. +func (*CloudOrganization) Descriptor() ([]byte, []int) { + return file_cloud_organization_proto_rawDescGZIP(), []int{0} +} + +func (x *CloudOrganization) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CloudOrganization) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CloudOrganization) GetManagementAccountId() string { + if x != nil { + return x.ManagementAccountId + } + return "" +} + +func (x *CloudOrganization) GetAccounts() []*CloudAccount { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *CloudOrganization) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *CloudOrganization) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *CloudOrganization) GetProviderId() string { + if x != nil { + return x.ProviderId + } + return "" +} + +func (x *CloudOrganization) GetProvider() Provider { + if x != nil { + return x.Provider + } + return Provider_PROVIDER_UNSPECIFIED +} + +func (x *CloudOrganization) GetCustomerId() uint64 { + if x != nil { + return x.CustomerId + } + return 0 +} + +func (x *CloudOrganization) GetOrganizationalUnitIds() []string { + if x != nil { + return x.OrganizationalUnitIds + } + return nil +} + +var File_cloud_organization_proto protoreflect.FileDescriptor + +var file_cloud_organization_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x64, 0x72, 0x61, 0x69, + 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, 0x03, + 0x0a, 0x11, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x08, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, + 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x64, 0x72, + 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x49, 0x64, 0x12, 0x36, 0x0a, + 0x17, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, + 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, + 0x69, 0x74, 0x49, 0x64, 0x73, 0x42, 0x5b, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x72, 0x61, + 0x69, 0x6f, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x42, 0x15, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x01, 0x5a, 0x25, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x61, 0x75, 0x74, 0x68, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x64, 0x72, 0x61, 0x69, 0x6f, 0x73, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cloud_organization_proto_rawDescOnce sync.Once + file_cloud_organization_proto_rawDescData = file_cloud_organization_proto_rawDesc +) + +func file_cloud_organization_proto_rawDescGZIP() []byte { + file_cloud_organization_proto_rawDescOnce.Do(func() { + file_cloud_organization_proto_rawDescData = protoimpl.X.CompressGZIP(file_cloud_organization_proto_rawDescData) + }) + return file_cloud_organization_proto_rawDescData +} + +var file_cloud_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_cloud_organization_proto_goTypes = []interface{}{ + (*CloudOrganization)(nil), // 0: draiosproto.CloudOrganization + (*CloudAccount)(nil), // 1: draiosproto.CloudAccount + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp + (Provider)(0), // 3: draiosproto.Provider +} +var file_cloud_organization_proto_depIdxs = []int32{ + 1, // 0: draiosproto.CloudOrganization.accounts:type_name -> draiosproto.CloudAccount + 2, // 1: draiosproto.CloudOrganization.created_at:type_name -> google.protobuf.Timestamp + 2, // 2: draiosproto.CloudOrganization.updated_at:type_name -> google.protobuf.Timestamp + 3, // 3: draiosproto.CloudOrganization.provider:type_name -> draiosproto.Provider + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_cloud_organization_proto_init() } +func file_cloud_organization_proto_init() { + if File_cloud_organization_proto != nil { + return + } + file_cloud_account_proto_init() + if !protoimpl.UnsafeEnabled { + file_cloud_organization_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudOrganization); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cloud_organization_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cloud_organization_proto_goTypes, + DependencyIndexes: file_cloud_organization_proto_depIdxs, + MessageInfos: file_cloud_organization_proto_msgTypes, + }.Build() + File_cloud_organization_proto = out.File + file_cloud_organization_proto_rawDesc = nil + file_cloud_organization_proto_goTypes = nil + file_cloud_organization_proto_depIdxs = nil +} diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index 79d1b8cb..c43b101a 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -1,8 +1,6 @@ package v2 -import ( - proto "github.com/draios/protorepo/cloudauth/go" -) +import cloudauth "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2/cloudauth/go" type Team struct { UserRoles []UserRoles `json:"userRoles,omitempty"` @@ -782,4 +780,4 @@ type SilenceRule struct { ID int `json:"id,omitempty"` } -type OrganizationSecure proto.CloudOrganization +type OrganizationSecure cloudauth.CloudOrganization diff --git a/sysdig/internal/client/v2/organization.go b/sysdig/internal/client/v2/organization.go index eb969d1d..8b25d921 100644 --- a/sysdig/internal/client/v2/organization.go +++ b/sysdig/internal/client/v2/organization.go @@ -17,7 +17,6 @@ type OrganizationSecureInterface interface { GetOrganizationSecure(ctx context.Context, orgID string) (*OrganizationSecure, error) DeleteOrganizationSecure(ctx context.Context, orgID string) error UpdateOrganizationSecure(ctx context.Context, orgID string, org *OrganizationSecure) (*OrganizationSecure, error) - ListOrganizationsSecure(ctx context.Context) (*OrganizationSecureList, error) // TODO: Not sure if we need this from TF } func (client *Client) CreateOrganizationSecure(ctx context.Context, org *OrganizationSecure) (*OrganizationSecure, error) { @@ -86,19 +85,7 @@ func (client *Client) UpdateOrganizationSecure(ctx context.Context, orgID string return Unmarshal[*OrganizationSecure](response.Body) } -func (client *Client) ListOrganizationsSecure(ctx context.Context) (*OrganizationSecureList, error) { - response, err := client.requester.Request(ctx, http.MethodGet, client.organizationsURL(), nil) - if err != nil { - return nil, err - } - defer response.Body.Close() - if response.StatusCode != http.StatusOK { - return nil, client.ErrorFromResponse(response) - } - - return Unmarshal[*OrganizationSecureList](response.Body) -} func (client *Client) organizationsURL() string { return fmt.Sprintf(organizationPath, client.config.url) } diff --git a/sysdig/resource_sysdig_secure_organization.go b/sysdig/resource_sysdig_secure_organization.go index 73d3e7b3..81c51069 100644 --- a/sysdig/resource_sysdig_secure_organization.go +++ b/sysdig/resource_sysdig_secure_organization.go @@ -2,8 +2,8 @@ package sysdig import ( "context" - proto "github.com/draios/protorepo/cloudauth/go" v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2" + cloudauth "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2/cloudauth/go" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -35,7 +35,7 @@ func resourceSysdigSecureOrganization() *schema.Resource { "cloud_provider_type": { Type: schema.TypeInt, Required: true, - ValidateFunc: validation.StringInSlice([]string{proto.Provider_PROVIDER_AWS.String(), proto.Provider_PROVIDER_GCP.String(), proto.Provider_PROVIDER_AZURE.String()}, false), + ValidateFunc: validation.StringInSlice([]string{cloudauth.Provider_PROVIDER_AWS.String(), cloudauth.Provider_PROVIDER_GCP.String(), cloudauth.Provider_PROVIDER_AZURE.String()}, false), }, "customer_id": { Type: schema.TypeInt, @@ -124,7 +124,7 @@ func secureOrganizationFromResourceData(data *schema.ResourceData) v2.Organizati return v2.OrganizationSecure{ Id: data.Get("organization_id").(string), ProviderId: data.Get("cloud_provider_id").(string), - Provider: proto.Provider(data.Get("cloud_provider_type").(int32)), + Provider: cloudauth.Provider(data.Get("cloud_provider_type").(int32)), CustomerId: data.Get("customer_id").(uint64), } } From db9269472b1f7f4e24bc825f9dfdd3c51ba1807f Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 7 Sep 2023 14:36:48 -0700 Subject: [PATCH 6/6] SSPROD-29302: Temp disable Validation --- sysdig/resource_sysdig_secure_organization.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sysdig/resource_sysdig_secure_organization.go b/sysdig/resource_sysdig_secure_organization.go index 81c51069..d5fdce37 100644 --- a/sysdig/resource_sysdig_secure_organization.go +++ b/sysdig/resource_sysdig_secure_organization.go @@ -6,7 +6,6 @@ import ( cloudauth "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2/cloudauth/go" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "time" ) @@ -33,9 +32,9 @@ func resourceSysdigSecureOrganization() *schema.Resource { Required: true, }, "cloud_provider_type": { - Type: schema.TypeInt, - Required: true, - ValidateFunc: validation.StringInSlice([]string{cloudauth.Provider_PROVIDER_AWS.String(), cloudauth.Provider_PROVIDER_GCP.String(), cloudauth.Provider_PROVIDER_AZURE.String()}, false), + Type: schema.TypeInt, + Required: true, + //ValidateFunc: validation.StringInSlice([]string{cloudauth.Provider_PROVIDER_AWS.String(), cloudauth.Provider_PROVIDER_GCP.String(), cloudauth.Provider_PROVIDER_AZURE.String()}, false), }, "customer_id": { Type: schema.TypeInt,