Skip to content

Commit

Permalink
Fix: function naming
Browse files Browse the repository at this point in the history
  • Loading branch information
nayuta committed Mar 9, 2024
1 parent 26350a1 commit 2e147c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions github/resource_github_organization_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hoo

config := d.Get("configuration").([]interface{})
if len(config) > 0 {
hook.Config = webhookConfigurationSchemaElemToObject(config)
hook.Config = convertWebhookConfigurationElemToObject(config)
}

return hook
Expand Down Expand Up @@ -99,7 +99,7 @@ func resourceGithubOrganizationWebhookCreate(d *schema.ResourceData, meta interf
hook.Config.Secret = webhookObj.Config.Secret
}

config := webhookConfigurationObjectToSchemaElem(hook.Config)
config := convertWebhookConfiguration(hook.Config)
if err = d.Set("configuration", config); err != nil {
return err
}
Expand Down Expand Up @@ -166,7 +166,7 @@ func resourceGithubOrganizationWebhookRead(d *schema.ResourceData, meta interfac
}
}

config := webhookConfigurationObjectToSchemaElem(hook.Config)
config := convertWebhookConfiguration(hook.Config)

if err = d.Set("configuration", config); err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions github/resource_github_repository_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func resourceGithubRepositoryWebhookObject(d *schema.ResourceData) *github.Hook

config := d.Get("configuration").([]interface{})
if len(config) > 0 {
hook.Config = webhookConfigurationSchemaElemToObject(config)
hook.Config = convertWebhookConfigurationElemToObject(config)
}

return hook
Expand All @@ -113,7 +113,7 @@ func resourceGithubRepositoryWebhookCreate(d *schema.ResourceData, meta interfac
hook.Config.Secret = hk.Config.Secret
}

config := webhookConfigurationObjectToSchemaElem(hook.Config)
config := convertWebhookConfigurationObjectToElem(hook.Config)
if err = d.Set("configuration", config); err != nil {
return err
}
Expand Down Expand Up @@ -172,7 +172,7 @@ func resourceGithubRepositoryWebhookRead(d *schema.ResourceData, meta interface{
}
}

config := webhookConfigurationObjectToSchemaElem(hook.Config)
config := convertWebhookConfigurationObjectToElem(hook.Config)
if err = d.Set("configuration", config); err != nil {
return err
}
Expand Down Expand Up @@ -215,7 +215,7 @@ func resourceGithubRepositoryWebhookDelete(d *schema.ResourceData, meta interfac
return err
}

func webhookConfigurationObjectToSchemaElem(hookConfig *github.HookConfig) []interface{} {
func convertWebhookConfigurationObjectToElem(hookConfig *github.HookConfig) []interface{} {
configuration := []interface{}{
map[string]interface{}{
"url": hookConfig.URL,
Expand All @@ -230,7 +230,7 @@ func webhookConfigurationObjectToSchemaElem(hookConfig *github.HookConfig) []int
return configuration
}

func webhookConfigurationSchemaElemToObject(hookConfigSchemaElem []interface{}) *github.HookConfig {
func convertWebhookConfigurationElemToObject(hookConfigSchemaElem []interface{}) *github.HookConfig {
configuration := &github.HookConfig{
URL: github.String(hookConfigSchemaElem[0].(map[string]interface{})["url"].(string)),
ContentType: github.String(hookConfigSchemaElem[0].(map[string]interface{})["content_type"].(string)),
Expand Down

0 comments on commit 2e147c1

Please sign in to comment.