apiclient

package
v1.119.2-beta Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

CrmURL is the endpoint for cloud resource manager

Variables

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

BaseURL is the Apigee control plane endpoint

View Source
var StageBaseURL = "https://staging-apigee.sandbox.googleapis.com/v1/organizations/"

Functions

func AddWid

func AddWid(projectID string, namespace string, kServiceAccount string, gServiceAccount string) (err error)

AddWid add workload identity role to a service account

func ClearEntityPayloadList

func ClearEntityPayloadList()

func CreateIAMServiceAccount

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

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

func DeletePreferencesFile

func DeletePreferencesFile() (err error)

func DownloadFile

func DownloadFile(url string, auth bool) (resp *http.Response, err error)

func DownloadResource

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

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

func DryRun

func DryRun() bool

DryRun

func Every

func Every(duration time.Duration, work func(time.Time) bool) chan bool

func FetchAsyncBundle

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

FetchAsyncBundle can download a shared flow or a proxy bundle

func FetchBundle

func FetchBundle(entityType string, folder string, name string, revision string, allRevisions bool) error

FetchBundle can download a shared flow or proxy bundle

func FolderExists

func FolderExists(folder string) (err error)

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 GetDefaultOrg

func GetDefaultOrg() (org string)

func GetEntityPayloadList

func GetEntityPayloadList() [][]byte

func GetHttpClient

func GetHttpClient() (client *http.Client, err error)

func GetLastCheck

func GetLastCheck() (lastCheck string)

func GetNoCheck

func GetNoCheck() bool

func GetPreferences

func GetPreferences() (err error)

func GetPrintOutput

func GetPrintOutput() bool

GetPrintOutput

func GetProjectID

func GetProjectID() string

GetProjectID gets the project id

func GetProxyURL

func GetProxyURL() string

GetProxyURL

func GetServiceAccount

func GetServiceAccount() string

GetServiceAccount

func GetStaging

func GetStaging() bool

func GetToken

func GetToken() (token string)

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, update bool, url string, formParams map[string]string) (respBody []byte, err error)

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

func PostHttpZip

func PostHttpZip(print bool, auth bool, method string, url string, headers map[string]string, zipfile string) (err error)

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

func PrettyPrint

func PrettyPrint(body []byte) error

PrettyPrint method prints formatted json

func ReadArchive

func ReadArchive(filename string) ([]byte, error)

ReadArchive confirms f the file format is zip and reads the contents are a byte[]

func ReadBundle

func ReadBundle(filename string) error

ReadBundle confirms if the file format is a zip file

func ReadPreferencesFile

func ReadPreferencesFile() (err error)

func RemoveIAMPermission

func RemoveIAMPermission(memberName string, iamRole string) (err error)

RemoveIAMPermission removes/unbinds IAM permission 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) (err error)

SetApigeeOrg sets the org variable

func SetApigeeToken

func SetApigeeToken(token string)

SetApigeeToken sets the access token for use with Apigee API calls

func SetAuthHeader

func SetAuthHeader(req *http.Request) (*http.Request, error)

func SetIAMPermission

func SetIAMPermission(memberName string, iamRole string, memberType string) (err error)

SetIAMPermission set permissions for a member on an Apigee Env

func SetNoCheck

func SetNoCheck(nocheck bool) (err error)

func SetPrintOutput

func SetPrintOutput(output bool)

PrintOutput

func SetProjectID

func SetProjectID(projectID string)

SetProjectID sets the project id

func SetProxy

func SetProxy(url string) (err error)

func SetProxyURL

func SetProxyURL(proxyurl string)

SetProxyURL

func SetServiceAccount

func SetServiceAccount(serviceAccount string)

SetServiceAccount

func SetSkipLogInfo

func SetSkipLogInfo(l bool)

SetSkipLogIngo

func SetStaging

func SetStaging(usestage bool) (err error)

func TestAndUpdateLastCheck

func TestAndUpdateLastCheck() (updated bool, err error)

func UseStaging

func UseStaging()

UseStaging

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

func WriteDefaultOrg

func WriteDefaultOrg(org string) (err error)

func WritePerferencesFile

func WritePerferencesFile(payload []byte) (err error)

WritePreferencesFile

func WriteToken

func WriteToken(token string) (err error)

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
	NoOutput       bool   //disables printing API responses
	ProxyUrl       string //use a proxy url
}

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