Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync cloud models with CB-Tumblebug #93

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 46 additions & 20 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1076,40 +1076,32 @@ const docTemplate = `{
"configName": {
"type": "string"
},
"credentialHolder": {
"type": "string"
},
"credentialName": {
"type": "string"
},
"driverName": {
"type": "string"
},
"location": {
"$ref": "#/definitions/common.GeoLocation"
},
"providerName": {
"type": "string"
},
"regionName": {
"type": "string"
}
}
},
"common.GeoLocation": {
"type": "object",
"properties": {
"briefAddr": {
"type": "string"
"regionDetail": {
"$ref": "#/definitions/common.RegionDetail"
},
"cloudType": {
"type": "string"
"regionRepresentative": {
"type": "boolean"
},
"latitude": {
"type": "string"
"regionZoneInfo": {
"$ref": "#/definitions/common.RegionZoneInfo"
},
"longitude": {
"regionZoneInfoName": {
"type": "string"
},
"nativeRegion": {
"type": "string"
"verified": {
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -1195,6 +1187,40 @@ const docTemplate = `{
}
}
},
"common.RegionDetail": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"location": {
"$ref": "#/definitions/common.Location"
},
"regionId": {
"type": "string"
},
"regionName": {
"type": "string"
},
"zones": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"common.RegionZoneInfo": {
"type": "object",
"properties": {
"assignedRegion": {
"type": "string"
},
"assignedZone": {
"type": "string"
}
}
},
"common.RestGetAllNsResponse": {
"type": "object",
"properties": {
Expand Down
66 changes: 46 additions & 20 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1069,40 +1069,32 @@
"configName": {
"type": "string"
},
"credentialHolder": {
"type": "string"
},
"credentialName": {
"type": "string"
},
"driverName": {
"type": "string"
},
"location": {
"$ref": "#/definitions/common.GeoLocation"
},
"providerName": {
"type": "string"
},
"regionName": {
"type": "string"
}
}
},
"common.GeoLocation": {
"type": "object",
"properties": {
"briefAddr": {
"type": "string"
"regionDetail": {
"$ref": "#/definitions/common.RegionDetail"
},
"cloudType": {
"type": "string"
"regionRepresentative": {
"type": "boolean"
},
"latitude": {
"type": "string"
"regionZoneInfo": {
"$ref": "#/definitions/common.RegionZoneInfo"
},
"longitude": {
"regionZoneInfoName": {
"type": "string"
},
"nativeRegion": {
"type": "string"
"verified": {
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -1188,6 +1180,40 @@
}
}
},
"common.RegionDetail": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"location": {
"$ref": "#/definitions/common.Location"
},
"regionId": {
"type": "string"
},
"regionName": {
"type": "string"
},
"zones": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"common.RegionZoneInfo": {
"type": "object",
"properties": {
"assignedRegion": {
"type": "string"
},
"assignedZone": {
"type": "string"
}
}
},
"common.RestGetAllNsResponse": {
"type": "object",
"properties": {
Expand Down
49 changes: 33 additions & 16 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,29 +276,24 @@ definitions:
properties:
configName:
type: string
credentialHolder:
type: string
credentialName:
type: string
driverName:
type: string
location:
$ref: '#/definitions/common.GeoLocation'
providerName:
type: string
regionName:
type: string
type: object
common.GeoLocation:
properties:
briefAddr:
type: string
cloudType:
type: string
latitude:
type: string
longitude:
type: string
nativeRegion:
regionDetail:
$ref: '#/definitions/common.RegionDetail'
regionRepresentative:
type: boolean
regionZoneInfo:
$ref: '#/definitions/common.RegionZoneInfo'
regionZoneInfoName:
type: string
verified:
type: boolean
type: object
common.IID:
properties:
Expand Down Expand Up @@ -355,6 +350,28 @@ definitions:
example: ns01
type: string
type: object
common.RegionDetail:
properties:
description:
type: string
location:
$ref: '#/definitions/common.Location'
regionId:
type: string
regionName:
type: string
zones:
items:
type: string
type: array
type: object
common.RegionZoneInfo:
properties:
assignedRegion:
type: string
assignedZone:
type: string
type: object
common.RestGetAllNsResponse:
properties:
ns:
Expand Down
31 changes: 31 additions & 0 deletions pkg/core/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,44 @@ import (
cbstore_utils "github.com/cloud-barista/cb-store/utils"
)

// CloudInfo is structure for cloud information
type CloudInfo struct {
CSPs map[string]CSPDetail `mapstructure:"cloud" json:"csps"`
}

// CSPDetail is structure for CSP information
type CSPDetail struct {
Description string `mapstructure:"description" json:"description"`
Driver string `mapstructure:"driver" json:"driver"`
Links []string `mapstructure:"link" json:"links"`
Regions map[string]RegionDetail `mapstructure:"region" json:"regions"`
}

// RegionDetail is structure for region information
type RegionDetail struct {
RegionId string `mapstructure:"id" json:"regionId"`
RegionName string `mapstructure:"regionName" json:"regionName"`
Description string `mapstructure:"description" json:"description"`
Location Location `mapstructure:"location" json:"location"`
Zones []string `mapstructure:"zone" json:"zones"`
}

// Location is structure for location information
type Location struct {
Display string `mapstructure:"display" json:"display"`
Latitude float64 `mapstructure:"latitude" json:"latitude"`
Longitude float64 `mapstructure:"longitude" json:"longitude"`
}

// RuntimeCloudInfo is global variable for CloudInfo
var RuntimeCloudInfo = CloudInfo{}

type Credential struct {
Credentialholder map[string]map[string]map[string]string `yaml:"credentialholder"`
}

var RuntimeCredential = Credential{}

// RuntimeLatancyMap is global variable for LatancyMap
var RuntimeLatancyMap = [][]string{}

Expand Down
Loading