cloud

package module
v0.0.0-...-e99f885 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 22 Imported by: 3

README

cloud-go-sdk

The Go SDK for accessing API7 Cloud API

Installation

Make sure you're using Go Modules to manage your Go Project, and your Go version needs to be 1.19 or later.

go mod init

Then, import the cloud-go-sdk in your Go program by running:

import (
	"github.com/api7/cloud-go-sdk"
)

Alternatively, download the cloud-go-sdk by running:

go get -u github.com/api7/cloud-go-sdk

Mock

You may want to add unit test cases after you import cloud-go-sdk into your Go program, for the sake of better integration, cloud-go-sdk uses mockgen to generate mock implementations.

e.g., for the Interface, we have a MockInterface implementation. If you want to mock an Application create error, you can write some codes like:

ctrl := gomock.NewController(t) // var t *testing.T
cloud := NewMockInterface(ctrl)
cloud.EXPECT().CreateApplication(gomock.Any(), &Application{
    ApplicationSpec: ApplicationSpec{
        Name:        "test app",
		Description: "This is a test app",
           Protocols:   []string{ProtocolHTTP},
           PathPrefix:  "/api/v1",
           Hosts:       []string{"app.test.com"},
           Upstreams: []UpstreamAndVersion{
			{
				Upstream: Upstream{
					Scheme: "https",
					LBType: "roundrobin",
					Targets: []UpstreamTarget{
						{
							Host:   "10.0.5.1", 
							Port:   80,
							Weight: 100,
						},
						{
							Host:   "10.0.5.2",
							Port:   80,
							Weight: 100,
						},
					},
				}, 
				Version: "default",
			},
		   }, 
		   DefaultUpstreamVersion: "default", 
		   Active:                 ActiveStatus,
	},
}, &ApplicationCreateOptions{
	Cluster: &Cluster{
		ID: 1,
	},
}).Return(nil, errors.New("mock error"))

Development

Run test cases via running:

make test

Regenerate mock codes by running:

make mockgen

Documentation

Overview

Package cloud provides the Go SDK for accessing API7 Cloud API.

Index

Constants

View Source
const (
	// ClusterPending means a cluster is not created yet.
	ClusterPending = ClusterStage(iota + 1)
	// ClusterCreating means a cluster is being created.
	ClusterCreating
	// ClusterNormal means a cluster was created, and now it's normal.
	ClusterNormal
	// ClusterCreateFailed means a cluster was not created successfully.
	ClusterCreateFailed
	// ClusterDeleting means a cluster is being deleted.
	ClusterDeleting
	// ClusterDeleted means a cluster was deleted.
	ClusterDeleted
)
View Source
const (
	// RewriteServerHeader means rewrite the Server header in the response.
	RewriteServerHeader = "Rewrite"
	// HideVersionToken means hide the APISIX version info in the Server header.
	HideVersionToken = "Hide Version Token"
)
View Source
const (
	// RealIPPositionHeader indicates the real ip is in an HTTP header.
	RealIPPositionHeader = "header"
	// RealIPPositionQuery indicates the real ip is in a query string.
	RealIPPositionQuery = "query"
	// RealIPPositionCookie indicates the real ip is in cookie.
	RealIPPositionCookie = "cookie"
)
View Source
const (
	// GatewayInstanceHealthy indicates the instance is healthy. Note Healthy means
	// the heartbeat probes sent from the instance are received periodically,
	// at the same while, the configuration delivery (currently it's ETCD
	// connections) is also normal.
	GatewayInstanceHealthy = GatewayInstanceStatus("Healthy")
	// GatewayInstanceOnlyHeartbeats indicates the instance sends heartbeat probes
	// periodically but the configuration cannot be delivered to the instance.
	GatewayInstanceOnlyHeartbeats = GatewayInstanceStatus("Only Heartbeats")
	// GatewayInstanceLostConnection indicate the instance lose heartbeat in short time(between InstanceLostConnectionThresholdDuration and InstanceOfflineThresholdDuration)
	GatewayInstanceLostConnection = GatewayInstanceStatus("Lost Connection")
	// GatewayInstanceOffline indicates the instance loses heartbeat for long time(out-of the InstanceLiveThresholdDuration)
	GatewayInstanceOffline = GatewayInstanceStatus("Offline")
)
View Source
const (
	// Any means any status
	Any = EntityStatus(-1)
	// Uninitialized represents the entity has been saved to the db, but the associated resource has not yet been ready
	Uninitialized = EntityStatus(0)
	// Normal indicates that the entity and associated resources are ready
	Normal = EntityStatus(50)
	// Deleted indicates the entity has been deleted
	Deleted = EntityStatus(100)
)
View Source
const (
	// APITypeRest indicates this is a Rest API.
	APITypeRest = "Rest"
	// APITypeWebSocket indicates this is a Websocket API.
	APITypeWebSocket = "WebSocket"

	// CanaryReleaseTypePercent means using percent to do canary release
	CanaryReleaseTypePercent = "percent"
	// CanaryReleaseTypeRule means using rule match to do canary release
	CanaryReleaseTypeRule = "rule"
)
View Source
const (
	// PathPrefixMatch means the requests' URL path leads with the API path will match this API;
	PathPrefixMatch = "Prefix"
	// PathExactMatch means the requests' URL path has to be same to the API path.
	PathExactMatch = "Exact"
)
View Source
const (
	// ProtocolHTTP indicates the HTTP protocol.
	ProtocolHTTP = "HTTP"
	// ProtocolHTTPS indicates the HTTPS protocol.
	ProtocolHTTPS = "HTTPS"
)
View Source
const (
	// ActiveStatus indicates an object is active, and this object
	// will be seen by gateway instances.
	ActiveStatus = iota
	// InactiveStatus indicates an object is inactive, and this object
	// won't be seen by gateway instances.
	InactiveStatus
)
View Source
const (
	// CanaryReleaseStatePaused indicates the pause state of CanaryRelease.
	CanaryReleaseStatePaused = "paused"
	// CanaryReleaseStateInProgress indicates the in_progress state of CanaryRelease.
	CanaryReleaseStateInProgress = "in_progress"
	// CanaryReleaseStateFinished indicates the finish state of CanaryRelease.
	CanaryReleaseStateFinished = "finished"
)
View Source
const (
	// RoleScopeOrganization indicates an organization scoped role.
	RoleScopeOrganization = "organization"
	// RoleScopeCluster indicates a cluster scoped role.
	RoleScopeCluster = "cluster"

	// MemberStatePending means the member is still in pending state.
	MemberStatePending = "Pending"
	// MemberStateActive means the member is active.
	MemberStateActive = "Active"
)
View Source
const (
	// HealthCheckTypeTCP indicates a TCP-type health check.
	HealthCheckTypeTCP = "tcp"
	// HealthCheckTypeHTTP indicates an HTTP-type health check.
	HealthCheckTypeHTTP = "http"
	// HealthCheckTypeHTTPS indicates an HTTPS-type health check.
	HealthCheckTypeHTTPS = "https"

	// UpstreamSchemeHTTP indicates the http scheme for communicating with upstream.
	UpstreamSchemeHTTP = "http"
	// UpstreamSchemeHTTPS indicates the https scheme for communicating with upstream.
	UpstreamSchemeHTTPS = "https"

	// LoadBalanceRoundRobin indicates the weighted round robin load balancing algorithm.
	LoadBalanceRoundRobin = "roundrobin"
	// LoadBalanceConsistentHash indicates the consistent hash load balancing algorithm.
	LoadBalanceConsistentHash = "consistent_hash"
	// LoadBalanceEWMA indicates the ewma load balancing algorithm.
	LoadBalanceEWMA = "ewma"
	// LoadBalanceLeastConn indicates the  least connection load balancing algorithm.
	LoadBalanceLeastConn = "least_conn"
)
View Source
const (
	// DeleteURITailSlash means delete the tail slash of the request uri before matching
	DeleteURITailSlash = "Delete Tail Slash"
)
View Source
const (
	// ServiceRegistryKubernetes indicates the kubernetes-type service registry.
	ServiceRegistryKubernetes = ServiceRegistryType(iota) + 1
)

Variables

View Source
var (
	ClusterHeaderName    = "X-API7-Cloud-Gateway-Cluster-ID"
	ErrClusterIDNotExist = errors.New("cluster id not exist")
)
View Source
var (
	// DefaultOptions contains the default settings for all the options.
	DefaultOptions = &Options{
		ServerAddr:            "https://api.api7.cloud",
		Token:                 "",
		TokenPath:             "",
		DialTimeout:           5 * time.Second,
		InsecureSkipTLSVerify: false,
		ServerNameIndication:  "",
		ClientCert:            "",
		ClientPrivateKey:      "",
		EnableHTTPTrace:       false,
	}
)
View Source
var (
	// DefaultPagination is the default paging.
	DefaultPagination = Pagination{
		Page:     1,
		PageSize: 10,
	}
)
View Source
var (
	// ErrEmptyToken indicates the access token value is empty.
	ErrEmptyToken = errors.New("empty access token")
)

Functions

func FormatTraceSeries

func FormatTraceSeries(data *TraceSeries) string

Types

type API

type API struct {
	APISpec `json:",inline" gorm:"column:spec"`

	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// AppID is id of app that current api belong with
	AppID ID `json:"app_id"`
	// Status is status of api
	Status EntityStatus `json:"status"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
}

API is the definition of API7 Cloud API, which also contains some management fields.

API is an affiliated resource of Application.

type APIInterface

type APIInterface interface {
	// CreateAPI creates an API7 Cloud API in the specified Application.
	// The given `api` parameter should specify the desired API specification.
	// Users need to specify the Application in the `opts`.
	// The returned APi will contain the same API specification plus some
	// management fields and default values.
	CreateAPI(ctx context.Context, api *API, opts *ResourceCreateOptions) (*API, error)
	// UpdateAPI updates an existing API7 Cloud API in the specified Application.
	// The given `api` parameter should specify the desired API specification.
	// Users need to specify the Application in the `opts`.
	// The returned API will contain the same API specification plus some
	// management fields and default values.
	UpdateAPI(ctx context.Context, api *API, opts *ResourceUpdateOptions) (*API, error)
	// DeleteAPI deletes an existing API7 Cloud API in the specified Application.
	// The given `apiID` parameter should specify the API that you want to delete.
	// Users need to specify the Application in the `opts`.
	DeleteAPI(ctx context.Context, apiID ID, opts *ResourceDeleteOptions) error
	// GetAPI gets an existing API7 Cloud API in the specified Application.
	// The given `apiID` parameter should specify the API that you want to get.
	// Users need to specify the Application in the `opts`.
	GetAPI(ctx context.Context, apiID ID, opts *ResourceGetOptions) (*API, error)
	// PublishAPI publishes the APi in the specified Application (which is
	// a shortcut of UpdateAPI and set APISpec.Active to ActiveStatus).
	// The given `apiID` parameter should specify the API that you want to operate.
	// Users need to specify the Application in the `opts`.
	// The updated API will be returned and the APISpec.Active field should be ActiveStatus.
	PublishAPI(ctx context.Context, apiID ID, opts *ResourceUpdateOptions) (*API, error)
	// UnpublishAPI publishes the API in the specified Application (which is
	// a shortcut of UpdateAPI and set APISpec.Active to InactiveStatus).
	// The given `apiID` parameter should specify the API that you want to operate.
	// Users need to specify the Application in the `opts`.
	// The updated APi will be returned and the APISpec.Active field should be InactiveStatus.
	UnpublishAPI(ctx context.Context, apiID ID, opts *ResourceUpdateOptions) (*API, error)
	// ListAPIs returns an iterator for listing APIs in the specified Application with the
	// given list conditions.
	// Users need to specify the Application, Paging and Filter conditions (if necessary)
	// in the `opts`.
	ListAPIs(ctx context.Context, opts *ResourceListOptions) (APIListIterator, error)
	// DebugAPIResources returns the corresponding translated APISIX resources for this API.
	// The given `apiID` parameter should specify the API that you want to operate.
	// Users need to specify the Cluster.ID in the `opts`.
	DebugAPIResources(ctx context.Context, apiID ID, opts *ResourceGetOptions) (string, error)
}

APIInterface is the interface for manipulating API.

type APIListIterator

type APIListIterator interface {
	// Next returns the next API according to the filter conditions.
	Next() (*API, error)
}

APIListIterator is an iterator for listing APIs.

type APIPath

type APIPath struct {
	// Path is the URL path (after the Application path prefix) that the API will listen,
	// when Path is empty, the whole path is equal to the Application path prefix.
	Path string `json:"path"`
	// PathType determines the match type, by default it is prefix match.
	// Optional values can be:
	// * PathPrefixMatch means the requests' URL path leads with the API path will match this API;
	// * PathExactMatch means the requests' URL path has to be same to the API path.
	PathType string `json:"path_type"`
}

APIPath is the path definition for an API.

type APIProxySettings

type APIProxySettings struct {
	// EnableRequestBuffering indicates whether to enable request buffering
	EnableRequestBuffering bool `json:"enable_request_buffering"`
	// ServerHeaderCustomization is the server header customization settings
	ServerHeaderCustomization *ServerHeaderCustomization `json:"server_header_customization,omitempty"`
	// URLHandlingOptions is the url handling options using in  gateway
	// Optional values are:
	// * DeleteURITailSlash
	URLHandlingOptions []string `json:"url_handling_options"`
}

APIProxySettings is the api proxy settings config

type APISpec

type APISpec struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// Labels are used for resource classification and indexing
	Labels []string `json:"labels,omitempty"`
	// Methods are allowed HTTP methods to access this API, if absent, all HTTP methods are allowed
	Methods []string `json:"methods"`
	// Paths indicates which URI paths can be matched (prefix or exact) to this API.
	Paths []APIPath `json:"paths"`
	// FineGrainedRouteControl is used to control the route matching.
	FineGrainedRouteControl *FineGrainedRouteControl `json:"fine_grained_route_control,omitempty"`
	// StripPathPrefix indicates whether to strip the path prefix (defined in the Application)
	// before the gateway forwards API requests to upstream.
	StripPathPrefix bool `json:"strip_path_prefix"`
	// Plugins settings on API level, it'll override the same one on Application level
	// (instead of running them twice).
	Plugins Plugins `json:"plugins,omitempty"`
	// Active is the status of the API
	// Optional values can be:
	// * ActiveStatus: the object is active.
	// * InactiveStatus: the object is inactive.
	Active int `json:"active"`
	// Type is the type of the API
	// Optional values can be:
	// * APITypeRest means this is an RESTful API.
	// * APITypeWebSocket means this is an WebSocket API.
	Type string `json:"type,omitempty"`
}

APISpec is the specification of the API.

type AccessLogRotateSettings

type AccessLogRotateSettings struct {
	// Enabled indicates whether access log rotation is enabled.
	Enabled bool `json:"enabled"`
	// Interval is time in seconds specifying how often to rotate the logs.
	Interval uint64 `json:"interval,omitempty"`
	// MaximumKeptLogEntries is the maximum number of log entries to keep.
	MaximumKeptLogEntries uint64 `json:"maximum_kept_log_entries,omitempty"`
	// EnableCompression indicates whether to compress the log files.
	EnableCompression bool `json:"enable_compression"`
}

AccessLogRotateSettings is the access log rotate settings config

type AccessToken

type AccessToken struct {
	ID     string    `json:"id"`
	Notes  string    `json:"notes"`
	Expire time.Time `json:"expire"`
	// Token field will only be shown when you create an access token.
	Token string `json:"token"`
}

AccessToken is the token used by API7 Cloud to authenticate clients.

type ActiveHealthCheck

type ActiveHealthCheck struct {
	Type  string                    `json:"type"`
	HTTP  *HTTPActiveHealthCheck    `json:"http"`
	HTTPS *HTTPSActiveHealthCheck   `json:"https"`
	TCP   *TCPActiveCheckPredicates `json:"tcp"`
}

ActiveHealthCheck the data of active health check

type Application

type Application struct {
	ApplicationSpec `json:",inline"`

	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// ClusterID is id of cluster that current app belong with
	ClusterID ID `json:"cluster_id"`
	// Status is status of app
	Status EntityStatus `json:"status"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
	// AvailableCertIDs records the available cert ids for this app.
	AvailableCertIDs []ID `json:"available_cert_ids" gorm:"-"`
	// CanaryReleaseID is the canary release id that in progress
	CanaryReleaseID []ID `json:"canary_release_id" gorm:"-"`
	// CanaryUpstreamVersionList is the canary upstream version list that in progress or paused
	CanaryUpstreamVersionList []string `json:"canary_upstream_version_list" gorm:"-"`
}

