apolloconfig

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateItem = "create"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IApolloConfig

type IApolloConfig interface {
	SessionID() ([]*http.Cookie, error)
	GetApps() (*[]RespApp, error)
	GetCluster(appid string) (*RespClusters, error)
	Namespaces(appID, env, cluster string) (*[]RespNamespaces, error)
	AddPropertyItem(appID, env, cluster, namespace, key, value string) error
	PublishRelease(appID, env, cluster, namespace, releaseTitle, releaseComment string) error
}

func NewProvider

func NewProvider(username, password, gatewayScheme, gatewayHost, gatewayPort string) (IApolloConfig, error)

type Provider

type Provider struct {
	HttpClient    *guzzle.Client
	Username      string `validate:"required"`
	Password      string `validate:"required"`
	GatewayHost   string `validate:"required"`
	GatewayPort   string `validate:"required"`
	GatewayScheme string `validate:"required"`
	Cookie        string
	EndPoint      string
}

func (*Provider) AddPropertyItem

func (p *Provider) AddPropertyItem(appID, env, cluster, namespace string, key, value string) error

func (*Provider) GetApps

func (p *Provider) GetApps() (*[]RespApp, error)

func (*Provider) GetCluster

func (p *Provider) GetCluster(appid string) (*RespClusters, error)

func (*Provider) Namespaces

func (p *Provider) Namespaces(appID, env, namespace string) (*[]RespNamespaces, error)

func (*Provider) PublishRelease

func (p *Provider) PublishRelease(appID, env, cluster, namespace, releaseTitle, releaseComment string) error

func (*Provider) SessionID

func (p *Provider) SessionID() ([]*http.Cookie, error)

type ReqAddPropertyItem

type ReqAddPropertyItem struct {
	TableViewOperType  string `json:"tableViewOperType" validate:"required"`
	Key                string `json:"key" validate:"required" `
	Value              string `json:"value"`
	AddItemBtnDisabled bool   `json:"addItemBtnDisabled"`
}

type ReqReleaseBody

type ReqReleaseBody struct {
	ReleaseTitle       string `json:"releaseTitle"`
	ReleaseComment     string `json:"releaseComment"`
	IsEmergencyPublish bool   `json:"isEmergencyPublish"`
}

type RespApp

type RespApp struct {
	Name                       string `json:"name"`
	AppId                      string `json:"appId"`
	OrgId                      string `json:"orgId"`
	OrgName                    string `json:"orgName"`
	OwnerName                  string `json:"ownerName"`
	OwnerEmail                 string `json:"ownerEmail"`
	Id                         int    `json:"id"`
	IsDeleted                  bool   `json:"isDeleted"`
	DeletedAt                  int    `json:"deletedAt"`
	DataChangeCreatedBy        string `json:"dataChangeCreatedBy"`
	DataChangeCreatedTime      string `json:"dataChangeCreatedTime"`
	DataChangeLastModifiedBy   string `json:"dataChangeLastModifiedBy"`
	DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}

type RespClusters

type RespClusters struct {
	Code     int `json:"code"`
	Entities []struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
		Body    struct {
			Env      string `json:"env"`
			Clusters []struct {
				Id                         int    `json:"id"`
				Name                       string `json:"name"`
				AppId                      string `json:"appId"`
				ParentClusterId            int    `json:"parentClusterId"`
				DataChangeCreatedBy        string `json:"dataChangeCreatedBy"`
				DataChangeLastModifiedBy   string `json:"dataChangeLastModifiedBy"`
				DataChangeCreatedTime      string `json:"dataChangeCreatedTime"`
				DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
			} `json:"clusters"`
		} `json:"body"`
	} `json:"entities"`
}

type RespHistoryRelease

