1/*
2Copyright 2018 Comcast Cable Communications Management, LLC
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6Unless required by applicable law or agreed to in writing, software
7distributed under the License is distributed on an "AS IS" BASIS,
8WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9See the License for the specific language governing permissions and
10limitations under the License.
11*/
12
13package vinyldns
14
15import (
16	"strconv"
17	"strings"
18)
19
20// Error represents an error from the
21// vinyldns API
22type Error struct {
23	RequestURL    string
24	RequestMethod string
25	RequestBody   string
26	ResponseBody  string
27	ResponseCode  int
28}
29
30func (d Error) Error() string {
31	components := []string{
32		"Request URL:",
33		d.RequestURL,
34		"Request Method:",
35		d.RequestMethod,
36		"Request body:",
37		d.RequestBody,
38		"Response code: ",
39		strconv.Itoa(d.ResponseCode),
40		"Response body:",
41		d.ResponseBody}
42	return strings.Join(components, "\n")
43}
44
45// ListFilter represents the list query parameters that may be passed to
46// VinylDNS API endpoints such as /zones and /zones/${zone_id}/recordsets
47type ListFilter struct {
48	NameFilter string
49	StartFrom  string
50	MaxItems   int
51}
52
53// NameSort specifies the name sort order for record sets returned by the global list record set response.
54// Valid values are ASC (ascending; default) and DESC (descending).
55type NameSort string
56
57const (
58	// ASC represents an ascending NameSort
59	ASC NameSort = "ASC"
60
61	// DESC represents a descending NameSort
62	DESC NameSort = "DESC"
63)
64
65// GlobalListFilter represents the list query parameters that may be passed to
66// VinylDNS API endpoints such as /recordsets
67type GlobalListFilter struct {
68	RecordNameFilter       string
69	RecordTypeFilter       string
70	RecordOwnerGroupFilter string
71	NameSort               NameSort
72	StartFrom              string
73	MaxItems               int
74}
75