Application is the definition of API7 Cloud Application, which also contains some management fields.

type ApplicationInterface

type ApplicationInterface interface {
	// CreateApplication creates an API7 Cloud Application in the specified cluster.
	// The given `app` parameter should specify the desired Application specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned Application will contain the same Application specification plus some
	// management fields and default values.
	CreateApplication(ctx context.Context, app *Application, opts *ResourceCreateOptions) (*Application, error)
	// UpdateApplication updates an existing API7 Cloud Application in the specified cluster.
	// The given `app` parameter should specify the desired Application specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned Application will contain the same Application specification plus some
	// management fields and default values.
	UpdateApplication(ctx context.Context, app *Application, opts *ResourceUpdateOptions) (*Application, error)
	// DeleteApplication deletes an existing API7 Cloud Application in the specified cluster.
	// The given `appID` parameter should specify the Application that you want to delete.
	// Users need to specify the Cluster in the `opts`.
	DeleteApplication(ctx context.Context, appID ID, opts *ResourceDeleteOptions) error
	// GetApplication gets an existing API7 Cloud Application in the specified cluster.
	// The given `appID` parameter should specify the Application that you want to get.
	// Users need to specify the Cluster in the `opts`.
	GetApplication(ctx context.Context, appID ID, opts *ResourceGetOptions) (*Application, error)
	// PublishApplication publishes the Application in the specified cluster (which is
	// a shortcut of UpdateApplication and set ApplicationSpec.Active to ActiveStatus).
	// The given `appID` parameter should specify the Application that you want to operate.
	// Users need to specify the Cluster in the `opts`.
	// The updated Application will be returned and the ApplicationSpec.Active field should be ActiveStatus.
	PublishApplication(ctx context.Context, appID ID, opts *ResourceUpdateOptions) (*Application, error)
	// UnpublishApplication publishes the Application in the specified cluster (which is
	// a shortcut of UpdateApplication and set ApplicationSpec.Active to InactiveStatus).
	// The given `appID` parameter should specify the Application that you want to operate.
	// Users need to specify the Cluster in the `opts`.
	// The updated Application will be returned and the ApplicationSpec.Active field should be InactiveStatus.
	UnpublishApplication(ctx context.Context, appID ID, opts *ResourceUpdateOptions) (*Application, error)
	// ListApplications returns an iterator for listing Applications in the specified cluster with the
	// given list conditions.
	// Users need to specify the Cluster, Paging and Filter conditions (if necessary)
	// in the `opts`.
	ListApplications(ctx context.Context, opts *ResourceListOptions) (ApplicationListIterator, error)
	// DebugApplicationResources returns the corresponding translated APISIX resources for this Application.
	// The given `appID` parameter should specify the Application that you want to operate.
	// Users need to specify the Cluster.ID in the `opts`.
	DebugApplicationResources(ctx context.Context, appID ID, opts *ResourceGetOptions) (string, error)
}

ApplicationInterface is the interface for manipulating Applications.

type ApplicationListIterator

type ApplicationListIterator interface {
	// Next returns the next Application according to the filter conditions.
	Next() (*Application, error)
}

ApplicationListIterator is an iterator for listing Applications.

type ApplicationSpec

type ApplicationSpec struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// Labels are used for resource classification and indexing
	Labels []string `json:"labels,omitempty"`
	// Protocols contains all the support protocols that this Application exposes.
	Protocols []string `json:"protocols,omitempty"`
	// The listening path prefix for this application
	PathPrefix string `json:"path_prefix"`
	// Hosts contains all the hosts that this Application uses.
	Hosts []string `json:"hosts"`
	// Plugins settings on Application level.
	Plugins Plugins `json:"plugins,omitempty"`
	// Upstream settings for the Application
	Upstreams []UpstreamAndVersion `json:"upstreams"`
	// DefaultUpstreamVersion settings for the upstream that should be used
	DefaultUpstreamVersion string `json:"default_upstream_version,omitempty"`
	// Active is status of application
	// Optional values can be:
	// * ActiveStatus: the object is active.
	// * InactiveStatus: the object is inactive.
	Active int `json:"active"`
}

ApplicationSpec is the specification of the Application.

type AuthInterface

type AuthInterface interface {
	// CreateAccessToken creates a new access token. It returns a new AccessToken object which
	// fills the Token field.
	CreateAccessToken(ctx context.Context, token *AccessToken) (*AccessToken, error)
	// DeleteAccessToken deletes an access token.
	DeleteAccessToken(ctx context.Context, token *AccessToken) error
}

AuthInterface is the interface for the authentication process with API7 Cloud.

type CanaryRelease

type CanaryRelease struct {
	CanaryReleaseSpec `json:",inline"`
	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// AppID is id of current application
	AppID ID `json:"app_id"`
	// Status is status of canary release
	Status EntityStatus `json:"status"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
}

CanaryRelease is the definition of API7 Cloud CanaryRelease.

type CanaryReleaseInterface

type CanaryReleaseInterface interface {
	// CreateCanaryRelease creates an API7 Cloud Canary Release in the specified Application.
	// The given `cr` parameter should specify the desired Canary Release specification.
	// Users need to specify the Application in the `opts`.
	// The returned CanaryRelease will contain the same CanaryRelease specification plus some
	// management fields and default values
	CreateCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceCreateOptions) (*CanaryRelease, error)
	// UpdateCanaryRelease updates an existing API7 Cloud Canary Release in the specified Application.
	// The given `cr` parameter should specify the desired Canary Release specification.
	// Users need to specify the Application in the `opts`.
	// The returned CanaryRelease will contain the same CanaryRelease specification plus some
	// management fields and default values.
	UpdateCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)
	// StartCanaryRelease makes the Canary Release in progress in the specified Application
	// (a shortcut of UpdateCanaryRelease and set CanaryReleaseSpec.State to CanaryReleaseStateInProgress).
	// The given `crID` parameter should specify the desired Canary Release ID.
	// Users need to specify the Application in the `opts`.
	// The updated Canary Release will be returned and the CanaryReleaseSpec.State field should be
	// CanaryReleaseStateInProgress.
	StartCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)
	// PauseCanaryRelease makes the Canary Release paused in the specified Application
	// (a shortcut of UpdateCanaryRelease and set CanaryReleaseSpec.State to CanaryReleaseStatePaused).
	// The given `crID` parameter should specify the desired Canary Release ID.
	// Users need to specify the Application in the `opts`.
	// The updated Canary Release will be returned and the CanaryReleaseSpec.State field should be
	// CanaryReleaseStatePaused.
	PauseCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)
	// FinishCanaryRelease makes the Canary Release finished in the specified Application
	// (a shortcut of UpdateCanaryRelease and set CanaryReleaseSpec.State to CanaryReleaseStateFinished).
	// The given `crID` parameter should specify the desired Canary Release ID.
	// Users need to specify the Application in the `opts`.
	// The updated Canary Release will be returned and the CanaryReleaseSpec.State field should be
	// CanaryReleaseStateFinished.
	FinishCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)
	// DeleteCanaryRelease deletes an existing API7 Cloud Canary Release in the specified Application.
	// The Given `crID` parameter should specify the Canary Release that you want to delete.
	// Users need to specify the Application in the `opts`.
	DeleteCanaryRelease(ctx context.Context, crID ID, opts *ResourceDeleteOptions) error
	// GetCanaryRelease gets an existing API7 Cloud Canary Release in the specified Application.
	// The given `crID` parameter should specify the CanaryRelease that you want to get.
	// Users need to specify the Application in the `opts`.
	GetCanaryRelease(ctx context.Context, crID ID, opts *ResourceGetOptions) (*CanaryRelease, error)
	// ListCanaryReleases returns an iterator for listing CanaryReleases in the specified Application with the
	// given list conditions.
	// Users need to specify the Application, Paging and Filter conditions (if necessary)
	// in the `opts`.
	ListCanaryReleases(ctx context.Context, opts *ResourceListOptions) (CanaryReleaseListIterator, error)
}

CanaryReleaseInterface is the interface for manu

type CanaryReleaseListIterator

type CanaryReleaseListIterator interface {
	// Next returns the next CanaryRelease according ro the dilter conditions.
	Next() (*CanaryRelease, error)
}

CanaryReleaseListIterator is an iterator for listening CanaryReleases.

type CanaryReleaseRule

type CanaryReleaseRule struct {
	// Position means where we should get the key.Can be "header", "query" etc.
	Position string `json:"position"`
	// Key means the name of the key
	Key string `json:"key"`
	// Operator means the operator that used between key and value
	Operator string `json:"operator"`
	// Value means the values that used in the expression.
	Value interface{} `json:"value,omitempty"`
}

CanaryReleaseRule is the rule that used in canary release

type CanaryReleaseSpec

type CanaryReleaseSpec struct {
	// Name specify the name of canary release
	Name string `json:"name"`
	// State specify the state of the canary release.
	// Optional values can be:
	// * CanaryReleaseStatePause:  the object state is pause.
	// * CanaryReleaseStateInProgress:  the object state is in_progress.
	// * CanaryReleaseStateInFinish:  the object state is finish.
	State string `json:"state"`
	// Type specify the type of canary release.Can be "percent", "rules"
	Type string `json:"type"`
	// CanaryUpstreamVersion specify the version of canary release
	CanaryUpstreamVersion string `json:"canary_upstream_version"`
	// Percent specifies the percent of request will be transferred to canary upstream. Can be 0-100
	Percent int `json:"percent,omitempty"`
	// CanaryReleaseRule specify the matched rules of request that should be transferred to canary upstream
	CanaryReleaseRule []CanaryReleaseRule `json:"rules,omitempty"`
}

CanaryReleaseSpec is the specification of the CanaryRelease

type Certificate

type Certificate struct {
	CertificateSpec `json:",inline"`

	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// ClusterID is id of cluster that current certificate belong with
	ClusterID ID `json:"cluster_id"`
	// Status is status of certificate
	Status EntityStatus `json:"status"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
}

Certificate is the definition of API7 Cloud Certificate, which also contains some management fields.

type CertificateDetails

type CertificateDetails struct {
	// Extensions is extensions of certificate
	Extensions map[string]string `json:"extensions,omitempty"`
	// Issuer is issuer of certificate
	Issuer string `json:"issuer"`
	// NotBefore is valid after this time
	NotBefore time.Time `json:"not_before"`
	// NotAfter is invalid after this time
	NotAfter time.Time `json:"not_after"`
	// SNIs is service name indicates of certificate
	SNIs []string `json:"snis"`
	// SerialNumber is serial number of certificate
	SerialNumber string `json:"serial_number"`
	// Subject is subject of certificate, contains fields like country, organization, common name...
	Subject string `json:"subject"`
	// SignatureAlgorithm is signature algorithm of certificate
	SignatureAlgorithm string `json:"signature_algorithm"`
	// ClusterID is id of cluster that current certificate belong with
	ClusterID ID `json:"cluster_id"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// CACertificate is CA certificate to verify client certificate
	CACertificate *CertificateMetadata `json:"ca_certificate,omitempty"`
	// Status is status of certificate
	Status EntityStatus `json:"status"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
	// Labels are used for resource classification and indexing
	Labels []string `json:"labels,omitempty"`
	// Type is certificate type
	Type string `json:"type"`
}

CertificateDetails contains the details of the user uploaded certificate.

type CertificateInterface

type CertificateInterface interface {
	// CreateCertificate creates an API7 Cloud Certificate in the specified cluster.
	// The given `cert` parameter should specify the desired Certificate specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned Certificate will contain the same Certificate specification plus some
	// management fields and default values, the `PrivateKey` field will be empty.
	CreateCertificate(ctx context.Context, cert *Certificate, opts *ResourceCreateOptions) (*CertificateDetails, error)
	// UpdateCertificate updates an existing API7 Cloud Certificate in the specified cluster.
	// The given `cert` parameter should specify the desired Certificate specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned Certificate will contain the same Certificate specification plus some
	// management fields and default values, the `PrivateKey` field will be empty.
	UpdateCertificate(ctx context.Context, cert *Certificate, opts *ResourceUpdateOptions) (*CertificateDetails, error)
	// DeleteCertificate deletes an existing API7 Cloud Certificate in the specified cluster.
	// The given `certID` parameter should specify the Certificate that you want to delete.
	// Users need to specify the Cluster in the `opts`.
	DeleteCertificate(ctx context.Context, certID ID, opts *ResourceDeleteOptions) error
	// GetCertificate gets an existing API7 Cloud Certificate in the specified cluster.
	// The given `certID` parameter should specify the Certificate that you want to get.
	// Users need to specify the Cluster in the `opts`.
	// The `PrivateKey` field will be empty in the returned Certificate.
	GetCertificate(ctx context.Context, certID ID, opts *ResourceGetOptions) (*CertificateDetails, error)
	// ListCertificates returns an iterator for listing Certificates in the specified cluster with the
	// given list conditions.
	// Users need to specify the Cluster, Paging and Filter conditions (if necessary)
	// in the `opts`.
	// The `PrivateKey` field will be empty in the returned Certificate.
	ListCertificates(ctx context.Context, opts *ResourceListOptions) (CertificateListIterator, error)
	// DebugCertificateResources returns the corresponding translated APISIX resources for this Certificate.
	// The given `certID` parameter should specify the Certificate that you want to operate.
	// Users need to specify the Cluster.ID in the `opts`.
	// Note, the private key won't be returned due to the security concerns.
	DebugCertificateResources(ctx context.Context, appID ID, opts *ResourceGetOptions) (string, error)
}

