Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: b5c8bf75-06e1-47c8-b9ae-ce49ba56069d
management:
docChecksum: 1366c58606ef39f06fd8da2f5cd0c577
docChecksum: 45e1f288aa81f854581b825bfe323380
docVersion: "1.0"
speakeasyVersion: 1.639.1
generationVersion: 2.730.0
releaseVersion: 3.3.2
configChecksum: baa23f67f8df8977e52c5911761aa6ea
speakeasyVersion: 1.642.1
generationVersion: 2.731.4
releaseVersion: 3.4.0
configChecksum: 4f71ba5463e7f25051330975118aac14
repoURL: https://github.com/opalsecurity/terraform-provider-opal.git
repoSubDirectory: .
published: true
Expand All @@ -23,10 +23,11 @@ features:
inputOutputModels: 2.83.0
nameOverrides: 2.81.3
nullables: 0.0.0
pagination: 2.83.3
retries: 2.81.4
serverIDs: 2.81.1
sets: 0.1.2
unions: 2.82.0
unions: 2.82.1
generatedFiles:
- .gitattributes
- USAGE.md
Expand Down Expand Up @@ -1762,7 +1763,7 @@ examples:
path:
id: "83015915-58ae-4cce-b92d-608ff073ece1"
requestBody:
application/json: {"comment": "Denied due to insufficient justification"}
application/json: {"comment": "Denied due to insufficient justification", "level": "REGULAR"}
responses:
"200":
application/json: {"request": {"created_at": "2021-01-06T20:00:00Z", "duration_minutes": 1440, "id": "7c86c85d-0651-43e2-a748-d69d658418e8", "reason": "I need this resource.", "requester_id": "c86c85d-0651-43e2-a748-d69d658418e8", "reviewer_stages": [{"item_id": "f454d283-ca87-4a8a-bdbb-df212eca5353", "item_name": "<value>", "stages": [{"operator": "AND", "reviewers": [{"id": "7c86c85d-0651-43e2-a748-d69d658418e8", "status": "PENDING"}], "stage": 1}, {"operator": "OR", "reviewers": [{"id": "8d86c85d-0651-43e2-a748-d69d658418e9", "status": "APPROVED"}], "stage": 2}]}], "status": "CANCELED", "target_group_id": "r86c85d-0651-43e2-a748-d69d658418e8", "target_user_id": "r86c85d-0651-43e2-a748-d69d658418e8", "updated_at": "2021-01-06T20:00:00Z"}}
Expand All @@ -1776,4 +1777,3 @@ examples:
application/json: {"comments": [{"comment": "This is a comment.", "created_at": "2021-01-06T20:00:00Z", "request_id": "4c86c85d-0651-43e2-a748-d69d658418e8", "user_id": "c86c85d-0651-43e2-a748-d69d658418e8"}]}
examplesVersion: 1.0.2
generatedTests: {}
releaseNotes: "## Terraform SDK Changes Detected:\n* `Opal-API.groups.create_user()`: `response` **Changed**\n* `Opal-API.groups.get_user_groups()`: `response.results.[]` **Changed**\n* `Opal-API.groups.get_users()`: `response.results.[]` **Changed**\n* `Opal-API.groups.update_group_user()`: `response` **Changed**\n* `Opal-API.non-human-identities.get_nhis()`: `response.results.[].remote_info.oracle_fusion_role` **Added**\n* `Opal-API.resources.create()`: \n * `request.remote_info.oracle_fusion_role` **Added**\n * `response.remote_info.oracle_fusion_role` **Added**\n* `Opal-API.resources.get()`: \n * `request.resource_type_filter` **Changed**\n * `response.results.[].remote_info.oracle_fusion_role` **Added**\n* `Opal-API.resources.get_id()`: `response.remote_info.oracle_fusion_role` **Added**\n"
11 changes: 5 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
speakeasyVersion: 1.639.1
speakeasyVersion: 1.642.1
sources:
opal-terraform-provider:
sourceNamespace: opal-terraform-provider
sourceRevisionDigest: sha256:84a58be9cff672a0c002be69ed2562bc62b4767dfa4364dfbcb3c66f00a39aea
sourceBlobDigest: sha256:1a28f2306ca10e79c0f73ec1de76e705f9c404d5291a1e5a68a73f18a3970991
sourceRevisionDigest: sha256:578b959ccab6b6c7378d3d67c2cdabbf890d27b6b2a8ab6f2a1eaee6ffb4860a
sourceBlobDigest: sha256:9a4da2bbf6f499be134a4c305a862536de675cc67994c6b3ef2f3dde085c6327
tags:
- latest
- speakeasy-sdk-regen-1757722489
- "1.0"
targets:
terraform:
source: opal-terraform-provider
sourceNamespace: opal-terraform-provider
sourceRevisionDigest: sha256:84a58be9cff672a0c002be69ed2562bc62b4767dfa4364dfbcb3c66f00a39aea
sourceBlobDigest: sha256:1a28f2306ca10e79c0f73ec1de76e705f9c404d5291a1e5a68a73f18a3970991
sourceRevisionDigest: sha256:578b959ccab6b6c7378d3d67c2cdabbf890d27b6b2a8ab6f2a1eaee6ffb4860a
sourceBlobDigest: sha256:9a4da2bbf6f499be134a4c305a862536de675cc67994c6b3ef2f3dde085c6327
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ terraform {
required_providers {
opal = {
source = "opalsecurity/opal"
version = "3.3.2"
version = "3.4.0"
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions docs/data-sources/delegations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ data "opal_delegations" "my_delegations" {
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
delegate_user_id = "29827fb8-f2dd-4e80-9576-28e31e9934ac"
delegator_user_id = "29827fb8-f2dd-4e80-9576-28e31e9934ac"
page_size = 200
}
```

Expand All @@ -29,7 +28,6 @@ data "opal_delegations" "my_delegations" {
- `cursor` (String) A cursor to indicate where to start fetching results.
- `delegate_user_id` (String) The delegate user ID to filter delegations by the user being delegated to.
- `delegator_user_id` (String) The delegator user ID to filter delegations by the user delegating their access review requests.
- `page_size` (Number) The maximum number of results to return per page. The default is 200.

### Read-Only

Expand Down
2 changes: 0 additions & 2 deletions docs/data-sources/paginated_bundle_group_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ PaginatedBundleGroupList DataSource
data "opal_paginated_bundle_group_list" "my_paginatedbundlegrouplist" {
bundle_id = "32acc112-21ff-4669-91c2-21e27683eaa1"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
}
```

Expand All @@ -30,7 +29,6 @@ data "opal_paginated_bundle_group_list" "my_paginatedbundlegrouplist" {
### Optional

- `cursor` (String) A cursor indicating where to start fetching items after a specific point.
- `page_size` (Number) The maximum number of groups to return from the beginning of the list. Default is 200, max is 1000.

### Read-Only

Expand Down
6 changes: 2 additions & 4 deletions docs/data-sources/paginated_bundle_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ PaginatedBundleList DataSource

```terraform
data "opal_paginated_bundle_list" "my_paginatedbundlelist" {
contains = "Engineering"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
contains = "Engineering"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
}
```

Expand All @@ -27,7 +26,6 @@ data "opal_paginated_bundle_list" "my_paginatedbundlelist" {

- `contains` (String) A filter for the bundle name.
- `cursor` (String) A cursor indicating where to start fetching items after a specific point.
- `page_size` (Number) The maximum number of bundles to return from the beginning of the list. Default is 200, max is 1000.

### Read-Only

Expand Down
2 changes: 0 additions & 2 deletions docs/data-sources/paginated_bundle_resource_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ PaginatedBundleResourceList DataSource
data "opal_paginated_bundle_resource_list" "my_paginatedbundleresourcelist" {
bundle_id = "32acc112-21ff-4669-91c2-21e27683eaa1"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
}
```

Expand All @@ -30,7 +29,6 @@ data "opal_paginated_bundle_resource_list" "my_paginatedbundleresourcelist" {
### Optional

- `cursor` (String) A cursor indicating where to start fetching items after a specific point.
- `page_size` (Number) The maximum number of resources to return from the beginning of the list. Default is 200, max is 1000.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ terraform {
required_providers {
opal = {
source = "opalsecurity/opal"
version = "3.3.2"
version = "3.4.0"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion examples/data-sources/opal_delegations/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ data "opal_delegations" "my_delegations" {
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
delegate_user_id = "29827fb8-f2dd-4e80-9576-28e31e9934ac"
delegator_user_id = "29827fb8-f2dd-4e80-9576-28e31e9934ac"
page_size = 200
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
data "opal_paginated_bundle_group_list" "my_paginatedbundlegrouplist" {
bundle_id = "32acc112-21ff-4669-91c2-21e27683eaa1"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
data "opal_paginated_bundle_list" "my_paginatedbundlelist" {
contains = "Engineering"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
contains = "Engineering"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
data "opal_paginated_bundle_resource_list" "my_paginatedbundleresourcelist" {
bundle_id = "32acc112-21ff-4669-91c2-21e27683eaa1"
cursor = "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw"
page_size = 200
}
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
opal = {
source = "opalsecurity/opal"
version = "3.3.2"
version = "3.4.0"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ generation:
skipResponseBodyAssertions: false
flattenGlobalSecurity: true
terraform:
version: 3.3.2
version: 3.4.0
additionalDataSources: []
additionalDependencies:
github.com/hashicorp/terraform-plugin-testing: v1.13.2
Expand All @@ -49,3 +49,4 @@ terraform:
inputModelSuffix: input
outputModelSuffix: output
packageName: opal
unionDeserializationStrategy: populated-fields
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.13.2
github.com/pkg/errors v0.9.1
github.com/spyzhov/ajson v0.9.0
github.com/stretchr/testify v1.8.3
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQ
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/spyzhov/ajson v0.9.0 h1:tF46gJGOenYVj+k9K1U1XpCxVWhmiyY5PsVCAs1+OJ0=
github.com/spyzhov/ajson v0.9.0/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand Down
30 changes: 20 additions & 10 deletions internal/provider/delegations_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ package provider
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
tfTypes "github.com/opalsecurity/terraform-provider-opal/v3/internal/provider/types"
Expand All @@ -35,7 +33,6 @@ type DelegationsDataSourceModel struct {
DelegateUserID types.String `queryParam:"style=form,explode=true,name=delegate_user_id" tfsdk:"delegate_user_id"`
DelegatorUserID types.String `queryParam:"style=form,explode=true,name=delegator_user_id" tfsdk:"delegator_user_id"`
Next types.String `tfsdk:"next"`
PageSize types.Int64 `queryParam:"style=form,explode=true,name=page_size" tfsdk:"page_size"`
Previous types.String `tfsdk:"previous"`
Results []tfTypes.Delegation `tfsdk:"results"`
TotalCount types.Int64 `tfsdk:"total_count"`
Expand Down Expand Up @@ -68,13 +65,6 @@ func (r *DelegationsDataSource) Schema(ctx context.Context, req datasource.Schem
Computed: true,
Description: `The cursor with which to continue pagination if additional result pages exist.`,
},
"page_size": schema.Int64Attribute{
Optional: true,
Description: `The maximum number of results to return per page. The default is 200.`,
Validators: []validator.Int64{
int64validator.AtMost(1000),
},
},
"previous": schema.StringAttribute{
Computed: true,
Description: `The cursor used to obtain the current result page.`,
Expand Down Expand Up @@ -196,6 +186,26 @@ func (r *DelegationsDataSource) Read(ctx context.Context, req datasource.ReadReq
if resp.Diagnostics.HasError() {
return
}
for {
var err error

res, err = res.Next()

if err != nil {
resp.Diagnostics.AddError(fmt.Sprintf("failed to retrieve next page of results: %v", err), debugResponse(res.RawResponse))
return
}

if res == nil {
break
}

resp.Diagnostics.Append(data.RefreshFromSharedPaginatedDelegationsList(ctx, res.PaginatedDelegationsList)...)

if resp.Diagnostics.HasError() {
return
}
}

// Save updated data into Terraform state
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
Expand Down
18 changes: 3 additions & 15 deletions internal/provider/delegations_data_source_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ func (r *DelegationsDataSourceModel) RefreshFromSharedPaginatedDelegationsList(c
if resp != nil {
r.Next = types.StringPointerValue(resp.Next)
r.Previous = types.StringPointerValue(resp.Previous)
r.Results = []tfTypes.Delegation{}
if r.Results == nil {
r.Results = []tfTypes.Delegation{}
}

for _, resultsItem := range resp.Results {
var results tfTypes.Delegation
Expand All @@ -43,12 +45,6 @@ func (r *DelegationsDataSourceModel) RefreshFromSharedPaginatedDelegationsList(c
func (r *DelegationsDataSourceModel) ToOperationsGetDelegationsRequest(ctx context.Context) (*operations.GetDelegationsRequest, diag.Diagnostics) {
var diags diag.Diagnostics

cursor := new(string)
if !r.Cursor.IsUnknown() && !r.Cursor.IsNull() {
*cursor = r.Cursor.ValueString()
} else {
cursor = nil
}
delegateUserID := new(string)
if !r.DelegateUserID.IsUnknown() && !r.DelegateUserID.IsNull() {
*delegateUserID = r.DelegateUserID.ValueString()
Expand All @@ -61,17 +57,9 @@ func (r *DelegationsDataSourceModel) ToOperationsGetDelegationsRequest(ctx conte
} else {
delegatorUserID = nil
}
pageSize := new(int64)
if !r.PageSize.IsUnknown() && !r.PageSize.IsNull() {
*pageSize = r.PageSize.ValueInt64()
} else {
pageSize = nil
}
out := operations.GetDelegationsRequest{
Cursor: cursor,
DelegateUserID: delegateUserID,
DelegatorUserID: delegatorUserID,
PageSize: pageSize,
}

return &out, diags
Expand Down
25 changes: 20 additions & 5 deletions internal/provider/paginatedbundlegrouplist_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ type PaginatedBundleGroupListDataSourceModel struct {
BundleID types.String `tfsdk:"bundle_id"`
Cursor types.String `queryParam:"style=form,explode=true,name=cursor" tfsdk:"cursor"`
Next types.String `tfsdk:"next"`
PageSize types.Int64 `queryParam:"style=form,explode=true,name=page_size" tfsdk:"page_size"`
Previous types.String `tfsdk:"previous"`
TotalCount types.Int64 `tfsdk:"total_count"`
}
Expand Down Expand Up @@ -84,10 +83,6 @@ func (r *PaginatedBundleGroupListDataSource) Schema(ctx context.Context, req dat
Computed: true,
Description: `The cursor with which to continue pagination if additional result pages exist.`,
},
"page_size": schema.Int64Attribute{
Optional: true,
Description: `The maximum number of groups to return from the beginning of the list. Default is 200, max is 1000.`,
},
"previous": schema.StringAttribute{
Computed: true,
Description: `The cursor used to obtain the current result page.`,
Expand Down Expand Up @@ -169,6 +164,26 @@ func (r *PaginatedBundleGroupListDataSource) Read(ctx context.Context, req datas
if resp.Diagnostics.HasError() {
return
}
for {
var err error

res, err = res.Next()

if err != nil {
resp.Diagnostics.AddError(fmt.Sprintf("failed to retrieve next page of results: %v", err), debugResponse(res.RawResponse))
return
}

if res == nil {
break
}

resp.Diagnostics.Append(data.RefreshFromSharedPaginatedBundleGroupList(ctx, res.PaginatedBundleGroupList)...)

if resp.Diagnostics.HasError() {
return
}
}

// Save updated data into Terraform state
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
Expand Down
Loading