models

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StageStr = "STAGE"
)

Variables

View Source
var (
	LIST         = "list"
	PATCH        = "patch"
	CREATE       = "create"
	DELETE       = "delete"
	ALIAS_LIST   = []string{"ls", "show", "out", "output"}
	ALIAS_PATCH  = []string{"patch", "update", "up", "pct", "upgrade", "upd"}
	ALIAS_CREATE = []string{"cre", "add", "sub", "subscribe"}
	ALIAS_DELETE = []string{"del", "rm", "remove", "clean", "clear", "cle"}

	Stages    = createStages()
	FullScope = "openid email profile address user.profile user.read user.write " +
		"group.read group.write group.relation.read group.relation.write" +
		"corporation.read corporation.write corporation.user.read corporation.user.write corporation.group.read  corporation.group.write " +
		"oauth2_client.read oauth2_client.write license.read license.write acl.read acl.write resource_owner.read " +
		"resource_owner.read " +
		"channel_protocol.read channel_protocol.write.internal channel.read  channel.write  " +
		"messaging.subscribe  messaging.publish " +
		"datastore.read  datastore.write  datastore.upload  datastore.download " +
		"file_storage.read file_storage.write file_storage.upload  file_storage.download  " +
		"device.read  device.write  device_model.read device_model.write device.group_policy.read devices.group_policies.write " +
		"geo.area.read geo.area.write geo.area-kind.read geo.area-kind.write geo.area.content.write geo.circle.read geo.circle.write geo.map.read geo.map.write geo.point.read geo.point.write geo.polygon.read geo.polygon.write geo.route.read geo.route.write " +
		"active_license.read active_license.write product.read " +
		"videostream.read videostream.view "
	URL_JSON = cnv.MustIndentJson(URLs{
		"prod": {
			DeviceManagement:      "device-management.optimcloudapis.com",
			DeviceAssetManagement: "device-asset-lifecycle.optimcloudapis.com",
			Monitoring:            "monitoring.optimcloudapis.com",
			Messaging:             "messaging.optimcloudapis.com",
			Location:              "location.optimcloudapis.com",
			Accounts:              "accounts.optimcloudapis.com",
			Storage:               "storage.optimcloudapis.com",
			Iam:                   "iam.optimcloudapis.com",
			Auth:                  "auth.optim.cloud",
			VideoStreams:          "video-streaming.optim.cloud",
		},
		"pre": {
			DeviceManagement: "device-management.preapis.cios.dev",
			Monitoring:       "monitoring.preapis.cios.dev",
			Messaging:        "messaging.preapis.cios.dev",
			Location:         "location.preapis.cios.dev",
			Accounts:         "accounts.preapis.cios.dev",
			Storage:          "storage.preapis.cios.dev",
			Iam:              "iam.preapis.cios.dev",
			Auth:             "auth.pre.cios.dev",
			VideoStreams:     "video-streaming.preapis.cios.dev",
		},
	})
)
View Source
var (
	Dir, _                  = homedir.Dir()
	TopDir                  = Dir + "/.cios-cli"
	DatastoreDir            = TopDir + "/datastore"
	UrlPath                 = utils.Is(os.Getenv("CIOS_CLI_URL_PATH") == "").T(TopDir + "/URL.json").F(os.Getenv("CIOS_CLI_URL_PATH")).Value.(string)
	ConfigPath              = utils.Is(os.Getenv("CIOS_CLI_CONFIG_PATH") == "").T(TopDir + "/config.json").F(os.Getenv("CIOS_CLI_CONFIG_PATH")).Value.(string)
	AccountPath             = TopDir + "/accounts.json"
	TimestampFormatFilePath = TopDir + "/.timestamp_format"
	LifecycleDir            = TopDir + "/lifecycle"
)

Functions

func GetStage

func GetStage() string

func SetStage

func SetStage(stage string) error

func WriteAccounts

func WriteAccounts(account Account) bool

func WriteConfig

func WriteConfig(config Config) bool

func WriteUrls

func WriteUrls(urls URLs) bool

Types

type Account

type Account = map[string]map[string]Config

func GetAccounts

func GetAccounts() (account Account, ok bool)

type Config

type Config struct {
	Refresh      string `json:"refresh"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	LogLevel     string `json:"log_level"`
	Stage        string `json:"stage"`
	AuthType     string `json:"auth_type"`
}

func GetConfig

func GetConfig() (config Config, ok bool)

type Job

type Job map[string]MessagingJobs

type MessagingJob

type MessagingJob struct {
	Channel string              `yaml:"channel"`
	Loop    int                 `yaml:"loop"`
	Plugin  string              `yaml:"plugin"`
	Value   []MessagingJobValue `yaml:"value,flow"`
}

type MessagingJobValue

type MessagingJobValue struct {
	Data      string `yaml:"data"`
	Timestamp int64  `yaml:"timestamp"`
}

type MessagingJobs

type MessagingJobs []MessagingJob

type URL

type URL struct {
	DeviceManagement      string `json:"device"`
	DeviceAssetManagement string `json:"device_asset"`
	Monitoring            string `json:"monitoring"`
	Messaging             string `json:"messaging"`
	Location              string `json:"location"`
	Accounts              string `json:"account"`
	Storage               string `json:"storage"`
	Iam                   string `json:"iam"`
	Auth                  string `json:"auth"`
	VideoStreams          string `json:"video_streaming"`
}

type URLs

type URLs = map[string]URL

func GetUrls

func GetUrls() (urls URLs, ok bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL