Documentation
¶
Overview ¶
Package sdk provides a client for the Apollo Open API.
Usage:
client := sdk.NewClient("http://localhost:8070", "token")
apps, err := client.Apps.GetApps(context.Background(), nil)
Index ¶
- type App
- type AppEnvCluster
- type AppsService
- type Client
- type Cluster
- type ClustersService
- type ErrorResponse
- type Item
- type ItemsService
- func (s *ItemsService) Create(ctx context.Context, env, appID, clusterName, namespaceName string, item *Item) (*Item, error)
- func (s *ItemsService) Delete(ctx context.Context, ...) error
- func (s *ItemsService) Get(ctx context.Context, env, appID, clusterName, namespaceName, key string) (*Item, error)
- func (s *ItemsService) List(ctx context.Context, env, appID, clusterName, namespaceName string, ...) (*PageDTO, error)
- func (s *ItemsService) Update(ctx context.Context, env, appID, clusterName, namespaceName string, item *Item) (*Item, error)
- type Namespace
- type NamespaceLock
- type NamespacesService
- func (s *NamespacesService) Create(ctx context.Context, env, appID, clusterName string, namespace *Namespace) (*Namespace, error)
- func (s *NamespacesService) Get(ctx context.Context, env, appID, clusterName, namespaceName string) (*Namespace, error)
- func (s *NamespacesService) GetAll(ctx context.Context, env, appID, clusterName string) ([]*Namespace, error)
- func (s *NamespacesService) GetLock(ctx context.Context, env, appID, clusterName, namespaceName string) (*NamespaceLock, error)
- type PageDTO
- type PublishOptions
- type Release
- type ReleasesService
- func (s *ReleasesService) GetLatest(ctx context.Context, env, appID, clusterName, namespaceName string) (*Release, error)
- func (s *ReleasesService) Publish(ctx context.Context, env, appID, clusterName, namespaceName string, ...) (*Release, error)
- func (s *ReleasesService) Rollback(ctx context.Context, env string, releaseID int, operator string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App 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"`
DataChangeCreatedBy string `json:"dataChangeCreatedBy"`
DataChangeLastModifiedBy string `json:"dataChangeLastModifiedBy"`
DataChangeCreatedTime string `json:"dataChangeCreatedTime"`
DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}
type AppEnvCluster ¶
type AppsService ¶
type AppsService struct {
// contains filtered or unexported fields
}
func (*AppsService) GetApps ¶
GetApps returns the information for all apps or specific apps. URL: http://{portal_address}/openapi/v1/apps appIDs: optional, comma separated appIds
func (*AppsService) GetEnvClusters ¶
func (s *AppsService) GetEnvClusters(ctx context.Context, appID string) ([]*AppEnvCluster, error)
GetEnvClusters returns the environment and cluster information for an app. URL: http://{portal_address}/openapi/v1/apps/{appId}/envclusters
type Client ¶
type Client struct {
// Services used for communicating with different parts of the Apollo Open API.
Apps *AppsService
Clusters *ClustersService
Namespaces *NamespacesService
Items *ItemsService
Releases *ReleasesService
// contains filtered or unexported fields
}
Client handles communication with the Apollo Open API.
func NewClient ¶
NewClient returns a new Apollo Open API client. baseURL: The base URL of the Apollo Portal, e.g., "http://localhost:8070" token: The API token obtained from Apollo Portal
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, method, path string, body interface{}, result interface{}) (*resty.Response, error)
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
type Cluster ¶
type Cluster struct {
Name string `json:"name"`
AppID string `json:"appId"`
ParentClusterID string `json:"parentClusterId"`
DataChangeCreatedBy string `json:"dataChangeCreatedBy"`
DataChangeLastModifiedBy string `json:"dataChangeLastModifiedBy"`
DataChangeCreatedTime string `json:"dataChangeCreatedTime"`
DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}
type ClustersService ¶
type ClustersService struct {
// contains filtered or unexported fields
}
type ErrorResponse ¶
type ErrorResponse struct {
Status int `json:"status"`
Message string `json:"message"`
Exception string `json:"exception"`
Timestamp string `json:"timestamp"`
}
ErrorResponse represents an error response from the Apollo Open API.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Item ¶
type Item struct {
Key string `json:"key"`
Value string `json:"value"`
Comment string `json:"comment"`
DataChangeCreatedBy string `json:"dataChangeCreatedBy"`
DataChangeLastModifiedBy string `json:"dataChangeLastModifiedBy"`
DataChangeCreatedTime string `json:"dataChangeCreatedTime"`
DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}
type ItemsService ¶
type ItemsService struct {
// contains filtered or unexported fields
}
func (*ItemsService) Delete ¶
func (s *ItemsService) Delete(ctx context.Context, env, appID, clusterName, namespaceName, key, operator string) error
type Namespace ¶
type Namespace struct {
AppID string `json:"appId"`
ClusterName string `json:"clusterName"`
NamespaceName string `json:"namespaceName"`
Comment string `json:"comment"`
Format string `json:"format"`
IsPublic bool `json:"isPublic"`
Items []Item `json:"items"`
DataChangeCreatedBy string `json:"dataChangeCreatedBy"`
DataChangeLastModifiedBy string `json:"dataChangeLastModifiedBy"`
DataChangeCreatedTime string `json:"dataChangeCreatedTime"`
DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}
type NamespaceLock ¶
type NamespacesService ¶
type NamespacesService struct {
// contains filtered or unexported fields
}
func (*NamespacesService) GetLock ¶
func (s *NamespacesService) GetLock(ctx context.Context, env, appID, clusterName, namespaceName string) (*NamespaceLock, error)
type PublishOptions ¶
type Release ¶
type Release struct {
AppID string `json:"appId"`
ClusterName string `json:"clusterName"`
NamespaceName string `json:"namespaceName"`
Name string `json:"name"`
Configurations map[string]string `json:"configurations"`
Comment string `json:"comment"`
DataChangeCreatedBy string `json:"dataChangeCreatedBy"`
DataChangeLastModifiedBy string `json:"dataChangeLastModifiedBy"`
DataChangeCreatedTime string `json:"dataChangeCreatedTime"`
DataChangeLastModifiedTime string `json:"dataChangeLastModifiedTime"`
}
type ReleasesService ¶
type ReleasesService struct {
// contains filtered or unexported fields
}
func (*ReleasesService) Publish ¶
func (s *ReleasesService) Publish(ctx context.Context, env, appID, clusterName, namespaceName string, opts *PublishOptions) (*Release, error)