CertificateInterface is the interface for manipulating Certificates.

type CertificateListIterator

type CertificateListIterator interface {
	// Next returns the next Certificate according to the filter conditions.
	Next() (*CertificateDetails, error)
}

CertificateListIterator is an iterator for listing Certificates.

type CertificateMetadata

type CertificateMetadata struct {
	// SNIs is service name indicates of certificate
	SNIs []string `json:"snis"`
	// NotBefore is valid after this time
	NotBefore time.Time `json:"not_before"`
	// NotAfter is invalid after this time
	NotAfter time.Time `json:"not_after"`
	// Subject is subject of certificate, contains fields like country, organization, common name...
	Subject string `json:"subject"`
	// Issuer is issuer of certificate
	Issuer string `json:"issuer"`
	// SerialNumber is serial number of certificate
	SerialNumber string `json:"serial_number"`
	// SignatureAlgorithm is signature algorithm of certificate
	SignatureAlgorithm string `json:"signature_algorithm"`
	// Extensions is extensions of certificate
	Extensions map[string]string `json:"extensions,omitempty"`
}

CertificateMetadata contains the metadata of an user uploaded certificate.

type CertificateSpec

type CertificateSpec struct {
	// The certificate in PEM format.
	Certificate string `json:"certificate"`
	// Private key is the private key for the corresponding certificate in PEM format.
	PrivateKey string `json:"private_key"`
	// CACertificate is the client ca certificate in PEM format used to verify client certificate.
	CACertificate string `json:"ca_certificate,omitempty"`
	// Labels are used for resource classification and indexing.
	Labels []string `json:"labels,omitempty"`
	// Type is the certificate type, optional values can be:
	//   * ServerCertificate, server-type certificate.
	//   * ClientCertificate, client-type certificate.
	Type CertificateType `json:"type,omitempty"`
}

CertificateSpec is the specification of the Certificate

type CertificateType

type CertificateType string

CertificateType is the type of log collection

const (
	// ServerCertificate means server-type certificate
	ServerCertificate CertificateType = "Server"
	// ClientCertificate means client-type certificate
	ClientCertificate CertificateType = "Client"
)

type Checks

type Checks struct {
	Active  *ActiveHealthCheck  `json:"active,omitempty"`
	Passive *PassiveHealthCheck `json:"passive,omitempty"`
}

Checks the data of health check

type ClientIPReplaceFrom

type ClientIPReplaceFrom struct {
	// Position is the position that the client ip should be got from
	// Optional values are:
	// * RealIPPositionHeader, indicates the real ip is in an HTTP header, and the header name is specified by `Name` field.
	// * RealIPPositionQuery, indicates the real ip is in the query string, and the query name is specified by `Name` field.
	// * RealIPPositionCookie, indicates the real ip is in the Cookie, and the field name is specified by `Name` field.
	Position string `json:"position,omitempty"`
	// Name is the name of the variable that the client ip should be got from
	Name string `json:"name,omitempty"`
}

ClientIPReplaceFrom is the client ip replace from config

type ClientRealIPConfig

type ClientRealIPConfig struct {
	// ReplaceFrom is the client ip replace from config
	ReplaceFrom ClientIPReplaceFrom `json:"replace_from"`
	// TrustedAddresses is the client ip trusted addresses
	TrustedAddresses []string `json:"trusted_addresses,omitempty"`
	// RecursiveSearch indicates whether the client ip is searched recursively
	RecursiveSearch bool `json:"recursive_search"`
	// Enable indicates whether real ip is enabled
	Enabled bool `json:"enabled"`
}

ClientRealIPConfig is the client real ip config

type ClientSettings

type ClientSettings struct {
	// ClientRealIP is the client real ip config that used in apisix
	ClientRealIP ClientRealIPConfig `json:"client_real_ip"`
	// MaximumRequestBodySize is the maximum request body size that used in apisix, 0 means no limit
	MaximumRequestBodySize uint64 `json:"maximum_request_body_size"`
}

ClientSettings is the client settings config

type Cluster

type Cluster struct {
	ClusterSpec

	// ID is the unique identify of this cluster.
	ID ID `json:"id,inline"`
	// Name is the cluster name.
	Name string `json:"name"`
	// CreatedAt is the creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time.
	UpdatedAt time.Time `json:"updated_at"`
}

Cluster contains the cluster specification and management fields.

type ClusterInterface

type ClusterInterface interface {
	// GetCluster gets an existing API7 Cloud Cluster.
	// The given `clusterID` parameter should specify the Cluster that you want to get.
	// Users need to specify the Organization.ID in the `opts`.
	GetCluster(ctx context.Context, clusterID ID, opts *ResourceGetOptions) (*Cluster, error)
	// UpdateClusterSettings updates the ClusterSettings for the specified Cluster.
	// The given `clusterID` parameter should specify the Cluster that you want to update.
	// The given `settings` parameter should specify the new settings you want to apply.
	// Users need to specify the Organization.ID in the `opts`.
	UpdateClusterSettings(ctx context.Context, clusterID ID, settings *ClusterSettings, opts *ResourceUpdateOptions) error
	// UpdateClusterPlugins updates the plugins bound on the specified Cluster.
	// The given `clusterID` parameter should specify the Cluster that you want to update.
	// The given `plugins` parameter should specify the new plugins you want to bind.
	// Users need to specify the Organization.ID in the `opts`.
	UpdateClusterPlugins(ctx context.Context, clusterID ID, plugins Plugins, opts *ResourceUpdateOptions) error
	// ListClusters returns an iterator for listing clusters in the specified Organization with the
	// given list conditions.
	// Users need to specify the Organization, Paging, and Filter conditions (if necessary)
	// in the `opts`.
	ListClusters(ctx context.Context, opts *ResourceListOptions) (ClusterListIterator, error)
	// GenerateGatewaySideCertificate generates the tls bundle for gateway instances to communicate with
	// the specified cluster on API7 Cloud.
	// The `clusterID` parameter specifies the cluster ID.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	GenerateGatewaySideCertificate(ctx context.Context, clusterID ID, opts *ResourceCreateOptions) (*TLSBundle, error)
	// GetGatewayInstanceStartupConfigTemplate returns the startup configuration template (Apache APISIX config.yaml)
	// for starting a gateway instance.
	// The configType specifies the configuration type for this call. Optional values can be:
	// * apisix: indicates the original APISIX config.yaml
	// * helm: indicates the APISIX helm chart values.yaml
	GetGatewayInstanceStartupConfigTemplate(ctx context.Context, clusterID ID, configType string, opts *ResourceGetOptions) (string, error)
	// ListAllGatewayInstances returns all the gateway instances (ever) connected to the given cluster.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	ListAllGatewayInstances(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]GatewayInstance, error)
	// ListAllAPILabels lists all labels for API.
	// The `clusterID` parameter specifies the cluster ID.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	// The returned label slice will be `nil` if there is no any labels for API.
	ListAllAPILabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)
	// ListAllApplicationLabels lists all labels for Application.
	// The `clusterID` parameter specifies the cluster ID.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	// The returned label slice will be `nil` if there is no any labels for Application.
	ListAllApplicationLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)
	// ListAllCertificateLabels lists all labels for Certificate.
	// The `clusterID` parameter specifies the cluster ID.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	// The returned label slice will be `nil` if there is no any labels for Certificate.
	ListAllCertificateLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)
	// ListAllConsumerLabels lists all labels for Consumer.
	// The `clusterID` parameter specifies the cluster ID.
	// Note currently users don't need to pass the `opts` parameter. Just pass `nil` is OK.
	// The returned label slice will be `nil` if there is no any labels for Consumer.
	ListAllConsumerLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)
	// DebugClusterSettings returns the corresponding translated APISIX global rules for this Cluster.
	DebugClusterSettings(ctx context.Context, opts *ResourceGetOptions) (string, error)
}

ClusterInterface is the interface for manipulating cluster.

type ClusterListIterator

type ClusterListIterator interface {
	// Next returns the next cluster according to the filter conditions.
	Next() (*Cluster, error)
}

ClusterListIterator is an iterator for listing clusters.

type ClusterSettings

type ClusterSettings struct {
	// ClientSettings is the client settings config that used in apisix
	ClientSettings ClientSettings `json:"client_settings"`
	// ObservabilitySettings is the observability settings config that used in apisix
	ObservabilitySettings ObservabilitySettings `json:"observability_settings"`
	// APIProxySettings is the api proxy settings config that used in apisix
	APIProxySettings APIProxySettings `json:"api_proxy_settings"`
}

ClusterSettings is cluster settings

type ClusterSpec

type ClusterSpec struct {
	// OrganizationID refers to an Organization object, which
	// indicates the belonged organization for this cluster.
	OrganizationID ID `json:"org_id"`
	// RegionID refers to a Region object, which indicates the
	// region that the Cloud Plane resides.
	RegionID ID `json:"region_id"`
	// Status indicates the cluster status, candidate values are:
	// * ClusterBuildInProgress: the cluster is being created.
	// * ClusterCreating means a cluster is being created.
	// * ClusterNormal: the cluster is built, and can be used normally.
	// * ClusterCreateFailed means a cluster was not created successfully.
	// * ClusterDeleting means a cluster is being deleted.
	// * ClusterDeleted means a cluster was deleted.
	Status ClusterStage `json:"status"`
	// Domain is the domain assigned by API7 Cloud and has correct
	// records so that gateway instances can access API7 Cloud by it.
	Domain string `json:"domain"`
	// ConfigPayload is the customized gateway config for specific cluster
	ConfigPayload string `json:"-"`
	// Settings is the settings for the cluster.
	Settings ClusterSettings `json:"settings"`
	// Plugins settings on cluster level
	Plugins Plugins `json:"policies,omitempty"`
	// ConfigVersion is the version for the cluster.
	ConfigVersion int `json:"config_version"`
}

ClusterSpec is the specification of cluster.

type ClusterStage

type ClusterStage int

ClusterStage is used to depict different cluster lifecycles.

func (ClusterStage) String

func (cs ClusterStage) String() string

type Consumer

type Consumer struct {
	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// Name of the consumer, should be unique among all applications in the same cluster.
	Name string `json:"name" gorm:"column:name"`
	// Description for this consumer.
	Description string                 `json:"description"` // Certificates are used to authenticate the consumer.
	Credentials map[string]interface{} `json:"credentials,omitempty"`
	// Plugins settings on Consumer level
	Plugins Plugins `json:"plugins,omitempty"`
	// Labels are used for resource classification and indexing
	Labels []string `json:"labels,omitempty"`
}

Consumer is an abstraction of Application/API caller.

type ConsumerInterface

type ConsumerInterface interface {
	// CreateConsumer creates an API7 Cloud Consumer in the specified cluster.
	// The given `consumer` parameter should specify the desired Consumer specification.
	// Users need to specify the cluster in the `opts`.
	// The returned Consumer will contain the same Consumer specification plus some
	// management fields and default values.
	CreateConsumer(ctx context.Context, consumer *Consumer, opts *ResourceCreateOptions) (*Consumer, error)
	// UpdateConsumer updates an existing API7 Cloud Consumer in the specified cluster.
	// The given `consumer` parameter should specify the desired Consumer specification.
	// Users need to specify the cluster in the `opts`.
	// The returned Consumer will contain the same Consumer specification plus some
	// management fields and default values.
	UpdateConsumer(ctx context.Context, consumer *Consumer, opts *ResourceUpdateOptions) (*Consumer, error)
	// DeleteConsumer deletes an existing API7 Cloud Consumer in the specified cluster.
	// The given `consumerID` parameter should specify the Consumer that you want to delete.
	// Users need to specify the cluster in the `opts`.
	DeleteConsumer(ctx context.Context, consumerID ID, opts *ResourceDeleteOptions) error
	// GetConsumer gets an existing API7 Cloud Consumer in the specified cluster.
	// The given `consumerID` parameter should specify the Consumer that you want to get.
	// Users need to specify the cluster in the `opts`.
	GetConsumer(ctx context.Context, consumerID ID, opts *ResourceGetOptions) (*Consumer, error)
	// ListConsumers returns an iterator for listing Consumers in the specified cluster with the
	// given list conditions.
	// Users need to specify the cluster, Paging and Filter conditions (if necessary)
	// in the `opts`.
	ListConsumers(ctx context.Context, opts *ResourceListOptions) (ConsumerListIterator, error)
	// DebugConsumerResources returns the corresponding translated APISIX resources for this Consumer.
	// The given `consumerID` parameter should specify the Consumer that you want to operate.
	// Users need to specify the cluster.ID in the `opts`.
	DebugConsumerResources(ctx context.Context, consumerID ID, opts *ResourceGetOptions) (string, error)
}

ConsumerInterface is the interface for manipulating Consumers.

type ConsumerListIterator

type ConsumerListIterator interface {
	// Next returns the next Consumer according to the filter conditions.
	Next() (*Consumer, error)
}

ConsumerListIterator is an iterator for listing Consumers.

type EntityStatus

type EntityStatus int

EntityStatus is common status definition for any kind of entity: * Uninitialized represents the entity has been saved to the db, but the associated resource has not yet been ready. * Normal indicates that the entity and associated resources are ready. * Deleted indicates the entity has been deleted.

type Expression

type Expression struct {
	// Subject is the subject category of the expression.
	Subject ExpressionSubject `json:"subject,omitempty"`
	// Name is the subject name of the expression.
	Name string `json:"name,omitempty"`
	// Operator is the operator of the expression.
	Operator ExpressionOperator `json:"operator,omitempty"`
	// Value is the value that the expression should be matched.
	Value string `json:"value,omitempty"`
}

Expression is the route match expressions.

type ExpressionLogicalRelationship

type ExpressionLogicalRelationship string

ExpressionLogicalRelationship is the logical relationship between expressions.

const (
	// MatchAll meaning all the expressions should be matched.
	MatchAll ExpressionLogicalRelationship = "All"
	// MatchAny meaning any of the expressions should be matched.
	MatchAny ExpressionLogicalRelationship = "Any"
)

type ExpressionOperator

type ExpressionOperator string

ExpressionOperator is the operator of the expression.

