btp

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigInstance

func ConfigInstance() interface{}

func Plugin

func Plugin(ctx context.Context) *plugin.Plugin

Types

type BTPClient

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

BTPClient of SAP BTP API

func NewBTPClient

func NewBTPClient(httpClient *http.Client, ctx context.Context, d *plugin.QueryData) (*BTPClient, error)

NewBTPClient creates new SAP BTP API client

func (*BTPClient) Get

func (b *BTPClient) Get(ctx context.Context, service BTPService, path string, headers map[string]string, queryStrings map[string]string) ([]byte, error)

Get from API

type BTPConfig

type BTPConfig struct {
	Username                  *string `hcl:"username"`
	Password                  *string `hcl:"password"`
	CISServiceKeyPath         *string `hcl:"cis_service_key_path"`
	CISAccessToken            string  `hcl:"cis_access_token,optional"`
	CISAccountServiceUrl      string  `hcl:"cis_accounts_service_url,optional"`
	CISEntitlementsServiceUrl string  `hcl:"cis_entitlements_service_url,optional"`
	CISEventsServiceUrl       string  `hcl:"cis_events_service_url,optional"`
	CISTokenUrl               string  `hcl:"cis_token_url,optional"`
	CISClientId               string  `hcl:"cis_client_id,optional"`
	CISClientSecret           string  `hcl:"cis_client_secret,optional"`
}

func GetConfig

func GetConfig(connection *plugin.Connection) BTPConfig

GetConfig :: retrieve and cast connection config from query data

type BTPService

type BTPService string
const (
	AccountsService    BTPService = "AccountsService"
	EntitlementService BTPService = "EntitlementService"
)

type BaseAPI

type BaseAPI interface {
	Get(ctx context.Context, path string) ([]byte, error)
}

BaseAPI encapsulates base methods for BTP client

type BusinessCategory

type BusinessCategory struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
}

type CISServiceKeyConfig added in v0.1.0

type CISServiceKeyConfig struct {
	Endpoints map[string]string `json:"endpoints"`
	Uaa       map[string]string `json:"uaa"`
}

type CommercialModel

type CommercialModel struct {
	Name             string `json:"name"`
	DisplayName      string `json:"displayName"`
	ConsumptionBased bool   `json:"consumptionBased"`
	Description      string `json:"description"`
}

type CustomProperty

type CustomProperty struct {
	AccountGUID string `json:"accountGUID"`
	Key         string `json:"key"`
	Value       string `json:"value"`
}

type DataCenter

type DataCenter struct {
	Name                   string `json:"name"`
	DisplayName            string `json:"displayName"`
	Region                 string `json:"region"`
	Environment            string `json:"environment"`
	IaasProvider           string `json:"iaasProvider"`
	SupportsTrial          bool   `json:"supportsTrial"`
	ProvisioningServiceURL string `json:"provisioningServiceUrl"`
	SaasRegistryServiceURL string `json:"saasRegistryServiceUrl"`
	Domain                 string `json:"domain"`
	IsMainDataCenter       bool   `json:"isMainDataCenter"`
	GeoAccess              string `json:"geoAccess"`
}

type Directory

type Directory struct {
	GUID              string           `json:"guid"`
	ParentType        string           `json:"parentType"`
	GlobalAccountGUID string           `json:"globalAccountGUID"`
	DisplayName       string           `json:"displayName"`
	CreatedDate       int64            `json:"createdDate"`
	CreatedBy         string           `json:"createdBy"`
	ModifiedDate      int64            `json:"modifiedDate"`
	EntityState       string           `json:"entityState"`
	StateMessage      string           `json:"stateMessage"`
	DirectoryType     string           `json:"directoryType"`
	DirectoryFeatures []string         `json:"directoryFeatures"`
	CustomProperties  []CustomProperty `json:"customProperties"`
	ContractStatus    string           `json:"contractStatus"`
	ConsumptionBased  bool             `json:"consumptionBased"`
	ParentGUID0       string           `json:"parentGuid"`
	ParentGUID1       string           `json:"parentGUID"`
	Subaccounts       []Subaccount     `json:"subaccounts"`
}

type EntitledService

type EntitledService struct {
	Name                   string           `json:"name"`
	DisplayName            string           `json:"displayName"`
	Description            string           `json:"description"`
	BusinessCategory       BusinessCategory `json:"businessCategory"`
	OwnerType              string           `json:"ownerType"`
	TermsOfUseURL          string           `json:"termsOfUseUrl"`
	ServicePlans           []ServicePlan    `json:"servicePlans"`
	IconBase64             string           `json:"iconBase64"`
	ApplicationCoordinates struct {
		IconFormat   string `json:"iconFormat"`
		InventoryIds []struct {
			Key string `json:"key"`
		} `json:"inventoryIds"`
		Visibility         string `json:"visibility"`
		ServiceDescription []struct {
			LinkCategory        string `json:"linkCategory"`
			Title               string `json:"title"`
			PropagateTheme      string `json:"propagateTheme"`
			DescriptionCategory string `json:"descriptionCategory"`
			LinkURL             string `json:"linkURL"`
		} `json:"serviceDescription"`
		ServiceCategories []struct {
			Name string `json:"name"`
		} `json:"serviceCategories"`
		RegionInformation []struct {
			Key string `json:"key"`
		} `json:"regionInformation"`
		CFService struct {
			Name        string `json:"name"`
			Description string `json:"description"`
			Metadata    struct {
				DisplayName string `json:"displayName"`
			} `json:"metadata"`
			Plans []struct {
				TechnicalName string `json:"technicalName"`
				Name          string `json:"name"`
				Description   string `json:"description"`
				Metadata      struct {
				} `json:"metadata"`
			} `json:"plans"`
		} `json:"CFService"`
	} `json:"applicationCoordinates"`
}

