Skip to content

Commit

Permalink
[8/X] DXCDT-441: Reintroduce support for echosign client addon (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Jun 29, 2023
1 parent 43cf573 commit 1b9e1be
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 96 deletions.
9 changes: 9 additions & 0 deletions docs/data-sources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Read-Only:
- `aws` (List of Object) (see [below for nested schema](#nestedobjatt--addons--aws))
- `azure_blob` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_blob))
- `azure_sb` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_sb))
- `echosign` (List of Object) (see [below for nested schema](#nestedobjatt--addons--echosign))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
Expand Down Expand Up @@ -123,6 +124,14 @@ Read-Only:
- `sas_key_name` (String)


<a id="nestedobjatt--addons--echosign"></a>
### Nested Schema for `addons.echosign`

Read-Only:

- `domain` (String)


<a id="nestedobjatt--addons--mscrm"></a>
### Nested Schema for `addons.mscrm`

Expand Down
9 changes: 9 additions & 0 deletions docs/data-sources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Read-Only:
- `aws` (List of Object) (see [below for nested schema](#nestedobjatt--addons--aws))
- `azure_blob` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_blob))
- `azure_sb` (List of Object) (see [below for nested schema](#nestedobjatt--addons--azure_sb))
- `echosign` (List of Object) (see [below for nested schema](#nestedobjatt--addons--echosign))
- `mscrm` (List of Object) (see [below for nested schema](#nestedobjatt--addons--mscrm))
- `rms` (List of Object) (see [below for nested schema](#nestedobjatt--addons--rms))
- `sentry` (List of Object) (see [below for nested schema](#nestedobjatt--addons--sentry))
Expand Down Expand Up @@ -112,6 +113,14 @@ Read-Only:
- `sas_key_name` (String)


<a id="nestedobjatt--addons--echosign"></a>
### Nested Schema for `addons.echosign`

Read-Only:

- `domain` (String)


<a id="nestedobjatt--addons--mscrm"></a>
### Nested Schema for `addons.mscrm`

Expand Down
9 changes: 9 additions & 0 deletions docs/resources/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Optional:
- `aws` (Block List, Max: 1) AWS Addon configuration. (see [below for nested schema](#nestedblock--addons--aws))
- `azure_blob` (Block List, Max: 1) Azure Blob Storage Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_blob))
- `azure_sb` (Block List, Max: 1) Azure Storage Bus Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_sb))
- `echosign` (Block List, Max: 1) Adobe EchoSign SSO configuration. (see [below for nested schema](#nestedblock--addons--echosign))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
Expand Down Expand Up @@ -185,6 +186,14 @@ Optional:
- `sas_key_name` (String) Your shared access policy name defined in your Service Bus entity.


<a id="nestedblock--addons--echosign"></a>
### Nested Schema for `addons.echosign`

Optional:

- `domain` (String) Your custom domain found in your EchoSign URL, for example `https://acme-org.echosign.com` would be `acme-org`.


<a id="nestedblock--addons--mscrm"></a>
### Nested Schema for `addons.mscrm`

Expand Down
9 changes: 9 additions & 0 deletions docs/resources/global_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Optional:
- `aws` (Block List, Max: 1) AWS Addon configuration. (see [below for nested schema](#nestedblock--addons--aws))
- `azure_blob` (Block List, Max: 1) Azure Blob Storage Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_blob))
- `azure_sb` (Block List, Max: 1) Azure Storage Bus Addon configuration. (see [below for nested schema](#nestedblock--addons--azure_sb))
- `echosign` (Block List, Max: 1) Adobe EchoSign SSO configuration. (see [below for nested schema](#nestedblock--addons--echosign))
- `mscrm` (Block List, Max: 1) Microsoft Dynamics CRM SSO configuration. (see [below for nested schema](#nestedblock--addons--mscrm))
- `rms` (Block List, Max: 1) Active Directory Rights Management Service SSO configuration. (see [below for nested schema](#nestedblock--addons--rms))
- `sentry` (Block List, Max: 1) Sentry SSO configuration. (see [below for nested schema](#nestedblock--addons--sentry))
Expand Down Expand Up @@ -128,6 +129,14 @@ Optional:
- `sas_key_name` (String) Your shared access policy name defined in your Service Bus entity.


<a id="nestedblock--addons--echosign"></a>
### Nested Schema for `addons.echosign`

Optional:

- `domain` (String) Your custom domain found in your EchoSign URL, for example `https://acme-org.echosign.com` would be `acme-org`.


<a id="nestedblock--addons--mscrm"></a>
### Nested Schema for `addons.mscrm`

Expand Down
15 changes: 15 additions & 0 deletions internal/auth0/client/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ func expandClientAddons(d *schema.ResourceData) *management.ClientAddons {
addons.MSCRM = expandClientAddonMSCRM(addonsCfg.GetAttr("mscrm"))
addons.Slack = expandClientAddonSlack(addonsCfg.GetAttr("slack"))
addons.Sentry = expandClientAddonSentry(addonsCfg.GetAttr("sentry"))
addons.EchoSign = expandClientAddonEchoSign(addonsCfg.GetAttr("echosign"))
return stop
})

Expand Down Expand Up @@ -390,6 +391,20 @@ func expandClientAddonSentry(sentryCfg cty.Value) *management.SentryClientAddon
return &sentryAddon
}

func expandClientAddonEchoSign(echoSignCfg cty.Value) *management.EchoSignClientAddon {
var echoSignAddon management.EchoSignClientAddon

echoSignCfg.ForEachElement(func(_ cty.Value, echoSignCfg cty.Value) (stop bool) {
echoSignAddon = management.EchoSignClientAddon{
Domain: value.String(echoSignCfg.GetAttr("domain")),
}

return stop
})

return &echoSignAddon
}

func clientHasChange(c *management.Client) bool {
return c.String() != "{}"
}
9 changes: 9 additions & 0 deletions internal/auth0/client/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
"mscrm": nil,
"slack": nil,
"sentry": nil,
"echosign": nil,
}

if addons.GetAWS() != nil {
Expand Down Expand Up @@ -179,5 +180,13 @@ func flattenClientAddons(addons *management.ClientAddons) []interface{} {
}
}

if addons.GetEchoSign() != nil {
m["echosign"] = []interface{}{
map[string]interface{}{
"domain": addons.GetEchoSign().GetDomain(),
},
}
}

return []interface{}{m}
}
17 changes: 17 additions & 0 deletions internal/auth0/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,23 @@ func NewResource() *schema.Resource {
},
},
},
"echosign": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Adobe EchoSign SSO configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"domain": {
Description: "Your custom domain found in your EchoSign URL, for example " +
"`https://acme-org.echosign.com` would be `acme-org`.",
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
Expand Down
22 changes: 22 additions & 0 deletions internal/auth0/client/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,19 @@ resource "auth0_client" "my_client" {
}
`

const testAccUpdateClientWithAddonsEchoSign = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - SSO Integration - {{.testName}}"
app_type = "sso_integration"
addons {
echosign {
domain = "acmeorg"
}
}
}
`

func TestAccClientAddons(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
Expand Down Expand Up @@ -933,6 +946,15 @@ func TestAccClientAddons(t *testing.T) {
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.sentry.0.base_url", ""),
),
},
{
Config: acctest.ParseTestName(testAccUpdateClientWithAddonsEchoSign, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - SSO Integration - %s", t.Name())),
resource.TestCheckResourceAttr("auth0_client.my_client", "app_type", "sso_integration"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.#", "1"),
resource.TestCheckResourceAttr("auth0_client.my_client", "addons.0.echosign.0.domain", "acmeorg"),
),
},
},
})
}
Expand Down
Loading

0 comments on commit 1b9e1be

Please sign in to comment.