const (
	// EqualOperator indicates the expression operator is "equal"
	EqualOperator ExpressionOperator = "equal"
	// NotEqualOperator indicates the expression operator is "not_equal"
	NotEqualOperator ExpressionOperator = "not_equal"
	// RegexMatchOperator indicates the expression operator is "regex_match"
	RegexMatchOperator ExpressionOperator = "regex_match"
	// RegexNotMatchOperator indicates the expression operator is "regex_not_match"
	RegexNotMatchOperator ExpressionOperator = "regex_not_match"
	// PresentOperator indicates the expression operator is "present"
	PresentOperator ExpressionOperator = "present"
	// NotPresentOperator indicates the expression operator is "not_present"
	NotPresentOperator ExpressionOperator = "not_present"
	// LargerEqualOperator indicates the expression operator is "larger_equal"
	LargerEqualOperator ExpressionOperator = "larger_equal"
	// LargerThanOperator indicates the expression operator is "larger_than"
	LargerThanOperator ExpressionOperator = "larger_than"
	// LessEqualOperator indicates the expression operator is "less_equal"
	LessEqualOperator ExpressionOperator = "less_equal"
	// LessThanOperator indicates the expression operator is "less_than"
	LessThanOperator ExpressionOperator = "less_than"
)

type ExpressionSubject

type ExpressionSubject string

ExpressionSubject is the subject category of the expression.

const (
	// HeaderSubject indicates the expression subject is from a HTTP request header.
	HeaderSubject ExpressionSubject = "header"
	// QuerySubject indicates the expression subject is from the HTTP query string.
	QuerySubject ExpressionSubject = "query"
	// CookieSubject indicates the expression subject is from Cookie header.
	CookieSubject ExpressionSubject = "cookie"
	// PathSubject indicates the expression subject is from the URI path.
	PathSubject ExpressionSubject = "path"
	// VariableSubject indicates the expression subject is a Nginx or APISIX variable.
	VariableSubject ExpressionSubject = "variable"
)

type Filter

type Filter struct {
	// Search indicates the search condition for filtering out list results.
	Search string
}

Filter indicates conditions to filter out list results.

type FineGrainedRouteControl

type FineGrainedRouteControl struct {
	// Enabled indicates whether to enable fine-grained route control.
	Enabled bool `json:"enabled,omitempty"`
	// LogicalRelationship indicates the logical relationship between expressions.
	LogicalRelationship ExpressionLogicalRelationship `json:"logical_relationship,omitempty"`
	// Expressions is a list of expressions.
	Expressions []Expression `json:"expressions,omitempty"`
}

FineGrainedRouteControl is fine grained route control settings.

type GatewayInstance

type GatewayInstance struct {
	GatewayInstancePayload `json:",inline"`
	// LastSeenTime is the last time that Cloud seen this instance.
	// An instance should be marked as offline once the elapsed time is over
	// 30s since the last seen time.
	LastSeenTime time.Time `json:"last_seen_time"`
	// RegisterTime is the first time that Cloud seen this instance.
	RegisterTime time.Time `json:"register_time"`
	// Status is the instance status.
	Status GatewayInstanceStatus `json:"status"`
}

GatewayInstance shows the gateway instance (Apache APISIX) status.

type GatewayInstancePayload

type GatewayInstancePayload struct {
	// ID is the unique identity for the gateway instance.
	ID string `json:"id"`
	// Hostname is the name for the VM or container that the gateway
	// instance resides.
	Hostname string `json:"hostname"`
	// IP is the IP address of the VM or container that the gateway
	// instance resides.
	IP string `json:"ip"`
	// Domain is the domain assigned by API7 Cloud for the owner
	// (organization) of the gateway instance.
	Domain string `json:"domain"`
	// APICalls is the number of HTTP requests counted in the reporting period
	APICalls uint64 `json:"api_calls"`
	// Version is the version of the  gateway
	Version string `json:"version"`
	// EtcdReachable indicates whether the instance can reach the etcd.
	EtcdReachable bool `json:"etcd_reachable"`
	// ConfigVersion is the version of the config currently in use on the  gateway
	ConfigVersion uint64 `json:"config_version"`
}

GatewayInstancePayload contains basic information for a gateway instance.

type GatewayInstanceStatus

type GatewayInstanceStatus string

GatewayInstanceStatus is the status of an gateway instance.

type HTTPActiveHealthCheck

type HTTPActiveHealthCheck struct {
	ProbeTimeout     int64                   `json:"probe_timeout,omitempty"`
	ConcurrentProbes int64                   `json:"concurrent_probes,omitempty"`
	HTTPProbePath    string                  `json:"http_probe_path,omitempty"`
	HTTPProbeHost    string                  `json:"http_probe_host,omitempty"`
	ProbeTargetPort  int64                   `json:"probe_target_port,omitempty"`
	HTTPProbeHeaders ProbeHeader             `json:"http_probe_headers,omitempty"`
	Healthy          HTTPHealthyPredicates   `json:"healthy,omitempty"`
	UnHealthy        HTTPUnhealthyPredicates `json:"unhealthy,omitempty"`
}

HTTPActiveHealthCheck is the configuration of HTTP active health check

type HTTPHealthyPredicates

type HTTPHealthyPredicates struct {
	TargetsCheckInterval int64 `json:"targets_check_interval,omitempty"`
	HTTPStatusCodes      []int `json:"http_status_codes,omitempty"`
	Successes            int64 `json:"successes,omitempty"`
}

HTTPHealthyPredicates healthy predicates.

type HTTPHealthyPredicatesForPassive

type HTTPHealthyPredicatesForPassive struct {
	HTTPStatusCodes []int `json:"http_status_codes,omitempty"`
}

HTTPHealthyPredicatesForPassive healthy predicates for passive health check.

type HTTPPassiveHealthCheck

type HTTPPassiveHealthCheck struct {
	Healthy   HTTPHealthyPredicatesForPassive   `json:"healthy,omitempty"`
	UnHealthy HTTPUnhealthyPredicatesForPassive `json:"unhealthy,omitempty"`
}

HTTPPassiveHealthCheck is the configuration of HTTP passive health check

type HTTPSActiveHealthCheck

type HTTPSActiveHealthCheck struct {
	HTTPActiveHealthCheck

	VerifyTargetTlsCertificate bool `json:"verify_target_tls_certificate"`
}

HTTPSActiveHealthCheck the data of active health check for https

type HTTPUnhealthyPredicates

type HTTPUnhealthyPredicates struct {
	TargetsCheckInterval int64 `json:"targets_check_interval,omitempty"`
	HTTPStatusCodes      []int `json:"http_status_codes,omitempty"`
	HTTPFailures         int64 `json:"http_failures,omitempty"`
	Timeouts             int64 `json:"timeouts,omitempty"`
}

HTTPUnhealthyPredicates unhealthy predicates.

type HTTPUnhealthyPredicatesForPassive

type HTTPUnhealthyPredicatesForPassive struct {
	HTTPStatusCodes []int `json:"http_status_codes,omitempty"`
	HTTPFailures    int64 `json:"http_failures,omitempty"`
	Timeouts        int64 `json:"timeouts,omitempty"`
}

HTTPUnhealthyPredicatesForPassive unhealthy predicates for passive health check.

type ID

type ID uint64

ID is the type of the id field used for any entities

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

MarshalJSON is the way to encode ID to JSON string.

func (ID) String

func (id ID) String() string

String indicates how to convert ID to a string.

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

UnmarshalJSON is the way to decode ID from JSON string.

type IDGenerator

type IDGenerator interface {
	// NextID generates an ID.
	NextID() ID
}

IDGenerator is an interface for generating IDs.

func NewIDGenerator

func NewIDGenerator() (IDGenerator, error)

NewIDGenerator returns an IDGenerator object.

type Interface

Interface is the entrypoint of the Cloud Go SDK.

func NewInterface

func NewInterface(opts *Options) (Interface, error)

NewInterface creates an Interface object.

type KubernetesAPIServer

type KubernetesAPIServer struct {
	// Scheme is the scheme of http server
	Scheme string `json:"scheme,omitempty"`
	// Host is the host of http server
	Host string `json:"host,omitempty"`
	// Port is the port of http server
	Port int `json:"port,omitempty"`
}

KubernetesAPIServer is configuration for the Kubernetes API server.

type KubernetesEndpointsLabelSelector

type KubernetesEndpointsLabelSelector struct {
	// Key is the key of the label selector
	Key string `json:"key,omitempty"`
	// Operator is the operator of the selector
	Operator string `json:"operator,omitempty"`
	// Value is the value of the label selector
	Value string `json:"value,omitempty"`
}

KubernetesEndpointsLabelSelector is the label selector of kubernetes service discovery

type KubernetesNamespaceSelector

type KubernetesNamespaceSelector struct {
	// Operator is the operator of the selector
	Operator string `json:"operator,omitempty"`
	// Patterns is the patterns of the selector
	Patterns []string `json:"patterns,omitempty"`
}

KubernetesNamespaceSelector is the namespace selector of kubernetes service discovery

type KubernetesServiceRegistry

type KubernetesServiceRegistry struct {
	// APIServer is the kubernetes api server config
	APIServer KubernetesAPIServer `json:"api_server"`
	// ServiceAccountTokenFile is the path of the service account token file
	ServiceAccountTokenFile string `json:"service_account_token_file,omitempty"`
	// ServiceAccountTokenValue is the service account token value
	ServiceAccountTokenValue string `json:"service_account_token_value,omitempty"`
	// NamespaceSelector is the namespace selector of kubernetes service discovery
	NamespaceSelector *KubernetesNamespaceSelector `json:"namespace_selector,omitempty"`
	// EndpointsLabelSelectors is the endpoints label selectors of kubernetes service discovery
	EndpointsLabelSelectors []KubernetesEndpointsLabelSelector `json:"endpoints_label_selectors,omitempty"`
}

KubernetesServiceRegistry is the Kubernetes registry.

type KubernetesUpstreamServiceDiscovery

type KubernetesUpstreamServiceDiscovery struct {
	// Namespace is the namespace of the kubernetes endpoint
	Namespace string `json:"namespace"`
	// Name is the name of the kubernetes endpoint
	Name string `json:"name"`
	// Port is the target port of the kubernetes endpoint
	Port string `json:"port"`
}

KubernetesUpstreamServiceDiscovery is the kubernetes service discovery of the upstream.

type LogCollection

type LogCollection struct {
	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// Name is the name of log collection
	Name string `json:"name"`
	// Description is the description of log collection
	Description string `json:"description"`
	// Type is the type of log collection
	Type LogCollectionType `json:"type"`
	// Spec is the specification of log collection
	Spec interface{} `json:"spec" gorm:"serializer:json"`
}

LogCollection is the abstraction of log storage

type LogCollectionInterface

type LogCollectionInterface interface {
	// CreateLogCollection creates an API7 Cloud Log Collection in the specified cluster.
	// The given `lc` parameter should specify the desired LogCollection specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned LogCollection will contain the same LogCollection specification plus some
	// management fields and default values.
	CreateLogCollection(ctx context.Context, lc *LogCollection, opts *ResourceCreateOptions) (*LogCollection, error)
	// UpdateLogCollection updates an existing API7 Cloud Log Collection in the specified cluster.
	// The given `lc` parameter should specify the desired LogCollection specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned LogCollection will contain the same LogCollection specification plus some
	// management fields and default values.
	UpdateLogCollection(ctx context.Context, lc *LogCollection, opts *ResourceUpdateOptions) (*LogCollection, error)
	// DeleteLogCollection deletes an existing API7 Cloud Log Collection in the specified cluster.
	// The given `lcID` parameter should specify the LogCollection that you want to delete.
	// Users need to specify the Cluster in the `opts`.
	DeleteLogCollection(ctx context.Context, lcID ID, opts *ResourceDeleteOptions) error
	// GetLogCollection gets an existing API7 Cloud Log Collection in the specified cluster.
	// The given `lcID` parameter should specify the LogCollection that you want to get.
	// Users need to specify the Cluster in the `opts`.
	GetLogCollection(ctx context.Context, lcID ID, opts *ResourceGetOptions) (*LogCollection, error)
	// ListLogCollections returns an iterator for listing Log Collections in the specified cluster with the
	// given list conditions.
	// Users need to specify the Cluster, Paging, Filter conditions (if necessary)
	// in the `opts`.
	ListLogCollections(ctx context.Context, opts *ResourceListOptions) (LogCollectionIterator, error)
}

LogCollectionInterface is the interface of the LogCollection

type LogCollectionIterator

type LogCollectionIterator interface {
	// Next returns the next Log Collection according to the filter conditions.
	Next() (*LogCollection, error)
}

LogCollectionIterator is an iterator for listing Log Collections.

type LogCollectionType

type LogCollectionType string

LogCollectionType is the type of log collection

var (
	// HTTPLogCollection means http log collection
	HTTPLogCollection LogCollectionType = "http-logger"
	// KakfaLogCollection means kafka log collection
	KakfaLogCollection LogCollectionType = "kafka-logger"
)

type Member

type Member struct {
	MemberSpec `json:"-"`

	// ID is the unique identify to mark an object.
	ID ID `json:"id,omitempty,inline" yaml:"id"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at,omitempty" yaml:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at,omitempty" yaml:"updated_at"`
	// OrgId indicates the organization where the member is in.
	OrgId ID `json:"org_id,omitempty,inline" yaml:"org_id"`
	// Status is the user data status.
	Status EntityStatus `json:"status,omitempty" yaml:"status"`
}

Member is the member of organization. It contains the member specification and some management fields.

type MemberListIterator

type MemberListIterator interface {
	// Next returns the next Member according to the filter conditions.
	Next() (*Member, error)
}

MemberListIterator is an iterator for listing Members.

type MemberSpec

type MemberSpec struct {
	// FirstName is the member first name
	FirstName string `json:"first_name,omitempty" yaml:"first_name"`
	// LastName is the member last name
	LastName string `json:"last_name,omitempty" yaml:"last_name"`
	// Roles indicates the roles of the member.
	Roles []Role `json:"roles"`
	// Email is the email address of the member.
	Email string `json:"email"`
	// UserId refers to a user, since a 3rd party User Management
	// Service might be used so the type is not uint64.
	UserId string `json:"user_id,omitempty" yaml:"user_id"`
	// State is the user state. Optional values can be:
	// * MemberStatePending
	// * MemberStateActive
	State string `json:"state" yaml:"state"`
}

MemberSpec contains the information

type Methods

type Methods struct {
	// Get is a get method
	Get bool `json:"get,omitempty"`
	// Put	is a put method
	Put bool `json:"put,omitempty"`
	// Post	is a post method
	Post bool `json:"post,omitempty"`
	// Patch is a patch method
	Patch bool `json:"patch,omitempty"`
	// Delete is a delete method
	Delete bool `json:"delete,omitempty"`
}

Methods means the operations that can be performed on an organization.

type MetricsConfig

type MetricsConfig struct {
	// Enable indicates whether gateway instances' metrics should be collected to API7 Cloud.
	Enabled bool `json:"enabled"`
}

