diff --git a/internal/provider/resource_auth0_email.go b/internal/provider/resource_auth0_email.go index 3a71dae62..513db2341 100644 --- a/internal/provider/resource_auth0_email.go +++ b/internal/provider/resource_auth0_email.go @@ -137,8 +137,8 @@ func createEmail(ctx context.Context, d *schema.ResourceData, m interface{}) dia return updateEmail(ctx, d, m) } - email := expandEmail(d.GetRawConfig()) - if err := api.Email.Create(email); err != nil { + email := expandEmailProvider(d.GetRawConfig()) + if err := api.EmailProvider.Create(email); err != nil { return diag.FromErr(err) } @@ -148,7 +148,7 @@ func createEmail(ctx context.Context, d *schema.ResourceData, m interface{}) dia func readEmail(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { api := m.(*management.Management) - email, err := api.Email.Read() + email, err := api.EmailProvider.Read() if err != nil { if mErr, ok := err.(management.Error); ok && mErr.Status() == http.StatusNotFound { d.SetId("") @@ -162,7 +162,7 @@ func readEmail(ctx context.Context, d *schema.ResourceData, m interface{}) diag. d.Set("name", email.GetName()), d.Set("enabled", email.GetEnabled()), d.Set("default_from_address", email.GetDefaultFromAddress()), - d.Set("credentials", flattenCredentials(email.GetCredentials(), d)), + d.Set("credentials", flattenEmailProviderCredentials(d, email)), ) return diag.FromErr(result.ErrorOrNil()) @@ -171,8 +171,8 @@ func readEmail(ctx context.Context, d *schema.ResourceData, m interface{}) diag. func updateEmail(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { api := m.(*management.Management) - email := expandEmail(d.GetRawConfig()) - if err := api.Email.Update(email); err != nil { + email := expandEmailProvider(d.GetRawConfig()) + if err := api.EmailProvider.Update(email); err != nil { return diag.FromErr(err) } @@ -182,7 +182,7 @@ func updateEmail(ctx context.Context, d *schema.ResourceData, m interface{}) dia func deleteEmail(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { api := m.(*management.Management) - if err := api.Email.Delete(); err != nil { + if err := api.EmailProvider.Delete(); err != nil { return diag.FromErr(err) } @@ -191,7 +191,7 @@ func deleteEmail(ctx context.Context, d *schema.ResourceData, m interface{}) dia } func emailProviderIsConfigured(api *management.Management) bool { - _, err := api.Email.Read() + _, err := api.EmailProvider.Read() if err, ok := err.(management.Error); ok && err.Status() == http.StatusNotFound { return false } @@ -199,50 +199,133 @@ func emailProviderIsConfigured(api *management.Management) bool { return true } -func expandEmail(config cty.Value) *management.Email { - email := &management.Email{ +func expandEmailProvider(config cty.Value) *management.EmailProvider { + emailProvider := &management.EmailProvider{ Name: value.String(config.GetAttr("name")), Enabled: value.Bool(config.GetAttr("enabled")), DefaultFromAddress: value.String(config.GetAttr("default_from_address")), } - config.GetAttr("credentials").ForEachElement(func(_ cty.Value, config cty.Value) (stop bool) { - email.Credentials = &management.EmailCredentials{ - APIUser: value.String(config.GetAttr("api_user")), - APIKey: value.String(config.GetAttr("api_key")), - AccessKeyID: value.String(config.GetAttr("access_key_id")), - SecretAccessKey: value.String(config.GetAttr("secret_access_key")), - Region: value.String(config.GetAttr("region")), - Domain: value.String(config.GetAttr("domain")), - SMTPHost: value.String(config.GetAttr("smtp_host")), - SMTPPort: value.Int(config.GetAttr("smtp_port")), - SMTPUser: value.String(config.GetAttr("smtp_user")), - SMTPPass: value.String(config.GetAttr("smtp_pass")), + switch emailProvider.GetName() { + case management.EmailProviderMandrill: + expandEmailProviderMandrill(config, emailProvider) + case management.EmailProviderSES: + expandEmailProviderSES(config, emailProvider) + case management.EmailProviderSendGrid: + expandEmailProviderSendGrid(config, emailProvider) + case management.EmailProviderSparkPost: + expandEmailProviderSparkPost(config, emailProvider) + case management.EmailProviderMailgun: + expandEmailProviderMailgun(config, emailProvider) + case management.EmailProviderSMTP: + expandEmailProviderSmtp(config, emailProvider) + } + + return emailProvider +} + +func expandEmailProviderMandrill(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsMandrill{ + APIKey: value.String(credentials.GetAttr("api_key")), } + return stop + }) +} +func expandEmailProviderSES(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsSES{ + AccessKeyID: value.String(credentials.GetAttr("access_key_id")), + SecretAccessKey: value.String(credentials.GetAttr("secret_access_key")), + Region: value.String(credentials.GetAttr("region")), + } return stop }) +} - return email +func expandEmailProviderSendGrid(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsSendGrid{ + APIKey: value.String(credentials.GetAttr("api_key")), + } + return stop + }) +} + +func expandEmailProviderSparkPost(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsSparkPost{ + APIKey: value.String(credentials.GetAttr("api_key")), + Region: value.String(credentials.GetAttr("region")), + } + return stop + }) } -func flattenCredentials(credentials *management.EmailCredentials, d *schema.ResourceData) []interface{} { - if credentials == nil { +func expandEmailProviderMailgun(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsMailgun{ + APIKey: value.String(credentials.GetAttr("api_key")), + Domain: value.String(credentials.GetAttr("domain")), + Region: value.String(credentials.GetAttr("region")), + } + return stop + }) +} + +func expandEmailProviderSmtp(config cty.Value, emailProvider *management.EmailProvider) { + config.GetAttr("credentials").ForEachElement(func(_ cty.Value, credentials cty.Value) (stop bool) { + emailProvider.Credentials = &management.EmailProviderCredentialsSMTP{ + SMTPHost: value.String(credentials.GetAttr("smtp_host")), + SMTPPort: value.Int(credentials.GetAttr("smtp_port")), + SMTPUser: value.String(credentials.GetAttr("smtp_user")), + SMTPPass: value.String(credentials.GetAttr("smtp_pass")), + } + return stop + }) +} + +func flattenEmailProviderCredentials(d *schema.ResourceData, emailProvider *management.EmailProvider) []interface{} { + if emailProvider.Credentials == nil { return nil } - m := map[string]interface{}{ - "api_user": credentials.GetAPIUser(), - "api_key": d.Get("credentials.0.api_key").(string), - "access_key_id": d.Get("credentials.0.access_key_id").(string), - "secret_access_key": d.Get("credentials.0.secret_access_key").(string), - "region": credentials.GetRegion(), - "domain": credentials.GetDomain(), - "smtp_host": credentials.GetSMTPHost(), - "smtp_port": credentials.GetSMTPPort(), - "smtp_user": credentials.GetSMTPUser(), - "smtp_pass": d.Get("credentials.0.smtp_pass").(string), + var credentials interface{} + switch credentialsType := emailProvider.Credentials.(type) { + case *management.EmailProviderCredentialsMandrill: + credentials = map[string]interface{}{ + "api_key": d.Get("credentials.0.api_key").(string), + } + case *management.EmailProviderCredentialsSES: + credentials = map[string]interface{}{ + "access_key_id": d.Get("credentials.0.access_key_id").(string), + "secret_access_key": d.Get("credentials.0.secret_access_key").(string), + "region": credentialsType.GetRegion(), + } + case *management.EmailProviderCredentialsSendGrid: + credentials = map[string]interface{}{ + "api_key": d.Get("credentials.0.api_key").(string), + } + case *management.EmailProviderCredentialsSparkPost: + credentials = map[string]interface{}{ + "api_key": d.Get("credentials.0.api_key").(string), + "region": credentialsType.GetRegion(), + } + case *management.EmailProviderCredentialsMailgun: + credentials = map[string]interface{}{ + "api_key": d.Get("credentials.0.api_key").(string), + "domain": credentialsType.GetDomain(), + "region": credentialsType.GetRegion(), + } + case *management.EmailProviderCredentialsSMTP: + credentials = map[string]interface{}{ + "smtp_host": credentialsType.GetSMTPHost(), + "smtp_port": credentialsType.GetSMTPPort(), + "smtp_user": credentialsType.GetSMTPUser(), + "smtp_pass": d.Get("credentials.0.smtp_pass").(string), + } } - return []interface{}{m} + return []interface{}{credentials} } diff --git a/internal/provider/resource_auth0_email_test.go b/internal/provider/resource_auth0_email_test.go index b00485169..a2b8c741b 100644 --- a/internal/provider/resource_auth0_email_test.go +++ b/internal/provider/resource_auth0_email_test.go @@ -20,11 +20,101 @@ func init() { if err != nil { return err } - return api.Email.Delete() + return api.EmailProvider.Delete() }, }) } +const testAccCreateSESEmailProvider = ` +resource "auth0_email" "my_email_provider" { + name = "ses" + enabled = true + default_from_address = "accounts@example.com" + credentials { + access_key_id = "AKIAXXXXXXXXXXXXXXXX" + secret_access_key = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + region = "us-east-1" + } +} +` + +const testAccCreateMandrillEmailProvider = ` +resource "auth0_email" "my_email_provider" { + name = "mandrill" + enabled = true + default_from_address = "accounts@example.com" + credentials { + api_key = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } +} +` + +const testAccCreateSmtpEmailProvider = ` +resource "auth0_email" "my_email_provider" { + name = "smtp" + enabled = true + default_from_address = "accounts@example.com" + credentials { + smtp_host = "example.com" + smtp_port = 984 + smtp_user = "bob" + smtp_pass = "secret" + } +} +` + +const testAccCreateMailgunEmailProvider = ` +resource "auth0_email" "my_email_provider" { + name = "mailgun" + enabled = true + default_from_address = "accounts@example.com" + credentials { + api_key = "MAILGUNXXXXXXXXXXXXXXX" + domain = "example.com" + region = "eu" + } +} +` + +const testAccUpdateMailgunEmailProvider = ` +resource "auth0_email" "my_email_provider" { + name = "mailgun" + enabled = false + default_from_address = "" + credentials { + api_key = "MAILGUNXXXXXXXXXXXXXXX" + domain = "example.com" + region = "eu" + } +} +` + +const testAccAlreadyConfiguredEmailProviderWillNotConflict = ` +resource "auth0_email" "my_email_provider" { + name = "mailgun" + enabled = false + default_from_address = "" + credentials { + api_key = "MAILGUNXXXXXXXXXXXXXXX" + domain = "example.com" + region = "eu" + } +} + +resource "auth0_email" "no_conflict_email_provider" { + depends_on = [ auth0_email.my_email_provider ] + + name = "mailgun" + enabled = false + default_from_address = "" + credentials { + api_key = "MAILGUNXXXXXXXXXXXXXXX" + domain = "example.com" + region = "eu" + } +} +` + func TestAccEmail(t *testing.T) { httpRecorder := recorder.New(t) @@ -32,62 +122,42 @@ func TestAccEmail(t *testing.T) { ProviderFactories: testProviders(httpRecorder), Steps: []resource.TestStep{ { - Config: ` - resource "auth0_email" "my_email_provider" { - name = "ses" - enabled = true - default_from_address = "accounts@example.com" - credentials { - access_key_id = "AKIAXXXXXXXXXXXXXXXX" - secret_access_key = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - region = "us-east-1" - } - } - `, + Config: testAccCreateSESEmailProvider, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "ses"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "true"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "default_from_address", "accounts@example.com"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.#", "1"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.access_key_id", "AKIAXXXXXXXXXXXXXXXX"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.secret_access_key", "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.region", "us-east-1"), ), }, { - Config: ` - resource "auth0_email" "my_email_provider" { - name = "ses" - enabled = true - default_from_address = "accounts@example.com" - credentials { - access_key_id = "AKIAXXXXXXXXXXXXXXXY" - secret_access_key = "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - region = "us-east-1" - } - } - `, + Config: testAccCreateMandrillEmailProvider, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "ses"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "mandrill"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "true"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "default_from_address", "accounts@example.com"), - resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.access_key_id", "AKIAXXXXXXXXXXXXXXXY"), - resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.secret_access_key", "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), - resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.region", "us-east-1"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.#", "1"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.api_key", "7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), + ), + }, + { + Config: testAccCreateSmtpEmailProvider, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "smtp"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "true"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "default_from_address", "accounts@example.com"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.#", "1"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.smtp_host", "example.com"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.smtp_port", "984"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.smtp_user", "bob"), + resource.TestCheckResourceAttr("auth0_email.my_email_provider", "credentials.0.smtp_pass", "secret"), ), }, { - Config: ` - resource "auth0_email" "my_email_provider" { - name = "mailgun" - enabled = true - default_from_address = "accounts@example.com" - credentials { - api_key = "MAILGUNXXXXXXXXXXXXXXX" - domain = "example.com" - region = "eu" - } - } - `, + Config: testAccCreateMailgunEmailProvider, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "mailgun"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "true"), @@ -97,18 +167,7 @@ func TestAccEmail(t *testing.T) { ), }, { - Config: ` - resource "auth0_email" "my_email_provider" { - name = "mailgun" - enabled = false - default_from_address = "" - credentials { - api_key = "MAILGUNXXXXXXXXXXXXXXX" - domain = "example.com" - region = "eu" - } - } - `, + Config: testAccUpdateMailgunEmailProvider, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "mailgun"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "false"), @@ -118,31 +177,7 @@ func TestAccEmail(t *testing.T) { ), }, { - Config: ` - resource "auth0_email" "my_email_provider" { - name = "mailgun" - enabled = false - default_from_address = "" - credentials { - api_key = "MAILGUNXXXXXXXXXXXXXXX" - domain = "example.com" - region = "eu" - } - } - - resource "auth0_email" "no_conflict_email_provider" { - depends_on = [ auth0_email.my_email_provider ] - - name = "mailgun" - enabled = false - default_from_address = "" - credentials { - api_key = "MAILGUNXXXXXXXXXXXXXXX" - domain = "example.com" - region = "eu" - } - } - `, + Config: testAccAlreadyConfiguredEmailProviderWillNotConflict, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("auth0_email.my_email_provider", "name", "mailgun"), resource.TestCheckResourceAttr("auth0_email.my_email_provider", "enabled", "false"), diff --git a/test/data/recordings/TestAccEmail.yaml b/test/data/recordings/TestAccEmail.yaml index 7de671abc..8589efdc2 100644 --- a/test/data/recordings/TestAccEmail.yaml +++ b/test/data/recordings/TestAccEmail.yaml @@ -19,7 +19,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -36,7 +36,7 @@ interactions: - application/json; charset=utf-8 status: 404 Not Found code: 404 - duration: 1ms + duration: 102.18001ms - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: POST response: @@ -72,7 +72,7 @@ interactions: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 1ms + duration: 132.760842ms - id: 2 request: proto: HTTP/1.1 @@ -91,7 +91,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -108,7 +108,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 140.266821ms - id: 3 request: proto: HTTP/1.1 @@ -127,7 +127,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -144,7 +144,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 122.057583ms - id: 4 request: proto: HTTP/1.1 @@ -163,7 +163,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -180,26 +180,26 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 132.824163ms - id: 5 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 211 + content_length: 150 transfer_encoding: [ ] trailer: { } host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"name":"ses","enabled":true,"default_from_address":"accounts@example.com","credentials":{"accessKeyId":"AKIAXXXXXXXXXXXXXXXY","secretAccessKey":"7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","region":"us-east-1"}} + {"name":"mandrill","enabled":true,"default_from_address":"accounts@example.com","credentials":{"api_key":"7e8c2148xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}} form: { } headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: PATCH response: @@ -210,13 +210,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"name":"ses","enabled":true,"default_from_address":"accounts@example.com","credentials":{"region":"us-east-1"}}' + body: '{"name":"mandrill","enabled":true,"default_from_address":"accounts@example.com","credentials":{}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 91.256324ms - id: 6 request: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -246,13 +246,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"name":"ses","enabled":true,"default_from_address":"accounts@example.com","credentials":{"region":"us-east-1"}}' + body: '{"name":"mandrill","enabled":true,"default_from_address":"accounts@example.com","credentials":{}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 118.364937ms - id: 7 request: proto: HTTP/1.1 @@ -271,7 +271,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -282,13 +282,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"name":"ses","enabled":true,"default_from_address":"accounts@example.com","credentials":{"region":"us-east-1"}}' + body: '{"name":"mandrill","enabled":true,"default_from_address":"accounts@example.com","credentials":{}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 142.130031ms - id: 8 request: proto: HTTP/1.1 @@ -307,7 +307,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -318,14 +318,158 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"name":"ses","enabled":true,"default_from_address":"accounts@example.com","credentials":{"region":"us-east-1"}}' + body: '{"name":"mandrill","enabled":true,"default_from_address":"accounts@example.com","credentials":{}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms + duration: 124.650887ms - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 174 + transfer_encoding: [ ] + trailer: { } + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"smtp","enabled":true,"default_from_address":"accounts@example.com","credentials":{"smtp_host":"example.com","smtp_port":984,"smtp_user":"bob","smtp_pass":"secret"}} + form: { } + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [ ] + trailer: { } + content_length: -1 + uncompressed: true + body: '{"name":"smtp","enabled":true,"default_from_address":"accounts@example.com","credentials":{"smtp_host":"example.com","smtp_port":984,"smtp_user":"bob"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 109.016873ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [ ] + trailer: { } + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: { } + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [ ] + trailer: { } + content_length: -1 + uncompressed: true + body: '{"name":"smtp","enabled":true,"default_from_address":"accounts@example.com","credentials":{"smtp_host":"example.com","smtp_port":984,"smtp_user":"bob"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 125.017117ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [ ] + trailer: { } + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: { } + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [ ] + trailer: { } + content_length: -1 + uncompressed: true + body: '{"name":"smtp","enabled":true,"default_from_address":"accounts@example.com","credentials":{"smtp_host":"example.com","smtp_port":984,"smtp_user":"bob"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 99.538663ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 5 + transfer_encoding: [ ] + trailer: { } + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + null + form: { } + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [ ] + trailer: { } + content_length: -1 + uncompressed: true + body: '{"name":"smtp","enabled":true,"default_from_address":"accounts@example.com","credentials":{"smtp_host":"example.com","smtp_port":984,"smtp_user":"bob"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 103.097223ms + - id: 13 request: proto: HTTP/1.1 proto_major: 1 @@ -337,13 +481,13 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"mailgun","enabled":true,"default_from_address":"accounts@example.com","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","region":"eu","domain":"example.com"}} + {"name":"mailgun","enabled":true,"default_from_address":"accounts@example.com","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","domain":"example.com","region":"eu"}} form: { } headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: PATCH response: @@ -360,8 +504,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 10 + duration: 146.999695ms + - id: 14 request: proto: HTTP/1.1 proto_major: 1 @@ -379,7 +523,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -396,8 +540,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 11 + duration: 150.608009ms + - id: 15 request: proto: HTTP/1.1 proto_major: 1 @@ -415,7 +559,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -432,8 +576,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 12 + duration: 90.406542ms + - id: 16 request: proto: HTTP/1.1 proto_major: 1 @@ -451,7 +595,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -468,8 +612,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 13 + duration: 114.502213ms + - id: 17 request: proto: HTTP/1.1 proto_major: 1 @@ -481,13 +625,13 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"mailgun","enabled":false,"default_from_address":"","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","region":"eu","domain":"example.com"}} + {"name":"mailgun","enabled":false,"default_from_address":"","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","domain":"example.com","region":"eu"}} form: { } headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: PATCH response: @@ -504,8 +648,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 14 + duration: 148.658055ms + - id: 18 request: proto: HTTP/1.1 proto_major: 1 @@ -523,7 +667,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -540,8 +684,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 15 + duration: 97.501372ms + - id: 19 request: proto: HTTP/1.1 proto_major: 1 @@ -559,7 +703,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -576,8 +720,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 16 + duration: 102.768642ms + - id: 20 request: proto: HTTP/1.1 proto_major: 1 @@ -595,7 +739,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -612,8 +756,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 17 + duration: 86.071956ms + - id: 21 request: proto: HTTP/1.1 proto_major: 1 @@ -631,7 +775,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -648,8 +792,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 18 + duration: 101.699668ms + - id: 22 request: proto: HTTP/1.1 proto_major: 1 @@ -661,13 +805,13 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"mailgun","enabled":false,"default_from_address":"","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","region":"eu","domain":"example.com"}} + {"name":"mailgun","enabled":false,"default_from_address":"","credentials":{"api_key":"MAILGUNXXXXXXXXXXXXXXX","domain":"example.com","region":"eu"}} form: { } headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: PATCH response: @@ -684,8 +828,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 19 + duration: 117.919342ms + - id: 23 request: proto: HTTP/1.1 proto_major: 1 @@ -703,7 +847,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -720,8 +864,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 20 + duration: 99.470161ms + - id: 24 request: proto: HTTP/1.1 proto_major: 1 @@ -739,7 +883,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -756,8 +900,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 21 + duration: 112.728143ms + - id: 25 request: proto: HTTP/1.1 proto_major: 1 @@ -775,7 +919,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider?fields=name%2Cenabled%2Cdefault_from_address%2Ccredentials%2Csettings&include_fields=true method: GET response: @@ -792,8 +936,8 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1ms - - id: 22 + duration: 114.079958ms + - id: 26 request: proto: HTTP/1.1 proto_major: 1 @@ -810,7 +954,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: DELETE response: @@ -827,8 +971,8 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 1ms - - id: 23 + duration: 110.719817ms + - id: 27 request: proto: HTTP/1.1 proto_major: 1 @@ -845,7 +989,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/emails/provider method: DELETE response: @@ -862,4 +1006,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 1ms + duration: 107.81514ms