Перейти к документации
Go

client.DNSConnections

Каждый метод этого пространства имён: его сигнатура, параметры, что он возвращает, и пример.

Методы

The DNS provider accounts connected to the workspace, through which OpenEmail writes the records of a domain itself: list them, read what disconnecting one would leave behind, and disconnect it. Connecting one is done in the app, because the provider asks the person to sign in.

DNSConnections.List

List the DNS provider accounts connected to the workspace

Разрешенияdomains:read
Сигнатура
List(ctx context.Context, opts ...openemail.RequestOption) (openemail.Object, error)

Returns every DNS provider account connected to the workspace, through which OpenEmail writes the records of a domain itself, as the Providers tab of the domains page in the app shows them. Each one names the domains it serves, how many records OpenEmail wrote through it and still keeps, and whether it is active, needs connecting again (needs-reauth) or was disconnected (revoked).

configured is false when this server cannot connect a provider at all. A connection is made in the app, because the provider asks the person to sign in, so there is no method to create one.

Параметры

openemail.WithAPIKeystring

Overrides the client's API key for this call only.

Возвращает

An openemail.Object, with every connection in data, disconnected ones included.

Пример

connection, err := client.DNSConnections.List(ctx)if err != nil {	return err} fmt.Println(connection.Bool("configured"))

Примечания

  • A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's openemail.WithMaxRetries, and on a 429 only when it carries a Retry-After of a minute or less.

Также доступно в

API
GET /dns-connections
TypeScript
dnsConnections.list()
Python
dns_connections.list()
Ruby
dns_connections.list
PHP
dnsConnections->list
Java
dnsConnections().list
C#
DnsConnections.ListAsync
CLI
openemail dns-connections list

DNSConnections.Get

Read a DNS connection and what disconnecting it would leave behind

Разрешенияdomains:read
Сигнатура
Get(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)

Returns one connection with what disconnecting it would do: the domains it serves, the records OpenEmail wrote through it, busy for the domains a sync is running on right now, which hold a disconnect back until it ends, and keepsMail for the verified domains that stop receiving mail once their records come down.

Параметры

idstringОбязательно

A connection id from List.

openemail.WithAPIKeystring

Overrides the client's API key for this call only.

Возвращает

An openemail.Object.

Пример

connection, err := client.DNSConnections.Get(ctx, "dnsl_3f9a1c2e7b4d4e6f8a0b2c3d")if err != nil {	return err} fmt.Println(connection.String("id"), connection.String("status"))

Примечания

  • A connection id that is not in this workspace is a 404 resource_not_found.

  • A GET is retried automatically on network failure and on 408, 500, 502, 503 and 504 responses, up to the client's openemail.WithMaxRetries, and on a 429 only when it carries a Retry-After of a minute or less.

Также доступно в

API
GET /dns-connections/{id}
TypeScript
dnsConnections.get()
Python
dns_connections.get()
Ruby
dns_connections.get
PHP
dnsConnections->get
Java
dnsConnections().get
C#
DnsConnections.GetAsync
CLI
openemail dns-connections get

DNSConnections.Delete

Disconnect a DNS provider account

Разрешенияdomains:write
Сигнатура
Delete(ctx context.Context, id string, opts ...openemail.RequestOption) (openemail.Object, error)

Disconnects the account as Disconnect does in the app: the records OpenEmail wrote through it come down, every domain it serves is detached, and the connection is revoked at the provider. A verified domain whose records come down stops receiving mail, so read Get first. detached counts what came down and lists the records still published, to delete by hand.

A connection that is already disconnected is removed from the list instead, once no domain and no record is left on it, and removed says so.

Параметры

idstringОбязательно

A connection id from List.

openemail.WithAPIKeystring

Overrides the client's API key for this call only.

Возвращает

An openemail.Object with removed, confirmed and detached.

Пример

result, err := client.DNSConnections.Delete(ctx, "dnsl_3f9a1c2e7b4d4e6f8a0b2c3d")if err != nil {	return err} fmt.Println(result.Bool("removed"), result.Object("detached").Int("detached"))

Примечания

  • A sync running on one of its domains is refused with 409 dns_busy, and nothing is revoked. A disconnected connection that still has domains or records on it is refused with 409 dns_connection_in_use.

  • A key or an access token limited to particular addresses or domains is refused with 422 capability_unsupported. An access token acting for a member also needs workspace:manage in their role, or it is refused with 403 insufficient_authority.

  • An OAuth access token needs a verification code for this call, and is refused with 403 step_up_required until the app has verified one in the last 60 minutes. The error matches openemail.ErrStepUpRequired. An API key is never asked for a code.

  • Not retried by the SDK.

Также доступно в

API
DELETE /dns-connections/{id}
TypeScript
dnsConnections.delete()
Python
dns_connections.delete()
Ruby
dns_connections.delete
PHP
dnsConnections->delete
Java
dnsConnections().delete
C#
DnsConnections.DeleteAsync
CLI
openemail dns-connections delete