You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/03/27 19:23:18 UTC

[GitHub] mitchell852 closed pull request #2048: Created swaggerdocs for the /divisions API

mitchell852 closed pull request #2048: Created swaggerdocs for the /divisions API
URL: https://github.com/apache/incubator-trafficcontrol/pull/2048
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/go-tc/v13/divisions.go b/lib/go-tc/v13/divisions.go
new file mode 100644
index 000000000..572d021e3
--- /dev/null
+++ b/lib/go-tc/v13/divisions.go
@@ -0,0 +1,54 @@
+package v13
+
+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.
+ */
+
+// A List of Divisions Response
+// swagger:response DivisionsResponse
+type DivisionsResponse struct {
+	// in: body
+	Response []Division `json:"response"`
+}
+
+// A Single Division Response for Update and Create to depict what changed
+// swagger:response DivisionResponse
+// in: body
+type DivisionResponse struct {
+	// in: body
+	Response Division `json:"response"`
+}
+
+// Division ...
+type Division struct {
+
+	// Division ID
+	//
+	ID int `json:"id" db:"id"`
+
+	// LastUpdated
+	//
+	LastUpdated tc.TimeNoMod `json:"lastUpdated" db:"last_updated"`
+
+	// Division Name
+	//
+	// required: true
+	Name string `json:"name" db:"name"`
+}
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/swagger.json b/traffic_ops/traffic_ops_golang/swaggerdocs/swagger.json
deleted file mode 100644
index 0136c96ab..000000000
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/swagger.json
+++ /dev/null
@@ -1,332 +0,0 @@
-{
-  "consumes": [
-    "application/json"
-  ],
-  "produces": [
-    "application/json"
-  ],
-  "schemes": [
-    "http",
-    "https"
-  ],
-  "swagger": "2.0",
-  "info": {
-    "description": "The following REST APIs are used by the Traffic Portal UI along with several Traffic Control backend component and services.\n\nThis documentation is fully compliant with the Swagger 2.0 specification",
-    "title": "TrafficOps API",
-    "contact": {
-      "name": "Traffic Control Dev List",
-      "url": "http://traffic-control-cdn.readthedocs.io/en/latest/index.html",
-      "email": "dev@trafficcontrol.incubator.apache.org"
-    },
-    "license": {
-      "name": "Apache 2",
-      "url": "https://github.com/apache/incubator-trafficcontrol/blob/master/LICENSE"
-    },
-    "version": "1.3"
-  },
-  "host": "localhost:8443",
-  "basePath": "/api/1.3",
-  "paths": {
-    "/cdns": {
-      "get": {
-        "description": "Retrieve a list of CDNs",
-        "tags": [
-          "CDN"
-        ],
-        "operationId": "GetCDNs",
-        "parameters": [
-          {
-            "type": "string",
-            "x-go-name": "DNSSecEnabled",
-            "description": "Enables Domain Name System Security Extensions (DNSSEC) for the CDN",
-            "name": "dnssecEnabled",
-            "in": "query"
-          },
-          {
-            "type": "string",
-            "x-go-name": "DomainName",
-            "description": "The domain name for the CDN",
-            "name": "domainName",
-            "in": "query"
-          },
-          {
-            "type": "string",
-            "x-go-name": "ID",
-            "description": "Unique identifier for the CDN",
-            "name": "id",
-            "in": "query"
-          },
-          {
-            "type": "string",
-            "x-go-name": "Name",
-            "description": "The CDN name for the CDN",
-            "name": "name",
-            "in": "query"
-          },
-          {
-            "type": "string",
-            "x-go-name": "Orderby",
-            "name": "orderby",
-            "in": "query"
-          }
-        ],
-        "responses": {
-          "200": {
-            "$ref": "#/responses/CDNs"
-          },
-          "400": {
-            "$ref": "#/responses/Alerts"
-          }
-        }
-      },
-      "post": {
-        "description": "Create a CDN",
-        "tags": [
-          "CDN"
-        ],
-        "operationId": "PostCDN",
-        "parameters": [
-          {
-            "description": "CDN Request Body",
-            "name": "CDN",
-            "in": "body",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/CDN"
-            }
-          }
-        ],
-        "responses": {
-          "200": {
-            "$ref": "#/responses/Alerts"
-          }
-        }
-      }
-    },
-    "/cdns/{id}": {
-      "get": {
-        "description": "Retrieve a specific CDN",
-        "tags": [
-          "CDN"
-        ],
-        "operationId": "GetCDNById",
-        "parameters": [
-          {
-            "type": "integer",
-            "format": "int64",
-            "x-go-name": "ID",
-            "description": "Id associated to the CDN",
-            "name": "id",
-            "in": "path",
-            "required": true
-          }
-        ],
-        "responses": {
-          "200": {
-            "$ref": "#/responses/CDNs"
-          },
-          "400": {
-            "$ref": "#/responses/Alerts"
-          }
-        }
-      },
-      "put": {
-        "description": "Update a CDN",
-        "tags": [
-          "CDN"
-        ],
-        "operationId": "PutCDN",
-        "parameters": [
-          {
-            "type": "integer",
-            "format": "int64",
-            "x-go-name": "ID",
-            "description": "ID",
-            "name": "id",
-            "in": "path",
-            "required": true
-          },
-          {
-            "description": "CDN Request Body",
-            "name": "CDN",
-            "in": "body",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/CDN"
-            }
-          }
-        ],
-        "responses": {
-          "200": {
-            "$ref": "#/responses/CDN"
-          }
-        }
-      },
-      "delete": {
-        "description": "Delete a CDN",
-        "tags": [
-          "CDN"
-        ],
-        "operationId": "DeleteCDN",
-        "parameters": [
-          {
-            "type": "integer",
-            "format": "int64",
-            "x-go-name": "ID",
-            "description": "Id associated to the CDN",
-            "name": "id",
-            "in": "path",
-            "required": true
-          }
-        ],
-        "responses": {
-          "200": {
-            "$ref": "#/responses/Alerts"
-          }
-        }
-      }
-    }
-  },
-  "definitions": {
-    "Alert": {
-      "type": "object",
-      "properties": {
-        "level": {
-          "type": "string",
-          "x-go-name": "Level"
-        },
-        "text": {
-          "type": "string",
-          "x-go-name": "Text"
-        }
-      },
-      "x-go-package": "github.com/apache/incubator-trafficcontrol/lib/go-tc"
-    },
-    "CDN": {
-      "type": "object",
-      "title": "CDN ...",
-      "required": [
-        "dnssecEnabled",
-        "domainName",
-        "id",
-        "name"
-      ],
-      "properties": {
-        "dnssecEnabled": {
-          "description": "The CDN to retrieve\n\nenables Domain Name Security Extensions on the specified CDN",
-          "type": "boolean",
-          "x-go-name": "DNSSECEnabled"
-        },
-        "domainName": {
-          "description": "DomainName of the CDN",
-          "type": "string",
-          "x-go-name": "DomainName"
-        },
-        "id": {
-          "description": "ID of the CDN",
-          "type": "integer",
-          "format": "int64",
-          "x-go-name": "ID"
-        },
-        "lastUpdated": {
-          "$ref": "#/definitions/TimeNoMod"
-        },
-        "name": {
-          "description": "Name of the CDN",
-          "type": "string",
-          "x-go-name": "Name"
-        }
-      },
-      "x-go-package": "github.com/apache/incubator-trafficcontrol/lib/go-tc/v13"
-    },
-    "CDNResponse": {
-      "description": "A Single CDN Response for Update and Create to depict what changed",
-      "type": "object",
-      "properties": {
-        "response": {
-          "$ref": "#/definitions/CDN"
-        }
-      },
-      "x-go-package": "github.com/apache/incubator-trafficcontrol/lib/go-tc/v13"
-    },
-    "CDNsResponse": {
-      "description": "A List of CDNs Response",
-      "type": "object",
-      "properties": {
-        "response": {
-          "description": "in: body",
-          "type": "array",
-          "items": {
-            "$ref": "#/definitions/CDN"
-          },
-          "x-go-name": "Response"
-        }
-      },
-      "x-go-package": "github.com/apache/incubator-trafficcontrol/lib/go-tc/v13"
-    },
-    "Time": {
-      "description": "Time wraps standard time.Time to allow indication of invalid times",
-      "type": "object",
-      "properties": {
-        "Valid": {
-          "type": "boolean"
-        }
-      },
-      "x-go-package": "github.com/apache/incubator-trafficcontrol/lib/go-tc"
-    },
-    "TimeNoMod": {
-      "description": "TimeNoMod supported JSON marshalling, but suppresses JSON unmarshalling",
-      "$ref": "#/definitions/Time"
-    }
-  },
-  "responses": {
-    "Alerts": {
-      "description": "Alerts - informs the client of server side messages",
-      "schema": {
-        "type": "array",
-        "items": {
-          "$ref": "#/definitions/Alert"
-        }
-      }
-    },
-    "CDN": {
-      "description": "CDN -  CDNResponse to get the \"response\" top level key",
-      "schema": {
-        "$ref": "#/definitions/CDNResponse"
-      }
-    },
-    "CDNResponse": {
-      "description": "A Single CDN Response for Update and Create to depict what changed",
-      "schema": {
-        "$ref": "#/definitions/CDN"
-      }
-    },
-    "CDNs": {
-      "description": "CDNs -  CDNsResponse to get the \"response\" top level key",
-      "schema": {
-        "$ref": "#/definitions/CDNsResponse"
-      }
-    },
-    "CDNsResponse": {
-      "description": "A List of CDNs Response",
-      "schema": {
-        "type": "array",
-        "items": {
-          "$ref": "#/definitions/CDN"
-        }
-      }
-    }
-  },
-  "securityDefinitions": {
-    "Cookie": {
-      "type": "apiKey",
-      "name": "cookie",
-      "in": "header"
-    }
-  },
-  "security": [
-    {
-      "Cookie": []
-    }
-  ]
-}
\ No newline at end of file
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/.gitignore b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/.gitignore
similarity index 100%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/.gitignore
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/.gitignore
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/README.md b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/README.md
similarity index 100%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/README.md
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/README.md
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/alerts.go
similarity index 98%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/alerts.go
index dac0823ec..cc1edfb22 100644
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/alerts.go
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/alerts.go
@@ -1,4 +1,4 @@
-package swaggerdocs
+package v13
 
 import tc "github.com/apache/incubator-trafficcontrol/lib/go-tc"
 
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/cdns.go
similarity index 99%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/cdns.go
index 85a7124fd..77968ef9a 100644
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/cdns.go
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/cdns.go
@@ -1,4 +1,4 @@
-package swaggerdocs
+package v13
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/cors-http-server.py b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/cors-http-server.py
similarity index 100%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/cors-http-server.py
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/cors-http-server.py
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/v13/divisions.go b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/divisions.go
new file mode 100644
index 000000000..0414c17fc
--- /dev/null
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/divisions.go
@@ -0,0 +1,153 @@
+package v13
+
+import v13 "github.com/apache/incubator-trafficcontrol/lib/go-tc/v13"
+
+/*
+ * 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.
+ */
+
+// Divisions -  DivisionsResponse to get the "response" top level key
+// swagger:response Divisions
+// in: body
+type Divisions struct {
+	// Division Response Body
+	// in: body
+	DivisionsResponse v13.DivisionsResponse `json:"response"`
+}
+
+// Division -  DivisionResponse to get the "response" top level key
+// swagger:response Division
+// in: body
+type Division struct {
+	// Division Response Body
+	// in: body
+	DivisionResponse v13.DivisionResponse
+}
+
+// DivisionQueryParams
+//
+// swagger:parameters GetDivisions
+type DivisionQueryParams struct {
+
+	// DivisionsQueryParams
+
+	// Name for this Division
+	//
+	Name string `json:"name"`
+
+	// Unique identifier for the Division
+	//
+	ID string `json:"id"`
+
+	// The field in the response to sort the response by
+	//
+	Orderby string `json:"orderby"`
+}
+
+// swagger:parameters PostDivision
+type DivisionPostParam struct {
+	// Division Request Body
+	//
+	// in: body
+	// required: true
+	Division v13.Division
+}
+
+// swagger:parameters GetDivisionById DeleteDivision
+type DivisionPathParams struct {
+
+	// Id associated to the Division
+	// in: path
+	ID int `json:"id"`
+}
+
+// PostDivision swagger:route POST /divisions Division PostDivision
+//
+// Create a Division
+//
+// A Division is a group of regions
+//
+// Responses:
+//          200: Alerts
+func PostDivision(entity DivisionPostParam) (Division, Alerts) {
+	return Division{}, Alerts{}
+}
+
+// GetDivisions swagger:route GET /divisions Division GetDivisions
+//
+// Retrieve a list of Divisions
+//
+// List of Divisions
+//
+// Responses:
+//          200: Divisions
+//          400: Alerts
+func GetDivisions() (Divisions, Alerts) {
+	return Divisions{}, Alerts{}
+}
+
+// swagger:parameters PutDivision
+type DivisionPutParam struct {
+
+	// ID
+	// in: path
+	ID int `json:"id"`
+
+	// Division Request Body
+	//
+	// in: body
+	// required: true
+	Division v13.Division
+}
+
+// PutDivision swagger:route PUT /divisions/{id} Division PutDivision
+//
+// Update a Division by Id
+//
+// Update a single Division
+//
+// Responses:
+//          200: Division
+func PutDivision(entity DivisionPutParam) (Division, Alerts) {
+	return Division{}, Alerts{}
+}
+
+// GetDivisionById swagger:route GET /divisions/{id} Division GetDivisionById
+//
+// Retrieve a specific Division by Id
+//
+// Retrieve a single division
+//
+// Responses:
+//          200: Divisions
+//          400: Alerts
+func GetDivisionById() (Divisions, Alerts) {
+	return Divisions{}, Alerts{}
+}
+
+// DeleteDivision swagger:route DELETE /divisions/{id} Division DeleteDivision
+//
+// Delete a Division by Id
+//
+// Delete a single Division
+//
+// Responses:
+//          200: Alerts
+func DeleteDivision(entityId int) Alerts {
+	return Alerts{}
+}
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/docs.go b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docs.go
similarity index 98%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/docs.go
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/docs.go
index e9b426186..ee55e9cd7 100644
--- a/traffic_ops/traffic_ops_golang/swaggerdocs/docs.go
+++ b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/docs.go
@@ -30,7 +30,7 @@
 
  swagger:meta
 */
-package swaggerdocs
+package v13
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/traffic_ops/traffic_ops_golang/swaggerdocs/gen_docs.sh b/traffic_ops/traffic_ops_golang/swaggerdocs/v13/gen_docs.sh
similarity index 100%
rename from traffic_ops/traffic_ops_golang/swaggerdocs/gen_docs.sh
rename to traffic_ops/traffic_ops_golang/swaggerdocs/v13/gen_docs.sh


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services