This is an automated email from the ASF dual-hosted git repository. mitchell852 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
commit 41a1d98ca24b17444354031b9a46048951108185 Author: Dewayne Richardson <dewr...@apache.org> AuthorDate: Thu Mar 22 08:22:23 2018 -0600 added swagger files --- .../traffic_ops_golang/swaggerdocs/README.md | 8 ++ .../traffic_ops_golang/swaggerdocs/alerts.go | 31 +++++ traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go | 151 +++++++++++++++++++++ traffic_ops/traffic_ops_golang/swaggerdocs/docs.go | 52 +++++++ .../traffic_ops_golang/swaggerdocs/gen_docs.sh | 6 + 5 files changed, 248 insertions(+) diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/README.md b/traffic_ops/traffic_ops_golang/swaggerdocs/README.md new file mode 100644 index 0000000..78a4edb --- /dev/null +++ b/traffic_ops/traffic_ops_golang/swaggerdocs/README.md @@ -0,0 +1,8 @@ + +Generates Swagger 2.0 the Traffic Ops API documentation using [go-swagger](https://github.com/go-swagger/go-swagger) meta tags + + +## Setup + +See the install documentation for go-swagger + diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go b/traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go new file mode 100644 index 0000000..dac0823 --- /dev/null +++ b/traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go @@ -0,0 +1,31 @@ +package swaggerdocs + +import tc "github.com/apache/incubator-trafficcontrol/lib/go-tc" + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Alerts - informs the client of server side messages +// swagger:response Alerts +type Alerts struct { + // Alerts Response Body + // + // in: body + Alerts []tc.Alert `json:"alerts"` +} diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go b/traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go new file mode 100644 index 0000000..ea89b4c --- /dev/null +++ b/traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go @@ -0,0 +1,151 @@ +package swaggerdocs + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import v13 "github.com/apache/incubator-trafficcontrol/lib/go-tc/v13" + +// CDNs - CDNsResponse to get the "response" top level key +// swagger:response CDNs +// in: body +type CDNs struct { + // CDN Response Body + // in: body + CDNsResponse v13.CDNsResponse `json:"response"` +} + +// CDN - CDNResponse to get the "response" top level key +// swagger:response CDN +// in: body +type CDN struct { + // CDN Response Body + // in: body + CDNResponse v13.CDNResponse +} + +// CDNQueryParams +// +// swagger:parameters GetCDNs +type CDNQueryParams struct { + + // CDNsQueryParams + + // Enables Domain Name System Security Extensions (DNSSEC) for the CDN + // + DNSSecEnabled string `json:"dnssecEnabled"` + + // The domain name for the CDN + // + DomainName string `json:"domainName"` + + // Unique identifier for the CDN + // + ID string `json:"id"` + + // The CDN name for the CDN + // + Name string `json:"name"` + + // + // + Orderby string `json:"orderby"` +} + +// swagger:parameters PostCDN +type CDNPostParam struct { + // CDN Request Body + // + // in: body + // required: true + CDN v13.CDN +} + +// swagger:parameters GetCDNById DeleteCDN +type CDNPathParams struct { + + // Id associated to the CDN + // in: path + ID int `json:"id"` +} + +// PostCDN swagger:route POST /cdns CDN PostCDN +// +// Create a CDN +// +// Responses: +// 200: Alerts +func PostCDN(entity CDNPostParam) (CDN, Alerts) { + return CDN{}, Alerts{} +} + +// GetCDNs swagger:route GET /cdns CDN GetCDNs +// +// Retrieve a list of CDNs +// +// Responses: +// 200: CDNs +// 400: Alerts +func GetCDNs() (CDNs, Alerts) { + return CDNs{}, Alerts{} +} + +// swagger:parameters PutCDN +type CDNPutParam struct { + + // ID + // in: path + ID int `json:"id"` + + // CDN Request Body + // + // in: body + // required: true + CDN v13.CDN +} + +// PutCDN swagger:route PUT /cdns/{id} CDN PutCDN +// +// Update a CDN +// +// Responses: +// 200: CDN +func PutCDN(entity CDNPutParam) (CDN, Alerts) { + return CDN{}, Alerts{} +} + +// GetCDNById swagger:route GET /cdns/{id} CDN GetCDNById +// +// Retrieve a specific CDN +// +// Responses: +// 200: CDNs +// 400: Alerts +func GetCDNById() (CDNs, Alerts) { + return CDNs{}, Alerts{} +} + +// DeleteCDN swagger:route DELETE /cdns/{id} CDN DeleteCDN +// +// Delete a CDN +// +// Responses: +// 200: Alerts +func DeleteCDN(entityId int) Alerts { + return Alerts{} +} diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/docs.go b/traffic_ops/traffic_ops_golang/swaggerdocs/docs.go new file mode 100644 index 0000000..4045455 --- /dev/null +++ b/traffic_ops/traffic_ops_golang/swaggerdocs/docs.go @@ -0,0 +1,52 @@ +/* + Package docs TrafficOps API + + The following REST APIs are used by the Traffic Portal UI along with several Traffic Control backend component and services. + + This documentation is fully compliant with the Swagger 2.0 specification + + Schemes: http, https + Host: localhost:8443 + BasePath: /api/1.3 + Version: 1.3 + License: Apache 2 https://github.com/apache/incubator-trafficcontrol/blob/master/LICENSE + Contact: Traffic Control Dev List<d...@trafficcontrol.incubator.apache.org> http://traffic-control-cdn.readthedocs.io/en/latest/index.html + + Consumes: + - application/json + + Produces: + - application/json + + Security: + - Cookie: + + SecurityDefinitions: + Cookie: + type: apiKey + name: cookie + in: header + + + swagger:meta +*/ +package swaggerdocs + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/gen_docs.sh b/traffic_ops/traffic_ops_golang/swaggerdocs/gen_docs.sh new file mode 100755 index 0000000..453020a --- /dev/null +++ b/traffic_ops/traffic_ops_golang/swaggerdocs/gen_docs.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +unset DEBUG +#export DEBUG=true +swagger generate spec -o ./swagger.json +echo "successfully generated the swagger.json file" -- To stop receiving notification emails like this one, please contact mitchell...@apache.org.