Skip to content

Commit

Permalink
swagger bug fix
Browse files Browse the repository at this point in the history
Signed-off-by: Saurabh Deoras <[email protected]>
  • Loading branch information
sdeoras committed Mar 6, 2018
1 parent 845420d commit 8631faa
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
17 changes: 10 additions & 7 deletions api/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ func (c *clusterApi) getNodeConf(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(config)
}

// swagger:operation DELETE /config/node/{id} config getNodeConfig
// swagger:operation DELETE /config/node/{id} config deleteNodeConfig
//
// Get node configuration.
// Delete node configuration.
//
// This will delete the requested node configuration object
//
Expand All @@ -134,7 +134,8 @@ func (c *clusterApi) getNodeConf(w http.ResponseWriter, r *http.Request) {
// required: true
// type: string
// responses:
// '200'
// '200':
// description: success
func (c *clusterApi) delNodeConf(w http.ResponseWriter, r *http.Request) {
method := "delNodeConf"
inst, err := cluster.Inst()
Expand Down Expand Up @@ -164,10 +165,12 @@ func (c *clusterApi) delNodeConf(w http.ResponseWriter, r *http.Request) {
// description: cluster config json
// required: true
// schema:
// $ref: '#/definitions/ClusterConfig'
// $ref: '#/definitions/ClusterConfig'
// responses:
// 200:
// '200':
// description: success
// schema:
// type: string
func (c *clusterApi) setClusterConf(w http.ResponseWriter, r *http.Request) {
method := "setClusterConf"
inst, err := cluster.Inst()
Expand Down Expand Up @@ -223,8 +226,8 @@ func (c *clusterApi) setClusterConf(w http.ResponseWriter, r *http.Request) {
// schema:
// $ref: '#/definitions/NodeConfig'
// responses:
// 200:
// description: success
// '200':
// description: success
func (c *clusterApi) setNodeConf(w http.ResponseWriter, r *http.Request) {
method := "setNodeConf"
inst, err := cluster.Inst()
Expand Down
39 changes: 37 additions & 2 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@
],
"responses": {
"200": {
"description": "success"
"description": "success",
"schema": {
"type": "string"
}
}
}
}
Expand Down Expand Up @@ -442,7 +445,7 @@
"operationId": "getNodeConfig",
"parameters": [
{
"type": "integer",
"type": "string",
"description": "id to get node with",
"name": "id",
"in": "path",
Expand All @@ -457,6 +460,31 @@
}
}
}
},
"delete": {
"description": "This will delete the requested node configuration object",
"produces": [
"application/json"
],
"tags": [
"config"
],
"summary": "Delete node configuration.",
"operationId": "deleteNodeConfig",
"parameters": [
{
"type": "string",
"description": "id to reference node",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "success"
}
}
}
},
"/loggingurl": {
Expand Down Expand Up @@ -1606,6 +1634,13 @@
"type": "boolean",
"x-go-name": "Multicontainer"
},
"node_id": {
"type": "array",
"items": {
"type": "string"
},
"x-go-name": "NodeId"
},
"nolh": {
"type": "boolean",
"x-go-name": "Nolh"
Expand Down
7 changes: 7 additions & 0 deletions osdconfig/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type NodesConfig struct {
}

// NodeConfig is a node level config data
// swagger:model
type NodeConfig struct {
NodeId string `json:"node_id,omitempty" enable:"true" hidden:"false" usage:"ID for the node"`
Network *NetworkConfig `json:"network,omitempty" enable:"true" hidden:"false" usage:"Network configuration" description:"Configure network values for a node"`
Expand All @@ -20,6 +21,7 @@ func (conf *NodeConfig) Init() *NodeConfig {
}

// KvdbConfig stores parameters defining kvdb configuration
// swagger:model
type KvdbConfig struct {
Username string `json:"username,omitempty" enable:"true" hidden:"false" usage:"Username for kvdb"`
Password string `json:"password,omitempty" enable:"true" hidden:"false" usage:"Passwd for kvdb"`
Expand Down Expand Up @@ -71,6 +73,7 @@ func (conf *ClusterConfig) Init() *ClusterConfig {
}

// NetworkConfig is a network configuration parameters struct
// swagger:model
type NetworkConfig struct {
MgtIface string `json:"mgt_iface,omitempty" enable:"true" hidden:"false" usage:"Management interface"`
DataIface string `json:"data_iface,omitempty" enable:"true" hidden:"false" usage:"Data interface"`
Expand All @@ -81,6 +84,7 @@ func (conf *NetworkConfig) Init() *NetworkConfig {
}

// SecretsConfig is a secrets configuration parameters struct
// swagger:model
type SecretsConfig struct {
SecretType string `json:"secret_type,omitempty" enable:"true" hidden:"false" usage:"Secret type"`
ClusterSecretKey string `json:"cluster_secret_key,omitempty" enable:"true" hidden:"false" usage:"Secret key"`
Expand All @@ -95,6 +99,7 @@ func (conf *SecretsConfig) Init() *SecretsConfig {
}

// VaultConfig is a vault configuration parameters struct
// swagger:model
type VaultConfig struct {
VaultToken string `json:"vault_token,omitempty" enable:"true" hidden:"false" usage:"Vault token"`
VaultAddr string `json:"vault_addr,omitempty" enable:"true" hidden:"false" usage:"Vault address"`
Expand All @@ -112,6 +117,7 @@ func (conf *VaultConfig) Init() *VaultConfig {
}

// AWS configuration parameters struct
// swagger:model
type AWSConfig struct {
AwsAccessKeyId string `json:"aws_access_key_id,omitempty" enable:"true" hidden:"false" usage:"AWS access key ID"`
AwsSecretAccessKey string `json:"aws_secret_access_key,omitempty" enable:"true" hidden:"false" usage:"AWS secret access key"`
Expand All @@ -125,6 +131,7 @@ func (conf *AWSConfig) Init() *AWSConfig {
}

// StorageConfig is a storage configuration parameters struct
// swagger:model
type StorageConfig struct {
DevicesMd []string `json:"devices_md,omitempty" enable:"true" hidden:"false" usage:"Devices MD"`
MaxCount int32 `json:"max_count,omitempty" enable:"true" hidden:"false" usage:"Maximum count"`
Expand Down

0 comments on commit 8631faa

Please sign in to comment.