type EntitlementAmount

type EntitlementAmount struct {
	EntitlementName string          `json:"entitlementName"`
	Amount          float64         `json:"amount"`
	ProductID       string          `json:"productId"`
	Restricted      bool            `json:"restricted"`
	CommercialModel CommercialModel `json:"commercialModel"`
	AutoAssign      bool            `json:"autoAssign"`
}

type Error

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

Error an error type containing the http response from API

func NewError

func NewError(body []byte, resp *http.Response) Error

NewError is a function to initialize the Error type. This function will be useful for unit testing and mocking purposes in the client side to test their behavior by the API response.

func (Error) Body

func (e Error) Body() io.ReadCloser

Body is the Body of the HTTP response

func (Error) Error

func (e Error) Error() string

Error the error string for this error

func (Error) Headers

func (e Error) Headers() http.Header

Headers the HTTP headers returned from API

func (Error) Status

func (e Error) Status() int

Status the HTTP status code returned from API

type GlobalAccount

type GlobalAccount struct {
	GUID             string       `json:"guid,omitempty"`
	DisplayName      string       `json:"displayName,omitempty"`
	CreatedDate      int64        `json:"createdDate,omitempty"`
	ModifiedDate     int64        `json:"modifiedDate,omitempty"`
	EntityState      string       `json:"entityState,omitempty"`
	StateMessage     string       `json:"stateMessage,omitempty"`
	Subdomain        string       `json:"subdomain,omitempty"`
	ContractStatus   string       `json:"contractStatus,omitempty"`
	CommercialModel  string       `json:"commercialModel,omitempty"`
	ConsumptionBased bool         `json:"consumptionBased,omitempty"`
	LicenseType      string       `json:"licenseType,omitempty"`
	GeoAccess        string       `json:"geoAccess,omitempty"`
	RenewalDate      int64        `json:"renewalDate,omitempty"`
	Subaccounts      []Subaccount `json:"subaccounts"`
}

type OptionsError

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

OptionsError is an error type for invalid option argument.

func (*OptionsError) Error

func (e *OptionsError) Error() string

type ServicePlan

type ServicePlan struct {
	Name                      string              `json:"name"`
	DisplayName               string              `json:"displayName"`
	Description               string              `json:"description"`
	UniqueIdentifier          string              `json:"uniqueIdentifier"`
	ProvisioningMethod        string              `json:"provisioningMethod"`
	Amount                    float64             `json:"amount"`
	RemainingAmount           float64             `json:"remainingAmount"`
	ProvidedBy                string              `json:"providedBy"`
	Beta                      bool                `json:"beta"`
	AvailableForInternal      bool                `json:"availableForInternal"`
	InternalQuotaLimit        int32               `json:"internalQuotaLimit"`
	AutoAssign                bool                `json:"autoAssign"`
	AutoDistributeAmount      int32               `json:"autoDistributeAmount"`
	MaxAllowedSubaccountQuota int32               `json:"maxAllowedSubaccountQuota"`
	Category                  string              `json:"category"`
	SourceEntitlements        []EntitlementAmount `json:"sourceEntitlements"`
	DataCenters               []DataCenter        `json:"dataCenters"`
	Unlimited                 bool                `json:"unlimited"`
}

type Subaccount

type Subaccount struct {
	GUID              string           `json:"guid"`
	TechnicalName     string           `json:"technicalName"`
	DisplayName       string           `json:"displayName"`
	GlobalAccountGUID string           `json:"globalAccountGUID"`
	ParentGUID        string           `json:"parentGUID"`
	ParentType        string           `json:"parentType"`
	ParentFeatures    []string         `json:"parentFeatures"`
	Region            string           `json:"region"`
	Subdomain         string           `json:"subdomain"`
	BetaEnabled       bool             `json:"betaEnabled"`
	UsedForProduction string           `json:"usedForProduction"`
	Description       string           `json:"description"`
	State             string           `json:"state"`
	StateMessage      string           `json:"stateMessage"`
	CreatedDate       int64            `json:"createdDate"`
	CreatedBy         string           `json:"createdBy"`
	ModifiedDate      int64            `json:"modifiedDate"`
	CustomProperties  []CustomProperty `json:"customProperties"`
}

type TokenResponse added in v0.1.0

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	IDToken      string `json:"id_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"`
	Scope        string `json:"scope"`
	JTI          string `json:"jti"`
}

Jump to

Keyboard shortcuts

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