MetricsConfig contains configurations related to metrics.

type MockInterface

type MockInterface struct {
	// contains filtered or unexported fields
}

MockInterface is a mock of Interface interface.

func NewMockInterface

func NewMockInterface(ctrl *gomock.Controller) *MockInterface

NewMockInterface creates a new mock instance.

func (*MockInterface) CreateAPI

func (m *MockInterface) CreateAPI(ctx context.Context, api *API, opts *ResourceCreateOptions) (*API, error)

CreateAPI mocks base method.

func (*MockInterface) CreateAccessToken

func (m *MockInterface) CreateAccessToken(ctx context.Context, token *AccessToken) (*AccessToken, error)

CreateAccessToken mocks base method.

func (*MockInterface) CreateApplication

func (m *MockInterface) CreateApplication(ctx context.Context, app *Application, opts *ResourceCreateOptions) (*Application, error)

CreateApplication mocks base method.

func (*MockInterface) CreateCanaryRelease

func (m *MockInterface) CreateCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceCreateOptions) (*CanaryRelease, error)

CreateCanaryRelease mocks base method.

func (*MockInterface) CreateCertificate

func (m *MockInterface) CreateCertificate(ctx context.Context, cert *Certificate, opts *ResourceCreateOptions) (*CertificateDetails, error)

CreateCertificate mocks base method.

func (*MockInterface) CreateConsumer

func (m *MockInterface) CreateConsumer(ctx context.Context, consumer *Consumer, opts *ResourceCreateOptions) (*Consumer, error)

CreateConsumer mocks base method.

func (*MockInterface) CreateLogCollection

func (m *MockInterface) CreateLogCollection(ctx context.Context, lc *LogCollection, opts *ResourceCreateOptions) (*LogCollection, error)

CreateLogCollection mocks base method.

func (*MockInterface) CreateServiceRegistry

func (m *MockInterface) CreateServiceRegistry(ctx context.Context, registry *ServiceRegistry, opts *ResourceCreateOptions) (*ServiceRegistry, error)

CreateServiceRegistry mocks base method.

func (*MockInterface) DebugAPIResources

func (m *MockInterface) DebugAPIResources(ctx context.Context, apiID ID, opts *ResourceGetOptions) (string, error)

DebugAPIResources mocks base method.

func (*MockInterface) DebugApplicationResources

func (m *MockInterface) DebugApplicationResources(ctx context.Context, appID ID, opts *ResourceGetOptions) (string, error)

DebugApplicationResources mocks base method.

func (*MockInterface) DebugCertificateResources

func (m *MockInterface) DebugCertificateResources(ctx context.Context, appID ID, opts *ResourceGetOptions) (string, error)

DebugCertificateResources mocks base method.

func (*MockInterface) DebugClusterSettings

func (m *MockInterface) DebugClusterSettings(ctx context.Context, opts *ResourceGetOptions) (string, error)

DebugClusterSettings mocks base method.

func (*MockInterface) DebugConsumerResources

func (m *MockInterface) DebugConsumerResources(ctx context.Context, consumerID ID, opts *ResourceGetOptions) (string, error)

DebugConsumerResources mocks base method.

func (*MockInterface) DeleteAPI

func (m *MockInterface) DeleteAPI(ctx context.Context, apiID ID, opts *ResourceDeleteOptions) error

DeleteAPI mocks base method.

func (*MockInterface) DeleteAccessToken

func (m *MockInterface) DeleteAccessToken(ctx context.Context, token *AccessToken) error

DeleteAccessToken mocks base method.

func (*MockInterface) DeleteApplication

func (m *MockInterface) DeleteApplication(ctx context.Context, appID ID, opts *ResourceDeleteOptions) error

DeleteApplication mocks base method.

func (*MockInterface) DeleteCanaryRelease

func (m *MockInterface) DeleteCanaryRelease(ctx context.Context, crID ID, opts *ResourceDeleteOptions) error

DeleteCanaryRelease mocks base method.

func (*MockInterface) DeleteCertificate

func (m *MockInterface) DeleteCertificate(ctx context.Context, certID ID, opts *ResourceDeleteOptions) error

DeleteCertificate mocks base method.

func (*MockInterface) DeleteConsumer

func (m *MockInterface) DeleteConsumer(ctx context.Context, consumerID ID, opts *ResourceDeleteOptions) error

DeleteConsumer mocks base method.

func (*MockInterface) DeleteLogCollection

func (m *MockInterface) DeleteLogCollection(ctx context.Context, lcID ID, opts *ResourceDeleteOptions) error

DeleteLogCollection mocks base method.

func (*MockInterface) DeleteServiceRegistry

func (m *MockInterface) DeleteServiceRegistry(ctx context.Context, registryID ID, opts *ResourceDeleteOptions) error

DeleteServiceRegistry mocks base method.

func (*MockInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockInterface) FinishCanaryRelease

func (m *MockInterface) FinishCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)

FinishCanaryRelease mocks base method.

func (*MockInterface) GenerateGatewaySideCertificate

func (m *MockInterface) GenerateGatewaySideCertificate(ctx context.Context, clusterID ID, opts *ResourceCreateOptions) (*TLSBundle, error)

GenerateGatewaySideCertificate mocks base method.

func (*MockInterface) GetAPI

func (m *MockInterface) GetAPI(ctx context.Context, apiID ID, opts *ResourceGetOptions) (*API, error)

GetAPI mocks base method.

func (*MockInterface) GetApplication

func (m *MockInterface) GetApplication(ctx context.Context, appID ID, opts *ResourceGetOptions) (*Application, error)

GetApplication mocks base method.

func (*MockInterface) GetCanaryRelease

func (m *MockInterface) GetCanaryRelease(ctx context.Context, crID ID, opts *ResourceGetOptions) (*CanaryRelease, error)

GetCanaryRelease mocks base method.

func (*MockInterface) GetCertificate

func (m *MockInterface) GetCertificate(ctx context.Context, certID ID, opts *ResourceGetOptions) (*CertificateDetails, error)

GetCertificate mocks base method.

func (*MockInterface) GetCluster

func (m *MockInterface) GetCluster(ctx context.Context, clusterID ID, opts *ResourceGetOptions) (*Cluster, error)

GetCluster mocks base method.

func (*MockInterface) GetConsumer

func (m *MockInterface) GetConsumer(ctx context.Context, consumerID ID, opts *ResourceGetOptions) (*Consumer, error)

GetConsumer mocks base method.

func (*MockInterface) GetGatewayInstanceStartupConfigTemplate

func (m *MockInterface) GetGatewayInstanceStartupConfigTemplate(ctx context.Context, clusterID ID, configType string, opts *ResourceGetOptions) (string, error)

GetGatewayInstanceStartupConfigTemplate mocks base method.

func (*MockInterface) GetLogCollection

func (m *MockInterface) GetLogCollection(ctx context.Context, lcID ID, opts *ResourceGetOptions) (*LogCollection, error)

GetLogCollection mocks base method.

func (*MockInterface) GetMember

func (m *MockInterface) GetMember(ctx context.Context, memberID ID, opts *ResourceGetOptions) (*Member, error)

GetMember mocks base method.

func (*MockInterface) GetOrganization

func (m *MockInterface) GetOrganization(ctx context.Context, orgID ID, opts *ResourceGetOptions) (*Organization, error)

GetOrganization mocks base method.

func (*MockInterface) GetServiceRegistry

func (m *MockInterface) GetServiceRegistry(ctx context.Context, registryID ID, opts *ResourceGetOptions) (*ServiceRegistry, error)

GetServiceRegistry mocks base method.

func (*MockInterface) InviteMember

func (m *MockInterface) InviteMember(ctx context.Context, email string, role *Role, opts *ResourceCreateOptions) (*Member, error)

InviteMember mocks base method.

func (*MockInterface) ListAPIs

ListAPIs mocks base method.

func (*MockInterface) ListAllAPILabels

func (m *MockInterface) ListAllAPILabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)

ListAllAPILabels mocks base method.

func (*MockInterface) ListAllApplicationLabels

func (m *MockInterface) ListAllApplicationLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)

ListAllApplicationLabels mocks base method.

func (*MockInterface) ListAllCertificateLabels

func (m *MockInterface) ListAllCertificateLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)

ListAllCertificateLabels mocks base method.

func (*MockInterface) ListAllConsumerLabels

func (m *MockInterface) ListAllConsumerLabels(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]string, error)

ListAllConsumerLabels mocks base method.

func (*MockInterface) ListAllGatewayInstances

func (m *MockInterface) ListAllGatewayInstances(ctx context.Context, clusterID ID, opts *ResourceListOptions) ([]GatewayInstance, error)

ListAllGatewayInstances mocks base method.

func (*MockInterface) ListApplications

ListApplications mocks base method.

func (*MockInterface) ListCanaryReleases

func (m *MockInterface) ListCanaryReleases(ctx context.Context, opts *ResourceListOptions) (CanaryReleaseListIterator, error)

ListCanaryReleases mocks base method.

func (*MockInterface) ListCertificates

ListCertificates mocks base method.

func (*MockInterface) ListClusters

ListClusters mocks base method.

func (*MockInterface) ListConsumers

ListConsumers mocks base method.

func (*MockInterface) ListLogCollections

func (m *MockInterface) ListLogCollections(ctx context.Context, opts *ResourceListOptions) (LogCollectionIterator, error)

ListLogCollections mocks base method.

func (*MockInterface) ListMembers

ListMembers mocks base method.

func (*MockInterface) ListRegions

ListRegions mocks base method.

func (*MockInterface) ListRoles

ListRoles mocks base method.

func (*MockInterface) ListServiceRegistries

func (m *MockInterface) ListServiceRegistries(ctx context.Context, opts *ResourceListOptions) (ServiceRegistryListIterator, error)

ListServiceRegistries mocks base method.

func (*MockInterface) Me

func (m *MockInterface) Me(ctx context.Context) (*User, error)

Me mocks base method.

func (*MockInterface) PauseCanaryRelease

func (m *MockInterface) PauseCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)

PauseCanaryRelease mocks base method.

func (*MockInterface) PublishAPI

func (m *MockInterface) PublishAPI(ctx context.Context, apiID ID, opts *ResourceUpdateOptions) (*API, error)

PublishAPI mocks base method.

func (*MockInterface) PublishApplication

func (m *MockInterface) PublishApplication(ctx context.Context, appID ID, opts *ResourceUpdateOptions) (*Application, error)

PublishApplication mocks base method.

func (*MockInterface) ReInviteMember

func (m *MockInterface) ReInviteMember(ctx context.Context, memberID ID, opts *ResourceUpdateOptions) (*Member, error)

ReInviteMember mocks base method.

func (*MockInterface) RemoveMember

func (m *MockInterface) RemoveMember(ctx context.Context, memberID ID, opts *ResourceDeleteOptions) error

RemoveMember mocks base method.

func (*MockInterface) SetGlobalClusterID

func (m *MockInterface) SetGlobalClusterID(id ID)

SetGlobalClusterID mocks base method.

func (*MockInterface) StartCanaryRelease

func (m *MockInterface) StartCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)

StartCanaryRelease mocks base method.

func (*MockInterface) TraceChan

func (m *MockInterface) TraceChan() <-chan *TraceSeries

TraceChan mocks base method.

func (*MockInterface) TransferOwnership

func (m *MockInterface) TransferOwnership(ctx context.Context, toMember ID, opts *ResourceUpdateOptions) error

TransferOwnership mocks base method.

func (*MockInterface) UnpublishAPI

func (m *MockInterface) UnpublishAPI(ctx context.Context, apiID ID, opts *ResourceUpdateOptions) (*API, error)

UnpublishAPI mocks base method.

func (*MockInterface) UnpublishApplication

func (m *MockInterface) UnpublishApplication(ctx context.Context, appID ID, opts *ResourceUpdateOptions) (*Application, error)

UnpublishApplication mocks base method.

func (*MockInterface) UpdateAPI

func (m *MockInterface) UpdateAPI(ctx context.Context, api *API, opts *ResourceUpdateOptions) (*API, error)

UpdateAPI mocks base method.

func (*MockInterface) UpdateApplication

func (m *MockInterface) UpdateApplication(ctx context.Context, app *Application, opts *ResourceUpdateOptions) (*Application, error)

UpdateApplication mocks base method.

func (*MockInterface) UpdateCanaryRelease

func (m *MockInterface) UpdateCanaryRelease(ctx context.Context, cr *CanaryRelease, opts *ResourceUpdateOptions) (*CanaryRelease, error)

UpdateCanaryRelease mocks base method.

func (*MockInterface) UpdateCertificate

func (m *MockInterface) UpdateCertificate(ctx context.Context, cert *Certificate, opts *ResourceUpdateOptions) (*CertificateDetails, error)

UpdateCertificate mocks base method.

func (*MockInterface) UpdateClusterPlugins

func (m *MockInterface) UpdateClusterPlugins(ctx context.Context, clusterID ID, plugins Plugins, opts *ResourceUpdateOptions) error

UpdateClusterPlugins mocks base method.

func (*MockInterface) UpdateClusterSettings

func (m *MockInterface) UpdateClusterSettings(ctx context.Context, clusterID ID, settings *ClusterSettings, opts *ResourceUpdateOptions) error

UpdateClusterSettings mocks base method.

func (*MockInterface) UpdateConsumer

func (m *MockInterface) UpdateConsumer(ctx context.Context, consumer *Consumer, opts *ResourceUpdateOptions) (*Consumer, error)

UpdateConsumer mocks base method.

func (*MockInterface) UpdateLogCollection

func (m *MockInterface) UpdateLogCollection(ctx context.Context, lc *LogCollection, opts *ResourceUpdateOptions) (*LogCollection, error)

UpdateLogCollection mocks base method.

func (*MockInterface) UpdateMemberRoles

func (m *MockInterface) UpdateMemberRoles(ctx context.Context, memberID ID, roleBindings []RoleBinding, opts *ResourceUpdateOptions) error

UpdateMemberRoles mocks base method.

func (*MockInterface) UpdateServiceRegistry

func (m *MockInterface) UpdateServiceRegistry(ctx context.Context, registry *ServiceRegistry, opts *ResourceUpdateOptions) (*ServiceRegistry, error)

UpdateServiceRegistry mocks base method.

type MockInterfaceMockRecorder

type MockInterfaceMockRecorder struct {
	// contains filtered or unexported fields
}

MockInterfaceMockRecorder is the mock recorder for MockInterface.

func (*MockInterfaceMockRecorder) CreateAPI

func (mr *MockInterfaceMockRecorder) CreateAPI(ctx, api, opts interface{}) *gomock.Call

CreateAPI indicates an expected call of CreateAPI.

func (*MockInterfaceMockRecorder) CreateAccessToken

