Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feichenxue/apolloapi

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apolloapi-go license

apolloapi

apollo 开放平台接口,其接口包含了增删改查等基本功能,另外还有创建cluster,namespace等等。

Installation

go version >= 1.14 GO111MODULE=on
go get -u github.com/feichenxue/apolloapi

如何使用?

简单示例

package main

import (
	"fmt"
	"github.com/feichenxue/apolloapi"
)

func main() {

	url := "http://x.x.x.x:8080" //你的apollo port 地址
	user := "apollo"     //apollo 用户名, 默认为 apollo
	passwds := "xxxxx"  //apollo 密码

	apollo := apolloapi.NewApollo(url, user, passwds)

	ok, err := apollo.ReleaseApollo("go-test-project", "prd", "comment-test", "default", "application")
	if err != nil {
		fmt.Println(err)
	}

	if ok {
		fmt.Println("发布成功!!!")
	}
}

接口列表

  • NewApollo
func NewApollo(apollourl, username, passwd string) *apolloApi

新建apollo一个对象,用以调用此包内的其它方法

  • CreateApolloProject
func (apollo *apolloApi) CreateApolloProject(appId, name, orgId, orgName, ownerName string) (bool, error)

新建apollo一个项目

  • ReleaseApollo
func (apollo *apolloApi) ReleaseApollo(appid, env, comment, clustersName, namespaceName string) (bool, error)

发布配置接口

  • GetappIDList
func (apollo *apolloApi) GetappIdList() []string

获取apollos所有appid详细信息,其返回值类型为字符串切片

  • CreateCluster
func (apollo *apolloApi) CreateCluster(appId, env, clusterName string) (bool, error)

创建Cluster

  • GetConfigData
func (apollo *apolloApi) GetConfigData(appId, env, clusters, namespaces string) (data map[string]string, err error)

获取相应appid的相应集群下相应namespaces下的配置

未完待续······

About

apollo 开放平台 接口封装

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.