apiclient

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://apigee.googleapis.com/v1/organizations/"

BaseURL is the Apigee control plane endpoint

View Source
const CrmURL = "https://cloudresourcemanager.googleapis.com/v1/projects/"

CrmURL is the endpoint for cloud resource manager

Variables

This section is empty.

Functions

func CreateIAMServiceAccount

func CreateIAMServiceAccount(name string, iamRole string) (err error)

CreateIAMServiceAccount create a new IAM SA with the necessary roles for Apigee

func DownloadResource

func DownloadResource(url string, name string, resType string) error

DownloadResource method is used to download resources, proxy bundles, sharedflows

func FetchAsyncBundle

func FetchAsyncBundle(entityType string, name string, revision string, wg *sync.WaitGroup)

FetchAsyncBundle can download a shared flow or a proxy bundle

func FetchBundle

func FetchBundle(entityType string, name string, revision string) error

FetchBundle can download a shared flow or proxy bundle

func GetApigeeEnv

func GetApigeeEnv() string

GetApigeeEnv gets the env variable

func GetApigeeOrg

func GetApigeeOrg() string

GetApigeeOrg gets the org variable

func GetApigeeToken

func GetApigeeToken() string

GetApigeeToken get the access token value in client opts (does not generate it)

func GetAsyncEntity

func GetAsyncEntity(entityURL string, wg *sync.WaitGroup, mu *sync.Mutex)

GetAsyncEntity stores results for each entity in a list

func GetEntityPayloadList

func GetEntityPayloadList() [][]byte

func GetPrintOutput

func GetPrintOutput() bool

GetPrintOutput

func GetProjectID

func GetProjectID() string

GetProjectID gets the project id

func GetServiceAccount

func GetServiceAccount() string

GetServiceAccount

func HttpClient

func HttpClient(print bool, params ...string) (respBody []byte, err error)

HttpClient method is used to GET,POST,PUT or DELETE JSON data

func ImportBundle

func ImportBundle(entityType string, name string, bundlePath string) error

ImportBundle imports a sharedflow or api proxy bundle

func ImportBundleAsync

func ImportBundleAsync(entityType string, name string, bundlePath string, wg *sync.WaitGroup)

ImportBundleAsync imports a sharedflow or api proxy bundle meantot be called asynchronously

func IsSkipCache

func IsSkipCache() bool

IsSkipCache

func IsSkipCheck

func IsSkipCheck() bool

IsSkipCheck

func IsSkipLogInfo

func IsSkipLogInfo() bool

IsSkipLogInfo

func NewApigeeClient

func NewApigeeClient(o ApigeeClientOptions)

NewApigeeClient sets up options to invoke Apigee APIs

func PostHttpOctet

func PostHttpOctet(print bool, url string, proxyName string) (respBody []byte, err error)

PostHttpOctet method is used to send resources, proxy bundles, shared flows etc.

func PrettyPrint

func PrettyPrint(body []byte) error

PrettyPrint method prints formatted json

func ReadBundle

func ReadBundle(filename string) error

ReadBundle confirms if the file format is a zip file

func RemoveIAMServiceAccount added in v1.7.1

func RemoveIAMServiceAccount(serviceAccountName string, iamRole string) (err error)

RemoveIAMServiceAccount removes/unbinds IAM SA from all roles for an Apigee Env

func SetAccessToken

func SetAccessToken() error

SetAccessToken read from cache or if not found or expired will generate a new one

func SetApigeeEnv

func SetApigeeEnv(env string)

SetApigeeEnv set the env variable

func SetApigeeOrg

func SetApigeeOrg(org string)

SetApigeeOrg sets the org variable

func SetApigeeToken

func SetApigeeToken(token string)

SetApigeeToken sets the access token for use with Apigee API calls

func SetIAMServiceAccount

func SetIAMServiceAccount(serviceAccountName string, iamRole string) (err error)

SetIAMServiceAccount create a new IAM SA with the necessary roles for an Apigee Env

func SetPrintOutput

func SetPrintOutput(output bool)

PrintOutput

func SetProjectID

func SetProjectID(projectID string)

SetProjectID sets the project id

func SetServiceAccount

func SetServiceAccount(serviceAccount string)

SetServiceAccount

func SetSkipLogInfo

func SetSkipLogInfo(l bool)

SetSkipLogIngo

func WriteArrayByteArrayToFile

func WriteArrayByteArrayToFile(exportFile string, fileAppend bool, payload [][]byte) error

WriteArrayByteArrayToFile accepts [][]bytes and writes to a file

func WriteByteArrayToFile

func WriteByteArrayToFile(exportFile string, fileAppend bool, payload []byte) error

WriteByteArrayToFile accepts []bytes and writes to a file

Types

type ApigeeClientOptions

type ApigeeClientOptions struct {
	Org            string //Apigee org
	Env            string //Apigee environment
	Token          string //Google OAuth access token
	ServiceAccount string //Google service account json
	ProjectID      string //GCP Project ID
	SkipLogInfo    bool   //LogInfo controls the log level
	SkipCheck      bool   //skip checking access token expiry
	SkipCache      bool   //skip writing access token to file
	PrintOutput    bool   //prints output from http calls
}

ApigeeClientOptions is the base struct to hold all command arguments

Jump to

Keyboard shortcuts

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