Cleanup of json client
This commit is contained in:
parent
3a5d28f064
commit
714b21631e
1 changed files with 31 additions and 18 deletions
|
@ -1,31 +1,44 @@
|
|||
/**
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/rdelval/gorealis"
|
||||
"os"
|
||||
)
|
||||
|
||||
type URIJson struct {
|
||||
|
||||
URI string `json:"uri"`
|
||||
Extract bool `json:"extract"`
|
||||
Cache bool `json:"cache"`
|
||||
URI string `json:"uri"`
|
||||
Extract bool `json:"extract"`
|
||||
Cache bool `json:"cache"`
|
||||
}
|
||||
|
||||
type JobJson struct {
|
||||
Name string `json:"name"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM int64 `json:"ram_mb"`
|
||||
Disk int64 `json:"disk_mb"`
|
||||
Executor string `json:"executor"`
|
||||
Instances int32 `json:"instances"`
|
||||
URIs []URIJson`json:"uris"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Service bool `json:"service"`
|
||||
Ports int `json:"ports"`
|
||||
Name string `json:"name"`
|
||||
CPU float64 `json:"cpu"`
|
||||
RAM int64 `json:"ram_mb"`
|
||||
Disk int64 `json:"disk_mb"`
|
||||
Executor string `json:"executor"`
|
||||
Instances int32 `json:"instances"`
|
||||
URIs []URIJson `json:"uris"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
Service bool `json:"service"`
|
||||
Ports int `json:"ports"`
|
||||
}
|
||||
|
||||
func (j *JobJson) Validate() bool {
|
||||
|
@ -34,15 +47,15 @@ func (j *JobJson) Validate() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if j.CPU == 0.0 {
|
||||
if j.CPU <= 0.0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if j.RAM == 0 {
|
||||
if j.RAM <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if j.Disk == 0 {
|
||||
if j.Disk <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue