Skip to content

Commit

Permalink
Add missing docs info (#357)
Browse files Browse the repository at this point in the history
Should fix #355
  • Loading branch information
VenelinMartinov authored Jan 3, 2024
1 parent 82a4aef commit ace92ba
Show file tree
Hide file tree
Showing 9 changed files with 607 additions and 132 deletions.
25 changes: 13 additions & 12 deletions provider/cmd/pulumi-resource-keycloak/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8806,22 +8806,23 @@
]
},
"keycloak:openid/audienceResolveProtocolMappter:AudienceResolveProtocolMappter": {
"description": "Allows for creating the \"Audience Resolve\" OIDC protocol mapper within Keycloak.\n\nThis protocol mapper is useful to avoid manual management of audiences, instead relying on the presence of client roles\nto imply which audiences are appropriate for the token. See the\n[Keycloak docs](https://www.keycloak.org/docs/latest/server_admin/#_audience_resolve) for more details.\n\n{{% examples %}}\n## Example Usage\n{{% example %}}\n### Client)\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as keycloak from \"@pulumi/keycloak\";\n\nconst realm = new keycloak.Realm(\"realm\", {\n realm: \"my-realm\",\n enabled: true,\n});\nconst openidClient = new keycloak.openid.Client(\"openidClient\", {\n realmId: realm.id,\n clientId: \"client\",\n enabled: true,\n accessType: \"CONFIDENTIAL\",\n validRedirectUris: [\"http://localhost:8080/openid-callback\"],\n});\nconst audienceMapper = new keycloak.openid.AudienceResolveProtocolMapper(\"audienceMapper\", {\n realmId: realm.id,\n clientId: openidClient.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_keycloak as keycloak\n\nrealm = keycloak.Realm(\"realm\",\n realm=\"my-realm\",\n enabled=True)\nopenid_client = keycloak.openid.Client(\"openidClient\",\n realm_id=realm.id,\n client_id=\"client\",\n enabled=True,\n access_type=\"CONFIDENTIAL\",\n valid_redirect_uris=[\"http://localhost:8080/openid-callback\"])\naudience_mapper = keycloak.openid.AudienceResolveProtocolMapper(\"audienceMapper\",\n realm_id=realm.id,\n client_id=openid_client.id)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Keycloak = Pulumi.Keycloak;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var realm = new Keycloak.Realm(\"realm\", new()\n {\n RealmName = \"my-realm\",\n Enabled = true,\n });\n\n var openidClient = new Keycloak.OpenId.Client(\"openidClient\", new()\n {\n RealmId = realm.Id,\n ClientId = \"client\",\n Enabled = true,\n AccessType = \"CONFIDENTIAL\",\n ValidRedirectUris = new[]\n {\n \"http://localhost:8080/openid-callback\",\n },\n });\n\n var audienceMapper = new Keycloak.OpenId.AudienceResolveProtocolMapper(\"audienceMapper\", new()\n {\n RealmId = realm.Id,\n ClientId = openidClient.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak\"\n\t\"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\trealm, err := keycloak.NewRealm(ctx, \"realm\", \u0026keycloak.RealmArgs{\n\t\t\tRealm: pulumi.String(\"my-realm\"),\n\t\t\tEnabled: pulumi.Bool(true),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topenidClient, err := openid.NewClient(ctx, \"openidClient\", \u0026openid.ClientArgs{\n\t\t\tRealmId: realm.ID(),\n\t\t\tClientId: pulumi.String(\"client\"),\n\t\t\tEnabled: pulumi.Bool(true),\n\t\t\tAccessType: pulumi.String(\"CONFIDENTIAL\"),\n\t\t\tValidRedirectUris: pulumi.StringArray{\n\t\t\t\tpulumi.String(\"http://localhost:8080/openid-callback\"),\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = openid.NewAudienceResolveProtocolMapper(ctx, \"audienceMapper\", \u0026openid.AudienceResolveProtocolMapperArgs{\n\t\t\tRealmId: realm.ID(),\n\t\t\tClientId: openidClient.ID(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.keycloak.Realm;\nimport com.pulumi.keycloak.RealmArgs;\nimport com.pulumi.keycloak.openid.Client;\nimport com.pulumi.keycloak.openid.ClientArgs;\nimport com.pulumi.keycloak.openid.AudienceResolveProtocolMapper;\nimport com.pulumi.keycloak.openid.AudienceResolveProtocolMapperArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var realm = new Realm(\"realm\", RealmArgs.builder() \n .realm(\"my-realm\")\n .enabled(true)\n .build());\n\n var openidClient = new Client(\"openidClient\", ClientArgs.builder() \n .realmId(realm.id())\n .clientId(\"client\")\n .enabled(true)\n .accessType(\"CONFIDENTIAL\")\n .validRedirectUris(\"http://localhost:8080/openid-callback\")\n .build());\n\n var audienceMapper = new AudienceResolveProtocolMapper(\"audienceMapper\", AudienceResolveProtocolMapperArgs.builder() \n .realmId(realm.id())\n .clientId(openidClient.id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n realm:\n type: keycloak:Realm\n properties:\n realm: my-realm\n enabled: true\n openidClient:\n type: keycloak:openid:Client\n properties:\n realmId: ${realm.id}\n clientId: client\n enabled: true\n accessType: CONFIDENTIAL\n validRedirectUris:\n - http://localhost:8080/openid-callback\n audienceMapper:\n type: keycloak:openid:AudienceResolveProtocolMapper\n properties:\n realmId: ${realm.id}\n clientId: ${openidClient.id}\n```\n\n{{% /example %}}\n{{% example %}}\n### Client Scope)\n\n```typescript\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as keycloak from \"@pulumi/keycloak\";\n\nconst realm = new keycloak.Realm(\"realm\", {\n realm: \"my-realm\",\n enabled: true,\n});\nconst clientScope = new keycloak.openid.ClientScope(\"clientScope\", {realmId: realm.id});\nconst audienceMapper = new keycloak.openid.AudienceProtocolMapper(\"audienceMapper\", {\n realmId: realm.id,\n clientScopeId: clientScope.id,\n});\n```\n```python\nimport pulumi\nimport pulumi_keycloak as keycloak\n\nrealm = keycloak.Realm(\"realm\",\n realm=\"my-realm\",\n enabled=True)\nclient_scope = keycloak.openid.ClientScope(\"clientScope\", realm_id=realm.id)\naudience_mapper = keycloak.openid.AudienceProtocolMapper(\"audienceMapper\",\n realm_id=realm.id,\n client_scope_id=client_scope.id)\n```\n```csharp\nusing System.Collections.Generic;\nusing System.Linq;\nusing Pulumi;\nusing Keycloak = Pulumi.Keycloak;\n\nreturn await Deployment.RunAsync(() =\u003e \n{\n var realm = new Keycloak.Realm(\"realm\", new()\n {\n RealmName = \"my-realm\",\n Enabled = true,\n });\n\n var clientScope = new Keycloak.OpenId.ClientScope(\"clientScope\", new()\n {\n RealmId = realm.Id,\n });\n\n var audienceMapper = new Keycloak.OpenId.AudienceProtocolMapper(\"audienceMapper\", new()\n {\n RealmId = realm.Id,\n ClientScopeId = clientScope.Id,\n });\n\n});\n```\n```go\npackage main\n\nimport (\n\t\"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak\"\n\t\"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/pulumi\"\n)\n\nfunc main() {\n\tpulumi.Run(func(ctx *pulumi.Context) error {\n\t\trealm, err := keycloak.NewRealm(ctx, \"realm\", \u0026keycloak.RealmArgs{\n\t\t\tRealm: pulumi.String(\"my-realm\"),\n\t\t\tEnabled: pulumi.Bool(true),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tclientScope, err := openid.NewClientScope(ctx, \"clientScope\", \u0026openid.ClientScopeArgs{\n\t\t\tRealmId: realm.ID(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t_, err = openid.NewAudienceProtocolMapper(ctx, \"audienceMapper\", \u0026openid.AudienceProtocolMapperArgs{\n\t\t\tRealmId: realm.ID(),\n\t\t\tClientScopeId: clientScope.ID(),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n```java\npackage generated_program;\n\nimport com.pulumi.Context;\nimport com.pulumi.Pulumi;\nimport com.pulumi.core.Output;\nimport com.pulumi.keycloak.Realm;\nimport com.pulumi.keycloak.RealmArgs;\nimport com.pulumi.keycloak.openid.ClientScope;\nimport com.pulumi.keycloak.openid.ClientScopeArgs;\nimport com.pulumi.keycloak.openid.AudienceProtocolMapper;\nimport com.pulumi.keycloak.openid.AudienceProtocolMapperArgs;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport java.io.File;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class App {\n public static void main(String[] args) {\n Pulumi.run(App::stack);\n }\n\n public static void stack(Context ctx) {\n var realm = new Realm(\"realm\", RealmArgs.builder() \n .realm(\"my-realm\")\n .enabled(true)\n .build());\n\n var clientScope = new ClientScope(\"clientScope\", ClientScopeArgs.builder() \n .realmId(realm.id())\n .build());\n\n var audienceMapper = new AudienceProtocolMapper(\"audienceMapper\", AudienceProtocolMapperArgs.builder() \n .realmId(realm.id())\n .clientScopeId(clientScope.id())\n .build());\n\n }\n}\n```\n```yaml\nresources:\n realm:\n type: keycloak:Realm\n properties:\n realm: my-realm\n enabled: true\n clientScope:\n type: keycloak:openid:ClientScope\n properties:\n realmId: ${realm.id}\n audienceMapper:\n type: keycloak:openid:AudienceProtocolMapper\n properties:\n realmId: ${realm.id}\n clientScopeId: ${clientScope.id}\n```\n{{% /example %}}\n{{% /examples %}}\n\n## Import\n\nProtocol mappers can be imported using one of the following formats- Client`{{realm_id}}/client/{{client_keycloak_id}}/{{protocol_mapper_id}}` - Client Scope`{{realm_id}}/client-scope/{{client_scope_keycloak_id}}/{{protocol_mapper_id}}` Examplebash\n\n```sh\n $ pulumi import keycloak:openid/audienceResolveProtocolMappter:AudienceResolveProtocolMappter audience_mapper my-realm/client/a7202154-8793-4656-b655-1dd18c181e14/71602afa-f7d1-4788-8c49-ef8fd00af0f4\n```\n\n\n\n```sh\n $ pulumi import keycloak:openid/audienceResolveProtocolMappter:AudienceResolveProtocolMappter audience_mapper my-realm/client-scope/b799ea7e-73ee-4a73-990a-1eafebe8e20a/71602afa-f7d1-4788-8c49-ef8fd00af0f4\n```\n\n ",
"properties": {
"clientId": {
"type": "string",
"description": "The mapper's associated client. Cannot be used at the same time as client_scope_id.\n"
"description": "The client this protocol mapper should be attached to. Conflicts with `client_scope_id`. One of `client_id` or `client_scope_id` must be specified.\n"
},
"clientScopeId": {
"type": "string",
"description": "The mapper's associated client scope. Cannot be used at the same time as client_id.\n"
"description": "The client scope this protocol mapper should be attached to. Conflicts with `client_id`. One of `client_id` or `client_scope_id` must be specified.\n"
},
"name": {
"type": "string",
"description": "A human-friendly name that will appear in the Keycloak console.\n"
"description": "The display name of this protocol mapper in the GUI. Defaults to \"audience resolve\".\n"
},
"realmId": {
"type": "string",
"description": "The realm id where the associated client or client scope exists.\n"
"description": "The realm this protocol mapper exists within.\n"
}
},
"required": [
Expand All @@ -8831,22 +8832,22 @@
"inputProperties": {
"clientId": {
"type": "string",
"description": "The mapper's associated client. Cannot be used at the same time as client_scope_id.\n",
"description": "The client this protocol mapper should be attached to. Conflicts with `client_scope_id`. One of `client_id` or `client_scope_id` must be specified.\n",
"willReplaceOnChanges": true
},
"clientScopeId": {
"type": "string",
"description": "The mapper's associated client scope. Cannot be used at the same time as client_id.\n",
"description": "The client scope this protocol mapper should be attached to. Conflicts with `client_id`. One of `client_id` or `client_scope_id` must be specified.\n",
"willReplaceOnChanges": true
},
"name": {
"type": "string",
"description": "A human-friendly name that will appear in the Keycloak console.\n",
"description": "The display name of this protocol mapper in the GUI. Defaults to \"audience resolve\".\n",
"willReplaceOnChanges": true
},
"realmId": {
"type": "string",
"description": "The realm id where the associated client or client scope exists.\n",
"description": "The realm this protocol mapper exists within.\n",
"willReplaceOnChanges": true
}
},
Expand All @@ -8858,22 +8859,22 @@
"properties": {
"clientId": {
"type": "string",
"description": "The mapper's associated client. Cannot be used at the same time as client_scope_id.\n",
"description": "The client this protocol mapper should be attached to. Conflicts with `client_scope_id`. One of `client_id` or `client_scope_id` must be specified.\n",
"willReplaceOnChanges": true
},
"clientScopeId": {
"type": "string",
"description": "The mapper's associated client scope. Cannot be used at the same time as client_id.\n",
"description": "The client scope this protocol mapper should be attached to. Conflicts with `client_id`. One of `client_id` or `client_scope_id` must be specified.\n",
"willReplaceOnChanges": true
},
"name": {
"type": "string",
"description": "A human-friendly name that will appear in the Keycloak console.\n",
"description": "The display name of this protocol mapper in the GUI. Defaults to \"audience resolve\".\n",
"willReplaceOnChanges": true
},
"realmId": {
"type": "string",
"description": "The realm id where the associated client or client scope exists.\n",
"description": "The realm this protocol mapper exists within.\n",
"willReplaceOnChanges": true
}
},
Expand Down
10 changes: 8 additions & 2 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ import (
"fmt"
"path"
"strings"

// embed is used to store bridge-metadata.json in the compiled binary
_ "embed"

"github.com/mrparkers/terraform-provider-keycloak/provider"
"github.com/pulumi/pulumi-keycloak/provider/v5/pkg/version"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
tks "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"

"github.com/pulumi/pulumi-keycloak/provider/v5/pkg/version"
)

// all of the token components used below.
Expand Down Expand Up @@ -120,6 +120,9 @@ func Provider() tfbridge.ProviderInfo {
"keycloak_ldap_hardcoded_group_mapper": {
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
"keycloak_openid_client_authorization_scope": {
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
"keycloak_openid_client_authorization_permission": {
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
Expand Down Expand Up @@ -148,6 +151,9 @@ func Provider() tfbridge.ProviderInfo {
"keycloak_openid_client_permissions": {
Docs: &tfbridge.DocInfo{AllowMissing: true},
},
"keycloak_openid_audience_resolve_protocol_mapper": {
Docs: &tfbridge.DocInfo{Source: "openid_audience_resolve_protocol_mapper.md"},
},

"keycloak_saml_client_default_scopes": {Tok: makeResource(samlMod, "ClientDefaultScope")},
},
Expand Down
Loading

0 comments on commit ace92ba

Please sign in to comment.