func (c *Client) GetDomainID(domainName string) (string, error) {
	domainList := &DomainListResponse{}
	err := c.do(http.MethodGet, "/v1/domains", nil, domainList)
	if err != nil {
		return "", err
	}
	for _, domain := range domainList.Domains {
		if domain.Name == domainName {
			return domain.ID, nil
		}
	}
	return "", fmt.Errorf("no such domain: %s", domainName)
}
GetDomainID returns an ID of specified domain.
package internal
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/http"
)
const (
	identityBaseURL   = "https://identity.%s.conoha.io"
	dnsServiceBaseURL = "https://dns-service.%s.conoha.io"
)
type IdentityRequest struct {
	Auth Auth `json:"auth"`
}
type Auth struct {
	TenantID            string              `json:"tenantId"`
	PasswordCredentials PasswordCredentials `json:"passwordCredentials"`
}
type PasswordCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}
type IdentityResponse struct {
	Access Access `json:"access"`
}
type Access struct {
	Token Token `json:"token"`
}
type Token struct {
	ID string `json:"id"`
}
type DomainListResponse struct {
	Domains []Domain `json:"domains"`
}
type Domain struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}
type RecordListResponse struct {
	Records []Record `json:"records"`
}
type Record struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
	Type string `json:"type"`
	Data string `json:"data"`
	TTL  int    `json:"ttl"`
}
type Client struct {
	token      string
	endpoint   string
	httpClient *http.Client
}
func NewClient(region string, auth Auth, httpClient *http.Client) (*Client, error) {
	if httpClient == nil {
		httpClient = &http.Client{}
	}
	c := &Client{httpClient: httpClient}
	c.endpoint = fmt.Sprintf(identityBaseURL, region)
	identity, err := c.getIdentity(auth)
	if err != nil {
		return nil, fmt.Errorf("failed to login: %w", err)
	}
	c.token = identity.Access.Token.ID
	c.endpoint = fmt.Sprintf(dnsServiceBaseURL, region)
	return c, nil
}
func (c *Client) getIdentity(auth Auth) (*IdentityResponse, error) {
	req := &IdentityRequest{Auth: auth}
	identity := &IdentityResponse{}
	err := c.do(http.MethodPost, "/v2.0/tokens", req, identity)
	if err != nil {
		return nil, err
	}
	return identity, nil
}