1// Package additionalprops provides access to the Example API. 2// 3// Usage example: 4// 5// import "google.golang.org/api/additionalprops/v1" 6// ... 7// additionalpropsService, err := additionalprops.New(oauthHttpClient) 8package additionalprops // import "google.golang.org/api/additionalprops/v1" 9 10import ( 11 "bytes" 12 "encoding/json" 13 "errors" 14 "fmt" 15 context "golang.org/x/net/context" 16 ctxhttp "golang.org/x/net/context/ctxhttp" 17 gensupport "google.golang.org/api/gensupport" 18 googleapi "google.golang.org/api/googleapi" 19 "io" 20 "net/http" 21 "net/url" 22 "strconv" 23 "strings" 24) 25 26// Always reference these packages, just in case the auto-generated code 27// below doesn't. 28var _ = bytes.NewBuffer 29var _ = strconv.Itoa 30var _ = fmt.Sprintf 31var _ = json.NewDecoder 32var _ = io.Copy 33var _ = url.Parse 34var _ = gensupport.MarshalJSON 35var _ = googleapi.Version 36var _ = errors.New 37var _ = strings.Replace 38var _ = context.Canceled 39var _ = ctxhttp.Do 40 41const apiId = "additionalprops:v1" 42const apiName = "additionalprops" 43const apiVersion = "v1" 44const basePath = "https://www.googleapis.com/discovery/v1/apis" 45 46func New(client *http.Client) (*Service, error) { 47 if client == nil { 48 return nil, errors.New("client is nil") 49 } 50 s := &Service{client: client, BasePath: basePath} 51 s.Atlas = NewAtlasService(s) 52 return s, nil 53} 54 55type Service struct { 56 client *http.Client 57 BasePath string // API endpoint base URL 58 UserAgent string // optional additional User-Agent fragment 59 60 Atlas *AtlasService 61} 62 63func (s *Service) userAgent() string { 64 if s.UserAgent == "" { 65 return googleapi.UserAgent 66 } 67 return googleapi.UserAgent + " " + s.UserAgent 68} 69 70func NewAtlasService(s *Service) *AtlasService { 71 rs := &AtlasService{s: s} 72 return rs 73} 74 75type AtlasService struct { 76 s *Service 77} 78 79// TimeseriesDescriptor: The descriptions of a time series. 80type TimeseriesDescriptor struct { 81 // Labels: The set of key-value pairs that describe this time series, 82 // including target-specific labels and metric-specific labels. 83 Labels map[string]string `json:"labels,omitempty"` 84 85 // Metric: The name of the metric. 86 Metric string `json:"metric,omitempty"` 87 88 // Project: The project ID to which this time series belongs. 89 Project string `json:"project,omitempty"` 90 91 // Tags: A map of additional information. 92 Tags map[string][]Property `json:"tags,omitempty"` 93 94 // ForceSendFields is a list of field names (e.g. "Labels") to 95 // unconditionally include in API requests. By default, fields with 96 // empty values are omitted from API requests. However, any non-pointer, 97 // non-interface field appearing in ForceSendFields will be sent to the 98 // server regardless of whether the field is empty or not. This may be 99 // used to include empty fields in Patch requests. 100 ForceSendFields []string `json:"-"` 101} 102 103func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) { 104 type noMethod TimeseriesDescriptor 105 raw := noMethod(*s) 106 return gensupport.MarshalJSON(raw, s.ForceSendFields) 107} 108 109// method id "mapofstrings.getMap": 110 111type AtlasGetMapCall struct { 112 s *Service 113 urlParams_ gensupport.URLParams 114 ifNoneMatch_ string 115 ctx_ context.Context 116} 117 118// GetMap: Get a map. 119func (r *AtlasService) GetMap() *AtlasGetMapCall { 120 c := &AtlasGetMapCall{s: r.s, urlParams_: make(gensupport.URLParams)} 121 return c 122} 123 124// Fields allows partial responses to be retrieved. See 125// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 126// for more information. 127func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall { 128 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 129 return c 130} 131 132// IfNoneMatch sets the optional parameter which makes the operation 133// fail if the object's ETag matches the given value. This is useful for 134// getting updates only after the object has changed since the last 135// request. Use googleapi.IsNotModified to check whether the response 136// error from Do is the result of In-None-Match. 137func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall { 138 c.ifNoneMatch_ = entityTag 139 return c 140} 141 142// Context sets the context to be used in this call's Do method. Any 143// pending HTTP request will be aborted if the provided context is 144// canceled. 145func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall { 146 c.ctx_ = ctx 147 return c 148} 149 150func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) { 151 var body io.Reader = nil 152 c.urlParams_.Set("alt", alt) 153 urls := googleapi.ResolveRelative(c.s.BasePath, "map") 154 urls += "?" + c.urlParams_.Encode() 155 req, _ := http.NewRequest("GET", urls, body) 156 googleapi.SetOpaque(req.URL) 157 req.Header.Set("User-Agent", c.s.userAgent()) 158 if c.ifNoneMatch_ != "" { 159 req.Header.Set("If-None-Match", c.ifNoneMatch_) 160 } 161 if c.ctx_ != nil { 162 return ctxhttp.Do(c.ctx_, c.s.client, req) 163 } 164 return c.s.client.Do(req) 165} 166 167// Do executes the "mapofstrings.getMap" call. 168func (c *AtlasGetMapCall) Do(opts ...googleapi.CallOption) (map[string]string, error) { 169 gensupport.SetOptions(c.urlParams_, opts...) 170 res, err := c.doRequest("json") 171 if err != nil { 172 return nil, err 173 } 174 defer googleapi.CloseBody(res) 175 if err := googleapi.CheckResponse(res); err != nil { 176 return nil, err 177 } 178 var ret map[string]string 179 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 180 return nil, err 181 } 182 return ret, nil 183 // { 184 // "description": "Get a map.", 185 // "httpMethod": "GET", 186 // "id": "mapofstrings.getMap", 187 // "path": "map", 188 // "response": { 189 // "$ref": "GetMapResponse" 190 // } 191 // } 192 193} 194