ExDoppler.SecretSyncs (ExDoppler v1.0.0)

View Source

Module for interacting with ExDoppler.Sync

๐Ÿ“– Resources

Summary

Functions

create_secrets_sync(config, integration, data)

Creates a new ExDoppler.Sync

Read the API docs!

The data payload differs with each integration. Please use with care

๐Ÿท๏ธ Params

  • config - Config associated with the Sync (e.g %Config{name: "dev_personal", project: "example-project" ...})
  • integration - Integration associated with the Sync (e.g %Integration{slug: "e32d0dcd-c094-4606-aefa-c4127e2a1282" ...})
  • data - A map of data associated with the Sync; the fields will differ depending on the integration

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Sync{...}}

โŒ On Failure

  {:err, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Config
iex> alias ExDoppler.Integrations
iex> alias ExDoppler.SecretSyncs
iex> [integration | _] = Integrations.list_integrations!()
iex> config = %Config{name: "github", project: "example-project"}
iex> if !Enum.empty?(integration.syncs), do: :ok = SecretSyncs.delete_secrets_sync!(config, hd(integration.syncs))
iex> {:ok, github_sync} = SecretSyncs.create_secrets_sync(config, integration, %{sync_target: "repo", repo_name: "ex_doppler"})
iex> {:ok, _secrets_sync} = SecretSyncs.get_secrets_sync(config, github_sync.slug)
iex> :ok = SecretSyncs.delete_secrets_sync!(config, github_sync)

๐Ÿ“– Resources

create_secrets_sync!(config, integration, data)

Same as create_secrets_sync/3 but won't wrap a successful response in {:ok, response}

delete_secrets_sync(config, sync, delete_from_target \\ true)

Deletes a ExDoppler.Sync

๐Ÿท๏ธ Params

  • config - Config associated with the Sync (e.g %Config{name: "dev_personal", project: "example-project" ...})
  • sync - Sync to delete (e.g %Sync{slug: "e32d0dcd-c094-4606-aefa-c4127e2a1282" ...})
  • delete_from_target - Whether or not to delete the synced data from the target integration. Defaults to true

โคต๏ธ Returns

โœ… On Success

  {:ok, {:success, true}}

โŒ On Failure

  {:err, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Config
iex> alias ExDoppler.Integrations
iex> alias ExDoppler.SecretSyncs
iex> [integration | _] = Integrations.list_integrations!()
iex> config = %Config{name: "github", project: "example-project"}
iex> if !Enum.empty?(integration.syncs), do: :ok = SecretSyncs.delete_secrets_sync!(config, hd(integration.syncs))
iex> {:ok, github_sync} = SecretSyncs.create_secrets_sync(config, integration, %{sync_target: "repo", repo_name: "ex_doppler"})
iex> {:ok, _secrets_sync} = SecretSyncs.get_secrets_sync(config, github_sync.slug)
iex> :ok = SecretSyncs.delete_secrets_sync!(config, github_sync)

๐Ÿ“– Resources

delete_secrets_sync!(config, sync, delete_from_target \\ true)

Same as delete_secrets_sync/3 but won't wrap a successful response in {:ok, response}

get_secrets_sync(config, sync_slug)

Retrieves a ExDoppler.Sync

๐Ÿท๏ธ Params

  • config - Config to get secrets from (e.g %Config{name: "dev_personal", project: "example-project" ...})
  • sync_slug - Unique ID for the Sync

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Sync{...}}

โŒ On Failure

  {:err, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Config
iex> alias ExDoppler.Integrations
iex> alias ExDoppler.SecretSyncs
iex> [integration | _] = Integrations.list_integrations!()
iex> config = %Config{name: "github", project: "example-project"}
iex> if !Enum.empty?(integration.syncs), do: :ok = SecretSyncs.delete_secrets_sync!(config, hd(integration.syncs))
iex> {:ok, github_sync} = SecretSyncs.create_secrets_sync(config, integration, %{sync_target: "repo", repo_name: "ex_doppler"})
iex> {:ok, _secrets_sync} = SecretSyncs.get_secrets_sync(config, github_sync.slug)
iex> :ok = SecretSyncs.delete_secrets_sync!(config, github_sync)

๐Ÿ“– Resources

get_secrets_sync!(config, sync_slug)

Same as get_secrets_sync/2 but won't wrap a successful response in {:ok, response}