| 1 | package dnsimplescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.21 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.21 fmt/" |
| 6 | ) |
| 7 | |
| 8 | // ZonesService handles communication with the zone related |
| 9 | // methods of the DNSimple API. |
| 10 | // |
| 11 | // See https://developer.dnsimple.com/v2/zones/ |
| 12 | type ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService# struct { |
| 13 | clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client. *Clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client# |
| 14 | } |
| 15 | |
| 16 | // Zone represents a Zone in DNSimple. |
| 17 | type Zonescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone# struct { |
| 18 | IDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#ID. int64 `json:"id,omitempty"` |
| 19 | AccountIDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#AccountID. int64 `json:"account_id,omitempty"` |
| 20 | Namescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#Name. string `json:"name,omitempty"` |
| 21 | Reversescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#Reverse. bool `json:"reverse,omitempty"` |
| 22 | Secondaryscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#Secondary. bool `json:"secondary,omitempty"` |
| 23 | LastTransferredAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#LastTransferredAt. string `json:"last_transferred_at,omitempty"` |
| 24 | Activescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#Active. bool `json:"active,omitempty"` |
| 25 | CreatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#CreatedAt. string `json:"created_at,omitempty"` |
| 26 | UpdatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone#UpdatedAt. string `json:"updated_at,omitempty"` |
| 27 | } |
| 28 | |
| 29 | // ZoneFile represents a Zone File in DNSimple. |
| 30 | type ZoneFilescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFile# struct { |
| 31 | Zonescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFile#Zone. string `json:"zone,omitempty"` |
| 32 | } |
| 33 | |
| 34 | // ZoneResponse represents a response from an API method that returns a Zone struct. |
| 35 | type ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse# struct { |
| 36 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#Response. |
| 37 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#Data. *Zonescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone# `json:"data"` |
| 38 | } |
| 39 | |
| 40 | // ZonesResponse represents a response from an API method that returns a collection of Zone struct. |
| 41 | type ZonesResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesResponse# struct { |
| 42 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesResponse#Response. |
| 43 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesResponse#Data. []Zonescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Zone# `json:"data"` |
| 44 | } |
| 45 | |
| 46 | // ZoneFileResponse represents a response from an API method that returns a ZoneFile struct. |
| 47 | type ZoneFileResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFileResponse# struct { |
| 48 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFileResponse#Response. |
| 49 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFileResponse#Data. *ZoneFilescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFile# `json:"data"` |
| 50 | } |
| 51 | |
| 52 | // ZoneListOptions specifies the optional parameters you can provide |
| 53 | // to customize the ZonesService.ListZones method. |
| 54 | type ZoneListOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneListOptions# struct { |
| 55 | // Select domains where the name contains given string. |
| 56 | NameLikescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneListOptions#NameLike. *string `url:"name_like,omitempty"` |
| 57 | |
| 58 | ListOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneListOptions#ListOptions. |
| 59 | } |
| 60 | |
| 61 | // ListZones the zones for an account. |
| 62 | // |
| 63 | // See https://developer.dnsimple.com/v2/zones/#listZones |
| 64 | func (s *ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#) ListZonesscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#ListZones().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, options *ZoneListOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneListOptions#) (*ZonesResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesResponse#, error) { |
| 65 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v/zones", accountID)) |
| 66 | zonesResponse := &ZonesResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesResponse#{} |
| 67 | |
| 68 | path, err := addURLQueryOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/addURLQueryOptions().(path, options) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | |
| 73 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client..getscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#get().(ctx, path, zonesResponse) |
| 74 | if err != nil { |
| 75 | return zonesResponse, err |
| 76 | } |
| 77 | |
| 78 | zonesResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 79 | return zonesResponse, nil |
| 80 | } |
| 81 | |
| 82 | // GetZone fetches a zone. |
| 83 | // |
| 84 | // See https://developer.dnsimple.com/v2/zones/#getZone |
| 85 | func (s *ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#) GetZonescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#GetZone().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, zoneName string) (*ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#, error) { |
| 86 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v/zones/%v", accountID, zoneName)) |
| 87 | zoneResponse := &ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#{} |
| 88 | |
| 89 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client..getscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#get().(ctx, path, zoneResponse) |
| 90 | if err != nil { |
| 91 | return nil, err |
| 92 | } |
| 93 | |
| 94 | zoneResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 95 | return zoneResponse, nil |
| 96 | } |
| 97 | |
| 98 | // GetZoneFile fetches a zone file. |
| 99 | // |
| 100 | // See https://developer.dnsimple.com/v2/zones/#getZoneFile |
| 101 | func (s *ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#) GetZoneFilescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#GetZoneFile().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, zoneName string) (*ZoneFileResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFileResponse#, error) { |
| 102 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v/zones/%v/file", accountID, zoneName)) |
| 103 | zoneFileResponse := &ZoneFileResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneFileResponse#{} |
| 104 | |
| 105 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client..getscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#get().(ctx, path, zoneFileResponse) |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | |
| 110 | zoneFileResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 111 | return zoneFileResponse, nil |
| 112 | } |
| 113 | |
| 114 | // ActivateZoneDns activates DNS services for a zone. |
| 115 | // |
| 116 | // See https://developer.dnsimple.com/v2/zones/#activateZoneService |
| 117 | func (s *ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#) ActivateZoneDnsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#ActivateZoneDns().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, zoneName string) (*ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#, error) { |
| 118 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v/zones/%v/activation", accountID, zoneName)) |
| 119 | zoneResponse := &ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#{} |
| 120 | |
| 121 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client..putscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#put().(ctx, path, nil, zoneResponse) |
| 122 | if err != nil { |
| 123 | return nil, err |
| 124 | } |
| 125 | |
| 126 | zoneResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 127 | return zoneResponse, nil |
| 128 | } |
| 129 | |
| 130 | // DeactivateZoneDns deactivates DNS services for a zone. |
| 131 | // |
| 132 | // See https://developer.dnsimple.com/v2/zones/#deactivateZoneService |
| 133 | func (s *ZonesServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#) DeactivateZoneDnsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#DeactivateZoneDns().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, zoneName string) (*ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#, error) { |
| 134 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v/zones/%v/activation", accountID, zoneName)) |
| 135 | zoneResponse := &ZoneResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZoneResponse#{} |
| 136 | |
| 137 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ZonesService#client..deletescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#delete().(ctx, path, nil, zoneResponse) |
| 138 | if err != nil { |
| 139 | return nil, err |
| 140 | } |
| 141 | |
| 142 | zoneResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 143 | return zoneResponse, nil |
| 144 | } |