type RespHistoryRelease struct {
	Id                   int    `json:"id"`
	AppId                string `json:"appId"`
	ClusterName          string `json:"clusterName"`
	NamespaceName        string `json:"namespaceName"`
	BranchName           string `json:"branchName"`
	Operator             string `json:"operator"`
	OperatorDisplayName  string `json:"operatorDisplayName"`
	ReleaseId            int    `json:"releaseId"`
	ReleaseTitle         string `json:"releaseTitle"`
	ReleaseComment       string `json:"releaseComment"`
	ReleaseTime          string `json:"releaseTime"`
	ReleaseTimeFormatted string `json:"releaseTimeFormatted"`
	Configuration        []struct {
		FirstEntity  string `json:"firstEntity"`
		SecondEntity string `json:"secondEntity"`
	} `json:"configuration"`
	IsReleaseAbandoned bool `json:"isReleaseAbandoned"`
	PreviousReleaseId  int  `json:"previousReleaseId"`
	Operation          int  `json:"operation"`
	OperationContext   struct {
		IsEmergencyPublish bool `json:"isEmergencyPublish"`
	} `json:"operationContext"`
}

type RespItemChangeBody

type RespItemChangeBody struct {
	Id                         int    `json:"id"`
	NamespaceId                int    `json:"namespaceId"`
	Key                        string `json:"key"`
	Value                      string `json:"value"`
	LineNum                    int    `json:"lineNum"`
	DataChangeCreatedBy        string `json:"dataChangeCreatedBy"`
	DataChangeLastModifiedBy   string `json:"dataChangeLastModifiedBy"`
	DataChangeCreatedTime      string `json:"dataChangeCreatedTime"`
	DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}

type RespNamespaces

type RespNamespaces struct {
	BaseInfo struct {
		Id                         int    `json:"id"`
		AppId                      string `json:"appId"`
		ClusterName                string `json:"clusterName"`
		NamespaceName              string `json:"namespaceName"`
		DataChangeCreatedBy        string `json:"dataChangeCreatedBy"`
		DataChangeLastModifiedBy   string `json:"dataChangeLastModifiedBy"`
		DataChangeCreatedTime      string `json:"dataChangeCreatedTime"`
		DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
	} `json:"baseInfo"`
	ItemModifiedCnt int `json:"itemModifiedCnt"` // 修改的数量, 0: 未修改, >0: 修改的数量,未发布
	Items           []struct {
		Item struct {
			Id                                  int    `json:"id"`
			NamespaceId                         int    `json:"namespaceId"`
			Key                                 string `json:"key"`
			Type                                int    `json:"type"`
			Value                               string `json:"value"`
			Comment                             string `json:"comment"`
			LineNum                             int    `json:"lineNum"`
			DataChangeCreatedBy                 string `json:"dataChangeCreatedBy"`
			DataChangeLastModifiedBy            string `json:"dataChangeLastModifiedBy"`
			DataChangeLastModifiedByDisplayName string `json:"dataChangeLastModifiedByDisplayName"`
			DataChangeCreatedTime               string `json:"dataChangeCreatedTime"`
			DataChangeLastModifiedTime          string `json:"dataChangeLastModifiedTime"`
			DataChangeCreatedByDisplayName      string `json:"dataChangeCreatedByDisplayName,omitempty"`
		} `json:"item"`
		IsModified bool `json:"isModified"` // 是否修改, true: 修改完成未提交发布
		IsDeleted  bool `json:"isDeleted"`  // true: 删除未提交发布
	} `json:"items"`
	Format         string `json:"format"`
	IsPublic       bool   `json:"isPublic"`
	ParentAppId    string `json:"parentAppId"`
	Comment        string `json:"comment"`
	IsConfigHidden bool   `json:"isConfigHidden"`
}

http://localhost:8070/apps/<appid>/envs/<env>/clusters/<cluster>/namespaces

type RespPublishedRelease

type RespPublishedRelease struct {
	Id                         int    `json:"id"`
	ReleaseKey                 string `json:"releaseKey"`
	Name                       string `json:"name"`
	AppId                      string `json:"appId"`
	ClusterName                string `json:"clusterName"`
	NamespaceName              string `json:"namespaceName"`
	Configurations             string `json:"configurations"`
	Comment                    string `json:"comment"`
	IsAbandoned                bool   `json:"isAbandoned"`
	DataChangeCreatedBy        string `json:"dataChangeCreatedBy"`
	DataChangeLastModifiedBy   string `json:"dataChangeLastModifiedBy"`
	DataChangeCreatedTime      string `json:"dataChangeCreatedTime"`
	DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}

Jump to

Keyboard shortcuts

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