func (mr *MockInterfaceMockRecorder) CreateAccessToken(ctx, token interface{}) *gomock.Call

CreateAccessToken indicates an expected call of CreateAccessToken.

func (*MockInterfaceMockRecorder) CreateApplication

func (mr *MockInterfaceMockRecorder) CreateApplication(ctx, app, opts interface{}) *gomock.Call

CreateApplication indicates an expected call of CreateApplication.

func (*MockInterfaceMockRecorder) CreateCanaryRelease

func (mr *MockInterfaceMockRecorder) CreateCanaryRelease(ctx, cr, opts interface{}) *gomock.Call

CreateCanaryRelease indicates an expected call of CreateCanaryRelease.

func (*MockInterfaceMockRecorder) CreateCertificate

func (mr *MockInterfaceMockRecorder) CreateCertificate(ctx, cert, opts interface{}) *gomock.Call

CreateCertificate indicates an expected call of CreateCertificate.

func (*MockInterfaceMockRecorder) CreateConsumer

func (mr *MockInterfaceMockRecorder) CreateConsumer(ctx, consumer, opts interface{}) *gomock.Call

CreateConsumer indicates an expected call of CreateConsumer.

func (*MockInterfaceMockRecorder) CreateLogCollection

func (mr *MockInterfaceMockRecorder) CreateLogCollection(ctx, lc, opts interface{}) *gomock.Call

CreateLogCollection indicates an expected call of CreateLogCollection.

func (*MockInterfaceMockRecorder) CreateServiceRegistry

func (mr *MockInterfaceMockRecorder) CreateServiceRegistry(ctx, registry, opts interface{}) *gomock.Call

CreateServiceRegistry indicates an expected call of CreateServiceRegistry.

func (*MockInterfaceMockRecorder) DebugAPIResources

func (mr *MockInterfaceMockRecorder) DebugAPIResources(ctx, apiID, opts interface{}) *gomock.Call

DebugAPIResources indicates an expected call of DebugAPIResources.

func (*MockInterfaceMockRecorder) DebugApplicationResources

func (mr *MockInterfaceMockRecorder) DebugApplicationResources(ctx, appID, opts interface{}) *gomock.Call

DebugApplicationResources indicates an expected call of DebugApplicationResources.

func (*MockInterfaceMockRecorder) DebugCertificateResources

func (mr *MockInterfaceMockRecorder) DebugCertificateResources(ctx, appID, opts interface{}) *gomock.Call

DebugCertificateResources indicates an expected call of DebugCertificateResources.

func (*MockInterfaceMockRecorder) DebugClusterSettings

func (mr *MockInterfaceMockRecorder) DebugClusterSettings(ctx, opts interface{}) *gomock.Call

DebugClusterSettings indicates an expected call of DebugClusterSettings.

func (*MockInterfaceMockRecorder) DebugConsumerResources

func (mr *MockInterfaceMockRecorder) DebugConsumerResources(ctx, consumerID, opts interface{}) *gomock.Call

DebugConsumerResources indicates an expected call of DebugConsumerResources.

func (*MockInterfaceMockRecorder) DeleteAPI

func (mr *MockInterfaceMockRecorder) DeleteAPI(ctx, apiID, opts interface{}) *gomock.Call

DeleteAPI indicates an expected call of DeleteAPI.

func (*MockInterfaceMockRecorder) DeleteAccessToken

func (mr *MockInterfaceMockRecorder) DeleteAccessToken(ctx, token interface{}) *gomock.Call

DeleteAccessToken indicates an expected call of DeleteAccessToken.

func (*MockInterfaceMockRecorder) DeleteApplication

func (mr *MockInterfaceMockRecorder) DeleteApplication(ctx, appID, opts interface{}) *gomock.Call

DeleteApplication indicates an expected call of DeleteApplication.

func (*MockInterfaceMockRecorder) DeleteCanaryRelease

func (mr *MockInterfaceMockRecorder) DeleteCanaryRelease(ctx, crID, opts interface{}) *gomock.Call

DeleteCanaryRelease indicates an expected call of DeleteCanaryRelease.

func (*MockInterfaceMockRecorder) DeleteCertificate

func (mr *MockInterfaceMockRecorder) DeleteCertificate(ctx, certID, opts interface{}) *gomock.Call

DeleteCertificate indicates an expected call of DeleteCertificate.

func (*MockInterfaceMockRecorder) DeleteConsumer

func (mr *MockInterfaceMockRecorder) DeleteConsumer(ctx, consumerID, opts interface{}) *gomock.Call

DeleteConsumer indicates an expected call of DeleteConsumer.

func (*MockInterfaceMockRecorder) DeleteLogCollection

func (mr *MockInterfaceMockRecorder) DeleteLogCollection(ctx, lcID, opts interface{}) *gomock.Call

DeleteLogCollection indicates an expected call of DeleteLogCollection.

func (*MockInterfaceMockRecorder) DeleteServiceRegistry

func (mr *MockInterfaceMockRecorder) DeleteServiceRegistry(ctx, registryID, opts interface{}) *gomock.Call

DeleteServiceRegistry indicates an expected call of DeleteServiceRegistry.

func (*MockInterfaceMockRecorder) FinishCanaryRelease

func (mr *MockInterfaceMockRecorder) FinishCanaryRelease(ctx, cr, opts interface{}) *gomock.Call

FinishCanaryRelease indicates an expected call of FinishCanaryRelease.

func (*MockInterfaceMockRecorder) GenerateGatewaySideCertificate

func (mr *MockInterfaceMockRecorder) GenerateGatewaySideCertificate(ctx, clusterID, opts interface{}) *gomock.Call

GenerateGatewaySideCertificate indicates an expected call of GenerateGatewaySideCertificate.

func (*MockInterfaceMockRecorder) GetAPI

func (mr *MockInterfaceMockRecorder) GetAPI(ctx, apiID, opts interface{}) *gomock.Call

GetAPI indicates an expected call of GetAPI.

func (*MockInterfaceMockRecorder) GetApplication

func (mr *MockInterfaceMockRecorder) GetApplication(ctx, appID, opts interface{}) *gomock.Call

GetApplication indicates an expected call of GetApplication.

func (*MockInterfaceMockRecorder) GetCanaryRelease

func (mr *MockInterfaceMockRecorder) GetCanaryRelease(ctx, crID, opts interface{}) *gomock.Call

GetCanaryRelease indicates an expected call of GetCanaryRelease.

func (*MockInterfaceMockRecorder) GetCertificate

func (mr *MockInterfaceMockRecorder) GetCertificate(ctx, certID, opts interface{}) *gomock.Call

GetCertificate indicates an expected call of GetCertificate.

func (*MockInterfaceMockRecorder) GetCluster

func (mr *MockInterfaceMockRecorder) GetCluster(ctx, clusterID, opts interface{}) *gomock.Call

GetCluster indicates an expected call of GetCluster.

func (*MockInterfaceMockRecorder) GetConsumer

func (mr *MockInterfaceMockRecorder) GetConsumer(ctx, consumerID, opts interface{}) *gomock.Call

GetConsumer indicates an expected call of GetConsumer.

func (*MockInterfaceMockRecorder) GetGatewayInstanceStartupConfigTemplate

func (mr *MockInterfaceMockRecorder) GetGatewayInstanceStartupConfigTemplate(ctx, clusterID, configType, opts interface{}) *gomock.Call

GetGatewayInstanceStartupConfigTemplate indicates an expected call of GetGatewayInstanceStartupConfigTemplate.

func (*MockInterfaceMockRecorder) GetLogCollection

func (mr *MockInterfaceMockRecorder) GetLogCollection(ctx, lcID, opts interface{}) *gomock.Call

GetLogCollection indicates an expected call of GetLogCollection.

func (*MockInterfaceMockRecorder) GetMember

func (mr *MockInterfaceMockRecorder) GetMember(ctx, memberID, opts interface{}) *gomock.Call

GetMember indicates an expected call of GetMember.

func (*MockInterfaceMockRecorder) GetOrganization

func (mr *MockInterfaceMockRecorder) GetOrganization(ctx, orgID, opts interface{}) *gomock.Call

GetOrganization indicates an expected call of GetOrganization.

func (*MockInterfaceMockRecorder) GetServiceRegistry

func (mr *MockInterfaceMockRecorder) GetServiceRegistry(ctx, registryID, opts interface{}) *gomock.Call

GetServiceRegistry indicates an expected call of GetServiceRegistry.

func (*MockInterfaceMockRecorder) InviteMember

func (mr *MockInterfaceMockRecorder) InviteMember(ctx, email, role, opts interface{}) *gomock.Call

InviteMember indicates an expected call of InviteMember.

func (*MockInterfaceMockRecorder) ListAPIs

func (mr *MockInterfaceMockRecorder) ListAPIs(ctx, opts interface{}) *gomock.Call

ListAPIs indicates an expected call of ListAPIs.

func (*MockInterfaceMockRecorder) ListAllAPILabels

func (mr *MockInterfaceMockRecorder) ListAllAPILabels(ctx, clusterID, opts interface{}) *gomock.Call

ListAllAPILabels indicates an expected call of ListAllAPILabels.

func (*MockInterfaceMockRecorder) ListAllApplicationLabels

func (mr *MockInterfaceMockRecorder) ListAllApplicationLabels(ctx, clusterID, opts interface{}) *gomock.Call

ListAllApplicationLabels indicates an expected call of ListAllApplicationLabels.

func (*MockInterfaceMockRecorder) ListAllCertificateLabels

func (mr *MockInterfaceMockRecorder) ListAllCertificateLabels(ctx, clusterID, opts interface{}) *gomock.Call

ListAllCertificateLabels indicates an expected call of ListAllCertificateLabels.

func (*MockInterfaceMockRecorder) ListAllConsumerLabels

func (mr *MockInterfaceMockRecorder) ListAllConsumerLabels(ctx, clusterID, opts interface{}) *gomock.Call

ListAllConsumerLabels indicates an expected call of ListAllConsumerLabels.

func (*MockInterfaceMockRecorder) ListAllGatewayInstances

func (mr *MockInterfaceMockRecorder) ListAllGatewayInstances(ctx, clusterID, opts interface{}) *gomock.Call

ListAllGatewayInstances indicates an expected call of ListAllGatewayInstances.

func (*MockInterfaceMockRecorder) ListApplications

func (mr *MockInterfaceMockRecorder) ListApplications(ctx, opts interface{}) *gomock.Call

ListApplications indicates an expected call of ListApplications.

func (*MockInterfaceMockRecorder) ListCanaryReleases

func (mr *MockInterfaceMockRecorder) ListCanaryReleases(ctx, opts interface{}) *gomock.Call

ListCanaryReleases indicates an expected call of ListCanaryReleases.

func (*MockInterfaceMockRecorder) ListCertificates

func (mr *MockInterfaceMockRecorder) ListCertificates(ctx, opts interface{}) *gomock.Call

ListCertificates indicates an expected call of ListCertificates.

func (*MockInterfaceMockRecorder) ListClusters

func (mr *MockInterfaceMockRecorder) ListClusters(ctx, opts interface{}) *gomock.Call

ListClusters indicates an expected call of ListClusters.

func (*MockInterfaceMockRecorder) ListConsumers

func (mr *MockInterfaceMockRecorder) ListConsumers(ctx, opts interface{}) *gomock.Call

ListConsumers indicates an expected call of ListConsumers.

func (*MockInterfaceMockRecorder) ListLogCollections

func (mr *MockInterfaceMockRecorder) ListLogCollections(ctx, opts interface{}) *gomock.Call

ListLogCollections indicates an expected call of ListLogCollections.

func (*MockInterfaceMockRecorder) ListMembers

func (mr *MockInterfaceMockRecorder) ListMembers(ctx, opts interface{}) *gomock.Call

ListMembers indicates an expected call of ListMembers.

func (*MockInterfaceMockRecorder) ListRegions

func (mr *MockInterfaceMockRecorder) ListRegions(ctx, opts interface{}) *gomock.Call

ListRegions indicates an expected call of ListRegions.

func (*MockInterfaceMockRecorder) ListRoles

func (mr *MockInterfaceMockRecorder) ListRoles(ctx, opts interface{}) *gomock.Call

ListRoles indicates an expected call of ListRoles.

func (*MockInterfaceMockRecorder) ListServiceRegistries

func (mr *MockInterfaceMockRecorder) ListServiceRegistries(ctx, opts interface{}) *gomock.Call

ListServiceRegistries indicates an expected call of ListServiceRegistries.

func (*MockInterfaceMockRecorder) Me

func (mr *MockInterfaceMockRecorder) Me(ctx interface{}) *gomock.Call

Me indicates an expected call of Me.

func (*MockInterfaceMockRecorder) PauseCanaryRelease

func (mr *MockInterfaceMockRecorder) PauseCanaryRelease(ctx, cr, opts interface{}) *gomock.Call

PauseCanaryRelease indicates an expected call of PauseCanaryRelease.

func (*MockInterfaceMockRecorder) PublishAPI

func (mr *MockInterfaceMockRecorder) PublishAPI(ctx, apiID, opts interface{}) *gomock.Call

PublishAPI indicates an expected call of PublishAPI.

func (*MockInterfaceMockRecorder) PublishApplication

func (mr *MockInterfaceMockRecorder) PublishApplication(ctx, appID, opts interface{}) *gomock.Call

PublishApplication indicates an expected call of PublishApplication.

func (*MockInterfaceMockRecorder) ReInviteMember

func (mr *MockInterfaceMockRecorder) ReInviteMember(ctx, memberID, opts interface{}) *gomock.Call

ReInviteMember indicates an expected call of ReInviteMember.

func (*MockInterfaceMockRecorder) RemoveMember

func (mr *MockInterfaceMockRecorder) RemoveMember(ctx, memberID, opts interface{}) *gomock.Call

RemoveMember indicates an expected call of RemoveMember.

func (*MockInterfaceMockRecorder) SetGlobalClusterID

func (mr *MockInterfaceMockRecorder) SetGlobalClusterID(id interface{}) *gomock.Call

SetGlobalClusterID indicates an expected call of SetGlobalClusterID.

func (*MockInterfaceMockRecorder) StartCanaryRelease

func (mr *MockInterfaceMockRecorder) StartCanaryRelease(ctx, cr, opts interface{}) *gomock.Call

StartCanaryRelease indicates an expected call of StartCanaryRelease.

func (*MockInterfaceMockRecorder) TraceChan

func (mr *MockInterfaceMockRecorder) TraceChan() *gomock.Call

TraceChan indicates an expected call of TraceChan.

func (*MockInterfaceMockRecorder) TransferOwnership

func (mr *MockInterfaceMockRecorder) TransferOwnership(ctx, toMember, opts interface{}) *gomock.Call

TransferOwnership indicates an expected call of TransferOwnership.

func (*MockInterfaceMockRecorder) UnpublishAPI

