Bandwidth.Resources.Domains

A Domain resource represents a logical grouping of Endpoints resources. The name of the domain will be part of a public DNS record. For that reason, we let the customer choose their domain names. Once a domain has been created, endpoints can be created and managed within the context of the domain. Because endpoints can only exist within the context of a domain, creating a domain is the first step in creating endpoints.

Bandwidth Docs

Summary

create(client, domain)

Create a domain

delete(client, id)

Delete a domain

list(client)

Get a list of your domains

Functions

create(client, domain)

Specs:

  • create(Client.t, Map.t) :: Client.response

Create a domain.

Example:

domain = %{
  name: "my-domain",
  description: "This is my domain"
}
case Bandwidth.Resources.Domains.create(client, domain) do
  {:ok, {201, _, _}} -> IO.puts "Domain created"
  {:error, reason}   -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

delete(client, id)

Specs:

  • delete(Client.t, binary) :: Client.response

Delete a domain.

Example:

case Bandwidth.Resources.Domains.delete(client, "some-domain-id") do
  {:ok, {200, _, _}} -> IO.puts "Domain deleted"
  {:error, reason}   -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

list(client)

Specs:

  • list(Client.t) :: Client.response

Get a list of your domains.

Example:

case Bandwidth.Resources.Domains.list(client) do
  {:ok, {200, domains, _}} -> IO.inspect domains
  {:error, reason}         -> IO.puts "Error: #{reason}"
end

Bandwidth Docs