Skip to content

Commit

Permalink
speakeasy autogen (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsy-opal authored Aug 5, 2024
1 parent 723e045 commit dca3c44
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 27 deletions.
11 changes: 6 additions & 5 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: b5c8bf75-06e1-47c8-b9ae-ce49ba56069d
management:
docChecksum: a107ffd47833df714c17fbb8f44eb9c0
docVersion: "1.0"
speakeasyVersion: 1.352.0
generationVersion: 2.384.4
releaseVersion: 0.23.7
configChecksum: f6814dfdacb389e0eddca61bb7c19067
speakeasyVersion: 1.352.2
generationVersion: 2.385.2
releaseVersion: 0.24.0
configChecksum: e434993130d9af19734fdb89d4ace9dc
repoURL: https://github.com/opalsecurity/terraform-provider-opal.git
repoSubDirectory: .
published: true
Expand All @@ -17,7 +17,8 @@ features:
constsAndDefaults: 0.1.4
core: 3.24.6
deprecations: 2.81.1
globalSecurity: 2.81.6
envVarSecurityUsage: 0.1.0
globalSecurity: 2.81.8
globalServerURLs: 2.82.1
ignores: 2.81.1
nameOverrides: 2.81.2
Expand Down
6 changes: 3 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
speakeasyVersion: 1.352.0
speakeasyVersion: 1.352.2
sources:
opal-terraform-provider:
sourceNamespace: opal-terraform-provider
sourceRevisionDigest: sha256:5de9ff927b6e35695aff3f63995be2b1bac285ace66b939fdc5944fa30de7b43
sourceRevisionDigest: sha256:5a5431e90e6bfc1d8b390535469fce11d87690d718a91c0329e65500874d6de5
sourceBlobDigest: sha256:86b9ddd85104869419ff2b39c734475e8343b5faea5af83f20ccc4a5c482876c
tags:
- latest
targets:
terraform:
source: opal-terraform-provider
sourceNamespace: opal-terraform-provider
sourceRevisionDigest: sha256:5de9ff927b6e35695aff3f63995be2b1bac285ace66b939fdc5944fa30de7b43
sourceRevisionDigest: sha256:5a5431e90e6bfc1d8b390535469fce11d87690d718a91c0329e65500874d6de5
sourceBlobDigest: sha256:86b9ddd85104869419ff2b39c734475e8343b5faea5af83f20ccc4a5c482876c
outLocation: .
workflow:
Expand Down
7 changes: 2 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ terraform {
required_providers {
opal = {
source = "opalsecurity/opal"
version = "0.23.7"
version = "0.24.0"
}
}
}
Expand All @@ -30,10 +30,7 @@ provider "opal" {
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `bearer_auth` (String, Sensitive)

### Optional

- `bearer_auth` (String, Sensitive)
- `server_url` (String) Server URL (defaults to https://api.opal.dev/v1)
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 = "0.23.7"
version = "0.24.0"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ generation:
oAuth2ClientCredentialsEnabled: false
flattenGlobalSecurity: true
terraform:
version: 0.23.7
version: 0.24.0
additionalDataSources: []
additionalDependencies: {}
additionalResources: []
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/group_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func testAccCheckGroupDestroy(s *terraform.State) error {
}

security := shared.Security{
BearerAuth: opalToken,
BearerAuth: &opalToken,
}
opts := []sdk.SDKOption{
sdk.WithServerURL(opalBaseURL),
Expand Down
15 changes: 9 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (p *OpalProvider) Schema(ctx context.Context, req provider.SchemaRequest, r
},
"bearer_auth": schema.StringAttribute{
Sensitive: true,
Required: true,
Optional: true,
},
},
}
Expand All @@ -67,13 +67,16 @@ func (p *OpalProvider) Configure(ctx context.Context, req provider.ConfigureRequ
ServerURL = "https://api.opal.dev/v1"
}

var bearerAuth string
if len(os.Getenv("OPAL_AUTH_TOKEN")) > 0 {
bearerAuth = os.Getenv("OPAL_AUTH_TOKEN")
bearerAuth := new(string)
if !data.BearerAuth.IsUnknown() && !data.BearerAuth.IsNull() {
*bearerAuth = data.BearerAuth.ValueString()
} else {
bearerAuth = data.BearerAuth.ValueString()
if len(os.Getenv("OPAL_AUTH_TOKEN")) > 0 {
*bearerAuth = os.Getenv("OPAL_AUTH_TOKEN")
} else {
bearerAuth = nil
}
}

security := shared.Security{
BearerAuth: bearerAuth,
}
Expand Down
6 changes: 3 additions & 3 deletions internal/sdk/models/shared/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
package shared

type Security struct {
BearerAuth string `security:"scheme,type=http,subtype=bearer,name=Authorization"`
BearerAuth *string `security:"scheme,type=http,subtype=bearer,name=Authorization"`
}

func (o *Security) GetBearerAuth() string {
func (o *Security) GetBearerAuth() *string {
if o == nil {
return ""
return nil
}
return o.BearerAuth
}
4 changes: 2 additions & 2 deletions internal/sdk/opalapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ func New(opts ...SDKOption) *OpalAPI {
Language: "go",
OpenAPIDocVersion: "1.0",
SDKVersion: "0.0.1",
GenVersion: "2.384.4",
UserAgent: "speakeasy-sdk/go 0.0.1 2.384.4 1.0 github.com/opalsecurity/terraform-provider-opal/internal/sdk",
GenVersion: "2.385.2",
UserAgent: "speakeasy-sdk/go 0.0.1 2.385.2 1.0 github.com/opalsecurity/terraform-provider-opal/internal/sdk",
Hooks: hooks.New(),
},
}
Expand Down

0 comments on commit dca3c44

Please sign in to comment.