func (mr *MockInterfaceMockRecorder) UnpublishAPI(ctx, apiID, opts interface{}) *gomock.Call

UnpublishAPI indicates an expected call of UnpublishAPI.

func (*MockInterfaceMockRecorder) UnpublishApplication

func (mr *MockInterfaceMockRecorder) UnpublishApplication(ctx, appID, opts interface{}) *gomock.Call

UnpublishApplication indicates an expected call of UnpublishApplication.

func (*MockInterfaceMockRecorder) UpdateAPI

func (mr *MockInterfaceMockRecorder) UpdateAPI(ctx, api, opts interface{}) *gomock.Call

UpdateAPI indicates an expected call of UpdateAPI.

func (*MockInterfaceMockRecorder) UpdateApplication

func (mr *MockInterfaceMockRecorder) UpdateApplication(ctx, app, opts interface{}) *gomock.Call

UpdateApplication indicates an expected call of UpdateApplication.

func (*MockInterfaceMockRecorder) UpdateCanaryRelease

func (mr *MockInterfaceMockRecorder) UpdateCanaryRelease(ctx, cr, opts interface{}) *gomock.Call

UpdateCanaryRelease indicates an expected call of UpdateCanaryRelease.

func (*MockInterfaceMockRecorder) UpdateCertificate

func (mr *MockInterfaceMockRecorder) UpdateCertificate(ctx, cert, opts interface{}) *gomock.Call

UpdateCertificate indicates an expected call of UpdateCertificate.

func (*MockInterfaceMockRecorder) UpdateClusterPlugins

func (mr *MockInterfaceMockRecorder) UpdateClusterPlugins(ctx, clusterID, plugins, opts interface{}) *gomock.Call

UpdateClusterPlugins indicates an expected call of UpdateClusterPlugins.

func (*MockInterfaceMockRecorder) UpdateClusterSettings

func (mr *MockInterfaceMockRecorder) UpdateClusterSettings(ctx, clusterID, settings, opts interface{}) *gomock.Call

UpdateClusterSettings indicates an expected call of UpdateClusterSettings.

func (*MockInterfaceMockRecorder) UpdateConsumer

func (mr *MockInterfaceMockRecorder) UpdateConsumer(ctx, consumer, opts interface{}) *gomock.Call

UpdateConsumer indicates an expected call of UpdateConsumer.

func (*MockInterfaceMockRecorder) UpdateLogCollection

func (mr *MockInterfaceMockRecorder) UpdateLogCollection(ctx, lc, opts interface{}) *gomock.Call

UpdateLogCollection indicates an expected call of UpdateLogCollection.

func (*MockInterfaceMockRecorder) UpdateMemberRoles

func (mr *MockInterfaceMockRecorder) UpdateMemberRoles(ctx, memberID, roleBindings, opts interface{}) *gomock.Call

UpdateMemberRoles indicates an expected call of UpdateMemberRoles.

func (*MockInterfaceMockRecorder) UpdateServiceRegistry

func (mr *MockInterfaceMockRecorder) UpdateServiceRegistry(ctx, registry, opts interface{}) *gomock.Call

UpdateServiceRegistry indicates an expected call of UpdateServiceRegistry.

type MockhttpClient

type MockhttpClient struct {
	// contains filtered or unexported fields
}

MockhttpClient is a mock of httpClient interface.

func NewMockhttpClient

func NewMockhttpClient(ctrl *gomock.Controller) *MockhttpClient

NewMockhttpClient creates a new mock instance.

func (*MockhttpClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockhttpClientMockRecorder

type MockhttpClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockhttpClientMockRecorder is the mock recorder for MockhttpClient.

type ObservabilitySettings

type ObservabilitySettings struct {
	Metrics MetricsConfig `json:"metrics,omitempty"`
	// ShowUpstreamStatusInResponseHeader indicates whether to show all upstream status
	// in `X-APISIX-Upstream-Status` header.
	// This header will be shown only when the status code is `5xx` when this field is diable.
	ShowUpstreamStatusInResponseHeader bool `json:"show_upstream_status_in_response_header"`
	// AccessLogRotate is the access log rotate settings config
	AccessLogRotate AccessLogRotateSettings `json:"access_log_rotate"`
}

ObservabilitySettings is the observability settings config

type Options

type Options struct {
	// ServerAddr indicates the URL for accessing API7 Cloud API.
	// e.g. https://api.api7.cloud.
	ServerAddr string `json:"server_addr" yaml:"server_addr"`
	// Token is a personal access token for accessing API7 Cloud API.
	// You can skip filling this field in turn using `TokenPath` field to
	// configure the token from filesystem.
	// Note, when you configure both of the `Token` and `TokenPath` field, the `Token`
	// field takes the precedence.
	Token string `json:"token" yaml:"token"`
	// TokenPath indicates the filepath where the API7 Cloud access token stores.
	// You can skip filling this field in turn using `Token` field to configure
	// the token literally.
	// Note, when you configure both of the `Token` and `TokenPath` field, the `Token`
	// field takes the precedence.
	TokenPath string `json:"token_path" yaml:"token_path"`
	// DialTimeout indicates the timeout for the TCP handshake.
	DialTimeout time.Duration `json:"dial_timeout" yaml:"dial_timeout"`
	// TLSHandshakeTimeout indicates the timeout for TLS handshake.
	TLSHandshakeTimeout time.Duration `json:"tls_handshake_timeout" yaml:"tls_handshake_timeout"`
	// InsecureSkipTLSVerify indicates if Cloud Go SDK should skip verifying
	// API7 Cloud server's TLS certificate.
	InsecureSkipTLSVerify bool `json:"insecure_skip_tls_verify" yaml:"insecure_skip_tls_verify"`
	// ServerNameIndication indicates the TLS SNI extension.
	ServerNameIndication string `json:"server_name_indication" yaml:"server_name_indication"`
	// ClientCert is the client certificate for mTLS.
	ClientCert string `json:"client_cert" yaml:"client_cert"`
	// ClientPrivateKey indicates the private key for the client certificate.
	ClientPrivateKey string `json:"client_private_key" yaml:"client_private_key"`
	// EnableHTTPTrace indicate if collect events occur during an HTTP call.
	// Events are generated by the net/http/httptrace package.
	// Note, set this field to true might cause more memory usage. Please only
	// enable it if you want to troubleshoot some problems.
	EnableHTTPTrace bool `json:"enable_http_trace" yaml:"enable_http_trace"`
	// GenIDForCalls indicates if an ID (generated by snowflake algorithm)
	// should be added for each API requests.
	// Note, the ID will be put in the `X-Request-ID` header.
	GenIDForCalls bool `json:"gen_id_for_calls" yaml:"gen_id_for_calls"`
}

Options contains all related configurations for the SDK to communicate with API7 Cloud.

type Organization

type Organization struct {
	// ID is the unique identify to mark an object.
	ID ID `json:"id,inline" yaml:"id"`
	// Name is the object name.
	Name string `json:"name" yaml:"name"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"`
	// PlanID indicates which plan is used by this organization.
	// PlanID should refer to a valid Plan object.
	PlanID ID `json:"plan_id" yaml:"plan_id"`
	// PlanExpireTime indicates the binding plan expire time for this organization.
	PlanExpireTime time.Time `json:"plan_expire_time" yaml:"plan_expire_time"`
	// SubscriptionStartedAt is the time when the organization subscribed to the plan.
	SubscriptionStartedAt *time.Time `json:"subscription_started_at" yaml:"subscription_started_at"`
	// OwnerID indicates who create the organization.
	OwnerID string `json:"owner_id" yaml:"owner_id"`
}

Organization is the specification of an API7 Cloud organization.

type OrganizationInterface

type OrganizationInterface interface {
	// GetOrganization gets an existing API7 Cloud Organization.
	// The given `orgID` parameter should specify the Organization that you want to get.
	// Currently, the `opts` parameter doesn't matter, users can pass the `nil` value.
	GetOrganization(ctx context.Context, orgID ID, opts *ResourceGetOptions) (*Organization, error)
	// ListMembers returns an iterator for listing Members in the specified Organization with the
	// given list conditions.
	// Users need to specify the Organization, Paging in the `opts`.
	ListMembers(ctx context.Context, opts *ResourceListOptions) (MemberListIterator, error)
	// InviteMember invites a new member to the organization.
	// The given `email` parameter should specify a correct mail address.
	// The given `role` parameter should specify an appropriate member role.
	// Users need to specify the Organization in the `opts`.
	InviteMember(ctx context.Context, email string, role *Role, opts *ResourceCreateOptions) (*Member, error)
	// ReInviteMember re-invites an existing member (which state is MemberStatePending) to the organization.
	// The given `memberID` parameter should specify the existing member.
	// Users need to specify the Organization in the `opts`.
	ReInviteMember(ctx context.Context, memberID ID, opts *ResourceUpdateOptions) (*Member, error)
	// RemoveMember removes an existing member from the organization.
	// The given `memberID` parameter should specify the existing member.
	// Users need to specify the Organization in the `opts`.
	RemoveMember(ctx context.Context, memberID ID, opts *ResourceDeleteOptions) error
	// GetMember gets an existing member from the organization.
	// The given `memberID` parameter should specify the existing member.
	// Users need to specify the Organization in the `opts`.
	GetMember(ctx context.Context, memberID ID, opts *ResourceGetOptions) (*Member, error)
	// UpdateMemberRoles updates the roles for the specified member.
	// The given `memberID` parameter should specify the existing member.
	// The given `roleBindings` parameter specifies new roles for this member.
	// Users need to specify the Organization in the `opts`.
	UpdateMemberRoles(ctx context.Context, memberID ID, roleBindings []RoleBinding, opts *ResourceUpdateOptions) error
	// ListRoles returns an iterator for listing Roles in the specified Organization with the
	// given list conditions.
	// Users need to specify the Organization, Paging in the `opts`.
	ListRoles(ctx context.Context, opts *ResourceListOptions) (RoleListIterator, error)
	// TransferOwnership transfers the organization ownership from yourself to another member.
	// The `toMember` parameter should specify the existing member in the same organization.
	// Users need to specify the Organization, Paging in the `opts`.
	// Note the operation will fail if you're not the owner of this organization.
	// After the transferring, your role will be downgraded to organization admin.
	TransferOwnership(ctx context.Context, toMember ID, opts *ResourceUpdateOptions) error
}

OrganizationInterface is the interface for manipulating Organization and Member.

type Pagination

type Pagination struct {
	// Page is the start page.
	Page int
	// PageSize is the page size (how many items will be in a page).
	PageSize int
}

Pagination indicates the paging.

type PassiveHealthCheck

type PassiveHealthCheck struct {
	Type  string                     `json:"type"`
	HTTP  *HTTPPassiveHealthCheck    `json:"http"`
	HTTPS *HTTPPassiveHealthCheck    `json:"https"`
	TCP   *TCPPassiveCheckPredicates `json:"tcp"`
}

PassiveHealthCheck the data of passive health check

type Permissions

type Permissions struct {
	// Organization is the organization scope of permission
	Organization map[string]Methods `json:"organization"`
	// Cluster is the cluster scope of permission
	Cluster map[string]Methods `json:"cluster"`
	// Billing is the billing scope of permission
	Billing map[string]Methods `json:"billing"`
	// APIManagement is the API management scope of permission
	APIManagement map[string]Methods `json:"api_management"`
}

Permissions means the permissions that can be performed on an organization.

type Plugins

type Plugins map[string]interface{}

Plugins contains a collect of plugins like CORS, Rate Limiting, Authentication and so on.

type ProbeHeader

type ProbeHeader map[string]string

ProbeHeader indicates headers that will be taken in probe requests.

func (ProbeHeader) ToStringArray

func (header ProbeHeader) ToStringArray() []string

type Region

type Region struct {
	// ID is the unique identify to mark an object.
	ID ID `json:"id"`
	// Name is the object name.
	Name string `json:"name"`
	// CreatedAt is the object creation time.
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object.
	UpdatedAt time.Time `json:"updated_at"`
	// Provider is the cloud vendor we use, like aws, gcp
	Provider string `json:"provider"`
	// Status is the region status
	Status EntityStatus `json:"status,omitempty"`
}

Region is the specification of the deploy region for Cloud.

type RegionInterface

type RegionInterface interface {
	// ListRegions returns an iterator for listing Regions with the
	// given list conditions.
	// Users need to specify the Paging and Filter conditions (if necessary)
	// in the `opts`.
	ListRegions(ctx context.Context, opts *ResourceListOptions) (RegionListIterator, error)
}

RegionInterface is the interface for manipulating Region.

type RegionListIterator

type RegionListIterator interface {
	// Next returns the next Region according to the filter conditions.
	Next() (*Region, error)
}

RegionListIterator is an iterator for listing Regions.

type ResourceCommonOpts

type ResourceCommonOpts interface {
	GetCluster() *Cluster
}

type ResourceCreateOptions

type ResourceCreateOptions struct {
	// Organization indicates where the resources are.
	// This field should be specified when users want to create resources.
	// in the organization. e.g., when inviting a member, the
	// Organization.ID should be specified.
	Organization *Organization
	// Cluster indicates where the resource belongs.
	// This field should be specified when users want to create resources
	// in the cluster. e.g., when creating Application, the
	// Cluster.ID should be specified.
	Cluster *Cluster
	// Application indicates which Application should this resource belong.
	// This field should be specified when users want to update sub-resources
	// in the Application. e.g., when creating API, CanaryRelease, the
	// Application.ID should be specified.
	Application *Application
}

ResourceCreateOptions contains some options for creating an API7 Cloud resource.

func (*ResourceCreateOptions) GetCluster

func (r *ResourceCreateOptions) GetCluster() *Cluster

type ResourceDeleteOptions

type ResourceDeleteOptions struct {
	// Organization indicates where the resources are.
	// This field should be specified when users want to update resources.
	// in the organization. e.g., when deleting a member, the
	// Organization.ID should be specified.
	Organization *Organization
	// Cluster indicates where the resource is.
	// This field should be specified when users want to delete resources
	// in the cluster. e.g., when deleting Application, the
	// Cluster.ID should be specified.
	Cluster *Cluster
	// Application indicates which Application should this resource belong.
	// This field should be specified when users want to delete sub-resources
	// in the Application. e.g., when deleting API, the
	// Application.ID should be specified.
	Application *Application
}

ResourceDeleteOptions contains some options for deleting an API7 Cloud resource.

func (*ResourceDeleteOptions) GetCluster

func (r *ResourceDeleteOptions) GetCluster() *Cluster

type ResourceGetOptions

type ResourceGetOptions struct {
	// Organization indicates where the resources are.
	// This field should be specified when users want to list resources.
	// in the organization. e.g., when getting a member, the
	// Organization.ID should be specified.
	Organization *Organization
	// Cluster indicates where the resource is.
	// This field should be specified when users want to get a resource.
	// in the cluster. e.g., when getting Application, the
	// Cluster.ID should be specified.
	Cluster *Cluster
	// Application indicates which Application should this resource belong.
	// This field should be specified when users want to fetch sub-resources
	// in the Application. e.g., when fetching API, the
	// Application.ID should be specified.
	Application *Application
}

ResourceGetOptions contains some options for getting an API7 Cloud resource.

func (*ResourceGetOptions) GetCluster

func (r *ResourceGetOptions) GetCluster() *Cluster

type ResourceListOptions

type ResourceListOptions struct {
	// Organization indicates where the resources are.
	// This field should be specified when users want to list resources.
	// in the organization. e.g., when iterating Cluster, the
	// Organization.ID should be specified.
	Organization *Organization
	// Cluster indicates where the resources are.
	// This field should be specified when users want to list resources.
	// in the cluster. e.g., when iterating Application, the
	// Cluster.ID should be specified.
	Cluster *Cluster
	// Application indicates which Application should this resource belong.
	// This field should be specified when users want to list sub-resources
	// in the Application. e.g., when listing API, the
	// Application.ID should be specified.
	Application *Application
	// Pagination indicates the start page and the page size for listing resources.
	Pagination *Pagination
	// Filter indicates conditions to filter out resources.
	Filter *Filter
}

ResourceListOptions contains some options for listing the same kind of API7 Cloud resources.

func (*ResourceListOptions) GetCluster

func (r *ResourceListOptions) GetCluster() *Cluster

type ResourceUpdateOptions

type ResourceUpdateOptions struct {
	// Organization indicates where the resources are.
	// This field should be specified when users want to update resources.
	// in the organization. e.g., when re-inviting a member, the
	// Organization.ID should be specified.
	Organization *Organization
	// Cluster indicates where the resource belongs.
	// This field should be specified when users want to update resources
	// in the cluster. e.g., when updating Application, the
	// Cluster.ID should be specified.
	Cluster *Cluster
	// Application indicates which Application should this resource belong.
	// This field should be specified when users want to update sub-resources
	// in the Application. e.g., when updating API, the
	// Application.ID should be specified.
	Application *Application
}

ResourceUpdateOptions contains some options for updating an API7 Cloud resource.

func (*ResourceUpdateOptions) GetCluster

func (r *ResourceUpdateOptions) GetCluster() *Cluster

type Role

type Role struct {
	// ID is the id of role
	ID ID `json:"id" gorm:"primaryKey"`
	// Name is the name of role
	Name string `json:"name" gorm:"column:name"`
	// OrgID is the id of organization
	OrgID ID `json:"org_id" gorm:"column:org_id"`
	// Owner is the owner of role
	Owner bool `json:"owner" gorm:"column:owner"`
	// Permissions is the permissions of role
	// Key means the name of resource
	// Value means the permissions of resource
	Permissions Permissions `json:"permissions" gorm:"serializer:json;"`
	// Scope is the scope of role. Optional values can be:
	// * RoleScopeOrganization
	// * RoleScopeCluster
	Scope     string    `json:"scope" gorm:"column:scope"`
	CreatedAt time.Time `json:"-" yaml:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time `json:"-" yaml:"updated_at" gorm:"autoUpdateTime"`
}

Role is the role of a member.

type RoleBinding

type RoleBinding struct {
	// RoleID is the id of role
	RoleID ID `json:"role_id"`
	// ClusterID is the id of cluster
	// This field is used only if the role is not
	// organization scoped.
	ClusterID ID `json:"cluster_id"`
}

RoleBinding binds a role to an organization member.

type RoleListIterator

type RoleListIterator interface {
	// Next returns the next Role according to the filter conditions.
	Next() (*Role, error)
}

RoleListIterator is an iterator for listing Roles.

type ServerHeaderCustomization

type ServerHeaderCustomization struct {
	// Mode is the mode of the customization
	// Optional values can be:
	// * RewriteServerHeader, rewrite the server header, value is specified by `NewServerHeader`.
	// * HideServerToken, still use APISIX as the server header, but hide the version token.
	Mode string `json:"mode,omitempty"`
	// NewServerHeader is the new server header
	NewServerHeader string `json:"new_server_header,omitempty"`
}

ServerHeaderCustomization is the server header customization settings

type ServiceDiscoveryInterface

type ServiceDiscoveryInterface interface {
	// CreateServiceRegistry creates an API7 Cloud ServiceRegistry in the specified cluster.
	// The given `registry` parameter should specify the desired ServiceRegistry specification.
	// Users need to specify the Cluster in the `opts`.
	// The returned ServiceRegistry will contain the same ServiceRegistry specification plus some
	// management fields and default values.
	CreateServiceRegistry(ctx context.Context, registry *ServiceRegistry, opts *ResourceCreateOptions) (*ServiceRegistry, error)
	// UpdateServiceRegistry updates an existing API7 Cloud ServiceRegistry in the specified cluster.
	// The given `registry` parameter should specify the ServiceRegistry that you want to update.
	// Users need to specify the Cluster in the `opts`.
	// The returned ServiceRegistry will contain the same ServiceRegistry specification plus some
	// management fields and default values.
	UpdateServiceRegistry(ctx context.Context, registry *ServiceRegistry, opts *ResourceUpdateOptions) (*ServiceRegistry, error)
	// DeleteServiceRegistry deletes an existing API7 Cloud ServiceRegistry in the specified cluster.
	// The given `appID` parameter should specify the Application that you want to delete.
	// Users need to specify the Cluster in the `opts`.
	DeleteServiceRegistry(ctx context.Context, registryID ID, opts *ResourceDeleteOptions) error
	// GetServiceRegistry gets an existing API7 Cloud ServiceRegistry in the specified cluster.
	// The given `registryID` parameter should specify the ServiceRegistry that you want to get.
	// Users need to specify the Cluster in the `opts`.
	GetServiceRegistry(ctx context.Context, registryID ID, opts *ResourceGetOptions) (*ServiceRegistry, error)
	// ListServiceRegistries returns an iterator for listing service registries in the specified cluster
	// with the given list conditions.
	// Users need to specify the Cluster, Paging and Filter conditions (if necessary) in the `opts`.
	ListServiceRegistries(ctx context.Context, opts *ResourceListOptions) (ServiceRegistryListIterator, error)
}

ServiceDiscoveryInterface is the interface for manipulating API7 Cloud service discovery features.

type ServiceRegistry

type ServiceRegistry struct {
	ServiceRegistrySpec `json:",inline"`

	// ID is the service registry id.
	ID ID `json:"id" gorm:"column:id"`
	// ClusterID is id of cluster that current service registry belong with.
	ClusterID ID `json:"cluster_id"`
	// Status is status of service registry.
	Status EntityStatus `json:"status"`
	// CreatedAt is the object creation time
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt is the last modified time of this object
	UpdatedAt time.Time `json:"updated_at"`
}

ServiceRegistry attaches some management field to ServiceRegistry.

type ServiceRegistryListIterator

type ServiceRegistryListIterator interface {
	// Next returns the next ServiceRegistry according to the filter conditions.
	Next() (*ServiceRegistry, error)
}

ServiceRegistryListIterator is an iterator for listing service registries.

type ServiceRegistrySpec

type ServiceRegistrySpec struct {
	// Name is the service registry name.
	Name string `json:"name"`
	// Enable indicates whether the service registry is enabled.
	Enabled bool `json:"enabled"`
	// Type is the service registry type.
	Type ServiceRegistryType `json:"type"`
	// Kubernetes is the kubernetes service registry.
	// It's valid only if Type is ServiceRegistryKubernetes.
	Kubernetes *KubernetesServiceRegistry `json:"kubernetes,omitempty"`
}

ServiceRegistrySpec is the service registry specification.

type ServiceRegistryType

type ServiceRegistryType int

ServiceRegistryType describes the type of service registry.

type TCPActiveCheckPredicates

type TCPActiveCheckPredicates struct {
	ProbeTimeout     int64                   `json:"probe_timeout,omitempty"`
	ConcurrentProbes int64                   `json:"concurrent_probes,omitempty"`
	ProbeTargetPort  int64                   `json:"probe_target_port,omitempty"`
	Healthy          *TCPHealthyPredicates   `json:"healthy,omitempty"`
	UnHealthy        *TCPUnhealthyPredicates `json:"unhealthy,omitempty"`
}

TCPActiveCheckPredicates predicates for the TCP probe active health check

type TCPHealthyPredicates

type TCPHealthyPredicates struct {
	TargetsCheckInterval int64 `json:"targets_check_interval,omitempty"`
	Successes            int64 `json:"successes,omitempty"`
}

TCPHealthyPredicates the healthy case data of tcp health check.

type TCPPassiveCheckPredicates

type TCPPassiveCheckPredicates struct {
	UnHealthy *TCPUnhealthyPredicatesForPassive `json:"unhealthy,omitempty"`
}

TCPPassiveCheckPredicates predicates for the TCP probe passive health check

type TCPUnhealthyPredicates

type TCPUnhealthyPredicates struct {
	TargetsCheckInterval int64 `json:"targets_check_interval,omitempty"`
	TcpFailures          int64 `json:"tcp_failures,omitempty"`
	Timeouts             int64 `json:"timeouts,omitempty"`
}

TCPUnhealthyPredicates the unhealthy case data of tcp health check.

type TCPUnhealthyPredicatesForPassive

type TCPUnhealthyPredicatesForPassive struct {
	TcpFailures int64 `json:"tcp_failures,omitempty"`
	Timeouts    int64 `json:"timeouts,omitempty"`
}

TCPUnhealthyPredicatesForPassive the unhealthy case data of passive tcp health check.

type TLSBundle

type TLSBundle struct {
	Certificate   string `json:"certificate"`
	PrivateKey    string `json:"private_key"`
	CACertificate string `json:"ca_certificate"`
}

TLSBundle contains a pair of certificate, private key, and the issuing certificate.

type TraceEvent

type TraceEvent struct {
	// Message indicates the event message level.
	Message string
	// HappenedAt indicates the time that this event occurred.
	HappenedAt time.Time
}

TraceEvent indicates an event occurred during the communication with API7 Cloud.

type TraceInterface

type TraceInterface interface {

	// TraceChan returns a readonly channel which returns *TraceSeries object.
	TraceChan() <-chan *TraceSeries
	// contains filtered or unexported methods
}

TraceInterface is the interface for http trace.

type TraceSeries

type TraceSeries struct {
	// ID indicates this series.
	ID ID
	// Request is the outgoing request that will send to API7 Cloud.
	// It's the context of the trace series.
	// NOTE: This request object is cloned from the original one, so
	// please avoid reading the Request.Body reader. Instead, use the
	// RequestBody field.
	Request *http.Request
	// RequestBody contains a copy of the outgoing HTTP request body.
	RequestBody []byte
	// Response indicates the response that will receive from API7 Cloud.
	// It's the context of the trace series.
	Response *http.Response
	// ResponseBody contains a copy of the incoming HTTP response body.
	ResponseBody []byte
	// Events contains a series of trace events.
	Events []*TraceEvent
}

TraceSeries contains a series of events (ordered by their happening time).

type Upstream

type Upstream struct {
	// The scheme to communicate with the upstream
	Scheme string `json:"scheme"`
	// LBType is the load balancing strategy of the upstream
	LBType string `json:"lb_type,omitempty"`
	// HashKey is the hash key used to balance the upstream
	HashKey string `json:"hash_key,omitempty"`
	// ServiceDiscovery is the service discovery of the upstream
	ServiceDiscovery *UpstreamServiceDiscovery `json:"service_discovery,omitempty"`
	// The upstream endpoints
	Targets []UpstreamTarget `json:"targets,omitempty"`
	// Retries is sets the number of retries while passing the request to Upstream using the underlying Nginx mechanism.
	Retries *int `json:"retries,omitempty"`
	// Timeout is sets the timeout for connecting to, and sending and receiving messages to and from the Upstream
	Timeout *UpstreamTimeout `json:"timeout,omitempty"`
	// UpstreamHostMode configures the host header when the request is forwarded to the upstream
	UpstreamHostMode string `json:"upstream_host_mode,omitempty"`
	// UpstreamHost specifies the host of the Upstream request, this is only valid if the upstream_host_mode is set to rewrite
	UpstreamHost string `json:"upstream_host,omitempty"`
	// ClientCertID settings the client cert for communicating with the upstream
	ClientCertID ID `json:"client_cert_id,omitempty"`
	//Checks the data of health check
	Checks *Checks `json:"checks,omitempty"`
}

Upstream is the definition of the upstream on Application.

type UpstreamAndVersion

type UpstreamAndVersion struct {
	Upstream Upstream `json:"upstream"`
	// Version information about this upstream
	Version string `json:"version"`
	// ClientCertID settings the client cert for communicating with the upstream
	// Deprecated: use Upstream.ClientCertID.
	ClientCertID ID `json:"client_cert_id,omitempty"`
}

UpstreamAndVersion contains both the upstream definition and the version information.

type UpstreamServiceDiscovery

type UpstreamServiceDiscovery struct {
	// ServiceRegistry is the type of service registry
	ServiceRegistry ServiceRegistryType `json:"service_registry"`
	// ServiceRegistryID is the id of service registry
	ServiceRegistryID ID `json:"service_registry_id"`
	// KubernetesService is the kubernetes service discovery of the upstream
	KubernetesService KubernetesUpstreamServiceDiscovery `json:"kubernetes_service"`
}

UpstreamServiceDiscovery is the service discovery of the upstream.

type UpstreamTarget

type UpstreamTarget struct {
	Host   string `json:"host"`
	Port   int    `json:"port"`
	Weight int    `json:"weight"`
}

UpstreamTarget is the definition for an upstream endpoint.

type UpstreamTimeout

type UpstreamTimeout struct {
	Connect int `json:"connect,omitempty"`
	Send    int `json:"send,omitempty"`
	Read    int `json:"read,omitempty"`
}

UpstreamTimeout is the timeout for connecting to, and sending and receiving messages to and from the Upstream, value in seconds.

type User

type User struct {
	ID        string `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	OrgIDs    []ID   `json:"org_ids"`
	// TODO change the type when we need this field.
	Members json.RawMessage `json:"members"`
	// TODO change the type when we need this field.
	ProductTour json.RawMessage `json:"product_tour"`
	Connection  string          `json:"connection"`
	AvatarURL   string          `json:"avatar_url"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

User defines user information for API7 Cloud.

type UserInterface

type UserInterface interface {
	// Me returns the current user's information.
	Me(ctx context.Context) (*User, error)
}

UserInterface is the interface for the user-related process on API7 Cloud.

Directories

Path Synopsis
internal
fake
Package fake provide fake objects.
Package fake provide fake objects.

Jump to

Keyboard shortcuts

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