btp

package
v1.497.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJSON

func GetJSON(value string) (string, error)

Types

type BTPCommandBuilder

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

func NewBTPCommandBuilder

func NewBTPCommandBuilder() *BTPCommandBuilder

Initialize a new builder

func (*BTPCommandBuilder) Build

func (b *BTPCommandBuilder) Build() ([]string, error)

Build the final command string

func (*BTPCommandBuilder) Reset

Rest builder

func (*BTPCommandBuilder) SetConfirm

func (b *BTPCommandBuilder) SetConfirm(value bool) *BTPCommandBuilder

Specific method for --confirm parameter

func (*BTPCommandBuilder) SetShowParameters

func (b *BTPCommandBuilder) SetShowParameters(value bool) *BTPCommandBuilder

Specific method for --show-parameters parameter

func (*BTPCommandBuilder) WithAction

func (b *BTPCommandBuilder) WithAction(action string) *BTPCommandBuilder

Method to set action

func (*BTPCommandBuilder) WithBindingName

func (b *BTPCommandBuilder) WithBindingName(name string) *BTPCommandBuilder

Specific method for --binding parameter

func (*BTPCommandBuilder) WithConfirm

func (b *BTPCommandBuilder) WithConfirm() *BTPCommandBuilder

func (*BTPCommandBuilder) WithDataCenter

func (b *BTPCommandBuilder) WithDataCenter(name string) *BTPCommandBuilder

Specific method for --data-center parameter

func (*BTPCommandBuilder) WithFieldsFilter

func (b *BTPCommandBuilder) WithFieldsFilter(query string) *BTPCommandBuilder

Specific method for --fields-filter parameter

func (*BTPCommandBuilder) WithFormat

func (b *BTPCommandBuilder) WithFormat(format string) *BTPCommandBuilder

Method to set format of response

func (*BTPCommandBuilder) WithID

Specific method for --id parameter

func (*BTPCommandBuilder) WithIdentityProvider added in v1.495.0

func (b *BTPCommandBuilder) WithIdentityProvider(idProvider string) *BTPCommandBuilder

Specific method for --idp parameter

func (*BTPCommandBuilder) WithLabels

func (b *BTPCommandBuilder) WithLabels(json string) *BTPCommandBuilder

Specific method for --labels parameter

func (*BTPCommandBuilder) WithLabelsFilter

func (b *BTPCommandBuilder) WithLabelsFilter(query string) *BTPCommandBuilder

Specific method for --labels-filter parameter

func (*BTPCommandBuilder) WithName

func (b *BTPCommandBuilder) WithName(name string) *BTPCommandBuilder

Specific method for --name parameter

func (*BTPCommandBuilder) WithOfferingName

func (b *BTPCommandBuilder) WithOfferingName(name string) *BTPCommandBuilder

Specific method for --offering-name parameter

func (*BTPCommandBuilder) WithOption

func (b *BTPCommandBuilder) WithOption(option string) *BTPCommandBuilder

General method to add an option

func (*BTPCommandBuilder) WithParam

func (b *BTPCommandBuilder) WithParam(param string) *BTPCommandBuilder

Method to add additional parameters

func (*BTPCommandBuilder) WithParameters

func (b *BTPCommandBuilder) WithParameters(json string) *BTPCommandBuilder

Specific method for --offering-name parameter

func (*BTPCommandBuilder) WithPassword

func (b *BTPCommandBuilder) WithPassword(password string) *BTPCommandBuilder

Specific method for --password parameter

func (*BTPCommandBuilder) WithPlanID

func (b *BTPCommandBuilder) WithPlanID(id string) *BTPCommandBuilder

Specific method for --plan parameter

func (*BTPCommandBuilder) WithPlanName

func (b *BTPCommandBuilder) WithPlanName(name string) *BTPCommandBuilder

Specific method for --plan-name parameter

func (*BTPCommandBuilder) WithService

func (b *BTPCommandBuilder) WithService(name string) *BTPCommandBuilder

Specific method for --service parameter

func (*BTPCommandBuilder) WithServiceInstanceID

func (b *BTPCommandBuilder) WithServiceInstanceID(id string) *BTPCommandBuilder

Specific method for --instance-name parameter

func (*BTPCommandBuilder) WithServiceInstanceName

func (b *BTPCommandBuilder) WithServiceInstanceName(name string) *BTPCommandBuilder

Specific method for --instance-name parameter

func (*BTPCommandBuilder) WithSubAccount

func (b *BTPCommandBuilder) WithSubAccount(subaccount string) *BTPCommandBuilder

Specific method for --subaccount parameter

func (*BTPCommandBuilder) WithSubdomain

func (b *BTPCommandBuilder) WithSubdomain(globalAccount string) *BTPCommandBuilder

Specific method for --subdomain parameter

func (*BTPCommandBuilder) WithTarget

func (b *BTPCommandBuilder) WithTarget(target string) *BTPCommandBuilder

Method to set target (e.g., GROUP/OBJECT)

func (*BTPCommandBuilder) WithURL

func (b *BTPCommandBuilder) WithURL(url string) *BTPCommandBuilder

Specific method for --url parameter

func (*BTPCommandBuilder) WithUser

func (b *BTPCommandBuilder) WithUser(user string) *BTPCommandBuilder

Specific method for --user parameter

func (*BTPCommandBuilder) WithVerbose

func (b *BTPCommandBuilder) WithVerbose() *BTPCommandBuilder

Method to activate verbose mode

type BTPErrorData added in v1.495.0

type BTPErrorData struct {
	Error       string `json:"error"`
	Description string `json:"description"`
}

func GetErrorInfos added in v1.495.0

func GetErrorInfos(value string) (BTPErrorData, error)

type BTPUtils

type BTPUtils struct {
	Exec ExecRunner
}

func NewBTPUtils

func NewBTPUtils(exec ExecRunner) *BTPUtils

func (*BTPUtils) CreateServiceBinding

func (btp *BTPUtils) CreateServiceBinding(options CreateServiceBindingOptions) (string, error)

func (*BTPUtils) CreateServiceInstance

func (btp *BTPUtils) CreateServiceInstance(options CreateServiceInstanceOptions) (string, error)

func (*BTPUtils) DeleteServiceBinding

func (btp *BTPUtils) DeleteServiceBinding(options DeleteServiceBindingOptions) error

func (*BTPUtils) DeleteServiceInstance

func (btp *BTPUtils) DeleteServiceInstance(options DeleteServiceInstanceOptions) error

func (*BTPUtils) GetServiceBinding

func (btp *BTPUtils) GetServiceBinding(options GetServiceBindingOptions) (string, error)

func (*BTPUtils) GetServiceInstance

func (btp *BTPUtils) GetServiceInstance(options GetServiceInstanceOptions) (string, error)

func (*BTPUtils) Login

func (btp *BTPUtils) Login(options LoginOptions) error

func (*BTPUtils) Logout

func (btp *BTPUtils) Logout() error

func (*BTPUtils) RunGetServiceBinding added in v1.495.0

func (btp *BTPUtils) RunGetServiceBinding(options GetServiceBindingOptions) (string, error)

Actually runs the get service binding command and returns the result without login/logout

func (*BTPUtils) RunGetServiceInstance added in v1.495.0

func (btp *BTPUtils) RunGetServiceInstance(options GetServiceInstanceOptions) (string, error)

Actually runs the get service binding command and returns the result without login/logout

type BtpExecCall

type BtpExecCall struct {
	Exec   string
	Params []string
}

Stores information about executed commands.

type BtpExecutorMock

type BtpExecutorMock struct {
	Cmd                 command.Command
	Calls               []BtpExecCall
	StdoutReturn        map[string]string
	ShouldFailOnCommand map[string]error
	ExitCode            int
	// contains filtered or unexported fields
}

func (*BtpExecutorMock) GetStderrValue added in v1.495.0

func (b *BtpExecutorMock) GetStderrValue() string

func (*BtpExecutorMock) GetStdoutValue

func (b *BtpExecutorMock) GetStdoutValue() string

func (*BtpExecutorMock) Run

func (b *BtpExecutorMock) Run(cmdScript []string) (err error)

func (*BtpExecutorMock) RunSync

func (b *BtpExecutorMock) RunSync(opts RunSyncOptions) error

func (*BtpExecutorMock) Stderr added in v1.495.0

func (b *BtpExecutorMock) Stderr(errOut io.Writer)

func (*BtpExecutorMock) Stdin

func (b *BtpExecutorMock) Stdin(in io.Reader)

func (*BtpExecutorMock) Stdout

func (b *BtpExecutorMock) Stdout(out io.Writer)

type CheckResponse added in v1.495.0

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

func IsServiceBindingCreated

func IsServiceBindingCreated(btp *BTPUtils, options GetServiceBindingOptions) CheckResponse

func IsServiceBindingDeleted

func IsServiceBindingDeleted(btp *BTPUtils, options GetServiceBindingOptions) CheckResponse

func IsServiceInstanceCreated

func IsServiceInstanceCreated(btp *BTPUtils, options GetServiceInstanceOptions) CheckResponse

func IsServiceInstanceDeleted

func IsServiceInstanceDeleted(btp *BTPUtils, options GetServiceInstanceOptions) CheckResponse

type CreateServiceBindingOptions

type CreateServiceBindingOptions struct {
	Url              string
	Subdomain        string
	Subaccount       string
	ServiceInstance  string
	BindingName      string
	Parameters       string
	User             string
	Password         string
	IdentityProvider string
	Timeout          int
	PollInterval     int
	MaxRetries       int
	MaxBadRequests   int
}

type CreateServiceInstanceOptions

type CreateServiceInstanceOptions struct {
	Url              string
	Subdomain        string
	User             string
	Password         string
	IdentityProvider string
	Subaccount       string
	PlanName         string
	OfferingName     string
	InstanceName     string
	Parameters       string
	Timeout          int
	PollInterval     int
	MaxRetries       int
	MaxBadRequests   int
}

type DeleteServiceBindingOptions

type DeleteServiceBindingOptions struct {
	Url              string
	Subdomain        string
	Subaccount       string
	BindingName      string
	User             string
	Password         string
	IdentityProvider string
	Timeout          int
	PollInterval     int
	ServiceInstance  string
	MaxRetries       int
	MaxBadRequests   int
}

type DeleteServiceInstanceOptions

type DeleteServiceInstanceOptions struct {
	Url              string
	Subdomain        string
	User             string
	Password         string
	IdentityProvider string
	Subaccount       string
	InstanceName     string
	Timeout          int
	PollInterval     int
	MaxRetries       int
	MaxBadRequests   int
}

type ExecRunner

type ExecRunner interface {
	Run(cmdScript []string) error
	RunSync(opts RunSyncOptions) error
	// contains filtered or unexported methods
}

type Executor

type Executor struct {
	Cmd command.Command
}

func (*Executor) GetStderrValue added in v1.495.0

func (e *Executor) GetStderrValue() string

func (*Executor) GetStdoutValue

func (e *Executor) GetStdoutValue() string

func (*Executor) Run

func (e *Executor) Run(cmdScript []string) (err error)

func (*Executor) RunSync

func (e *Executor) RunSync(opts RunSyncOptions) error

@param timeout : in seconds @param pollInterval : in seconds @param negativeCheck : set to false if you want to check the negation of the response of `cmdCheck`

func (*Executor) Stderr added in v1.495.0

func (e *Executor) Stderr(stderr io.Writer)

Stderr ..

func (*Executor) Stdin

func (e *Executor) Stdin(stdin io.Reader)

Stdin ..

func (*Executor) Stdout

func (e *Executor) Stdout(stdout io.Writer)

Stdout ..

type GetServiceBindingOptions

type GetServiceBindingOptions struct {
	Url               string
	Subdomain         string
	Subaccount        string
	BindingName       string
	User              string
	Password          string
	IdentityProvider  string
	BindingId         string
	ServiceInstance   string
	ServiceInstanceId string
}

type GetServiceInstanceOptions

type GetServiceInstanceOptions struct {
	Url              string
	Subdomain        string
	User             string
	Password         string
	IdentityProvider string
	Subaccount       string
	InstanceName     string
	InstanceId       string
}

type LoginOptions

type LoginOptions struct {
	Url              string
	Subdomain        string
	User             string
	Password         string
	IdentityProvider string
	Silent           bool
}

type RunSyncOptions

type RunSyncOptions struct {
	CmdScript              []string
	TimeoutSeconds         int
	PollInterval           int
	LoginFunc              func() error
	CheckFunc              func() CheckResponse // Function to check the command status
	IgnoreErrorOnFirstCall bool                 // Whether to ignore error on the first call before polling
	// contains filtered or unexported fields
}

type ServiceBindingData

type ServiceBindingData struct {
	ID            string `json:"id"`
	Ready         bool   `json:"ready"`
	LastOperation struct {
		ID                  string    `json:"id"`
		Ready               bool      `json:"ready"`
		Type                string    `json:"type"`
		State               string    `json:"state"`
		ResourceID          string    `json:"resource_id"`
		ResourceType        string    `json:"resource_type"`
		PlatformID          string    `json:"platform_id"`
		CorrelationID       string    `json:"correlation_id"`
		Reschedule          bool      `json:"reschedule"`
		RescheduleTimestamp time.Time `json:"reschedule_timestamp"`
		DeletionScheduled   time.Time `json:"deletion_scheduled"`
		CreatedAt           time.Time `json:"created_at"`
		UpdatedAt           time.Time `json:"updated_at"`
	} `json:"last_operation"`
	Name              string `json:"name"`
	ServiceInstanceID string `json:"service_instance_id"`
	Context           struct {
		Origin            string `json:"origin"`
		Region            string `json:"region"`
		ZoneID            string `json:"zone_id"`
		EnvType           string `json:"env_type"`
		Platform          string `json:"platform"`
		Subdomain         string `json:"subdomain"`
		LicenseType       string `json:"license_type"`
		InstanceName      string `json:"instance_name"`
		SubaccountID      string `json:"subaccount_id"`
		CrmCustomerID     string `json:"crm_customer_id"`
		GlobalAccountID   string `json:"global_account_id"`
		ServiceInstanceID string `json:"service_instance_id"`
	} `json:"context"`
	Credentials struct {
		Abap struct {
			CommunicationArrangementID       string `json:"communication_arrangement_id"`
			CommunicationInboundUserAuthMode string `json:"communication_inbound_user_auth_mode"`
			CommunicationInboundUserID       string `json:"communication_inbound_user_id"`
			CommunicationScenarioID          string `json:"communication_scenario_id"`
			CommunicationSystemID            string `json:"communication_system_id"`
			CommunicationType                string `json:"communication_type"`
			Password                         string `json:"password"`
			Username                         string `json:"username"`
		} `json:"abap"`
		Binding struct {
			Env     string `json:"env"`
			ID      string `json:"id"`
			Type    string `json:"type"`
			Version string `json:"version"`
		} `json:"binding"`
		PreserveHostHeader bool   `json:"preserve_host_header"`
		SapCloudService    string `json:"sap.cloud.service"`
		Systemid           string `json:"systemid"`
		URL                string `json:"url"`
	} `json:"credentials"`
	SubaccountID string    `json:"subaccount_id"`
	CreatedBy    string    `json:"created_by"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	Labels       string    `json:"labels"`
}

func GetServiceBindingData added in v1.495.0

func GetServiceBindingData(btp *BTPUtils, options GetServiceBindingOptions) (ServiceBindingData, error)

type ServiceInstanceData

type ServiceInstanceData struct {
	ID            string `json:"id"`
	Ready         bool   `json:"ready"`
	LastOperation struct {
		ID                  string    `json:"id"`
		Ready               bool      `json:"ready"`
		Description         string    `json:"description"`
		Type                string    `json:"type"`
		State               string    `json:"state"`
		ResourceID          string    `json:"resource_id"`
		ResourceType        string    `json:"resource_type"`
		PlatformID          string    `json:"platform_id"`
		CorrelationID       string    `json:"correlation_id"`
		Reschedule          bool      `json:"reschedule"`
		RescheduleTimestamp time.Time `json:"reschedule_timestamp"`
		DeletionScheduled   time.Time `json:"deletion_scheduled"`
		CreatedAt           time.Time `json:"created_at"`
		UpdatedAt           time.Time `json:"updated_at"`
	} `json:"last_operation"`
	Name          string `json:"name"`
	ServicePlanID string `json:"service_plan_id"`
	PlatformID    string `json:"platform_id"`
	DashboardURL  string `json:"dashboard_url"`
	Context       struct {
		Origin          string `json:"origin"`
		Region          string `json:"region"`
		ZoneID          string `json:"zone_id"`
		EnvType         string `json:"env_type"`
		Platform        string `json:"platform"`
		Subdomain       string `json:"subdomain"`
		LicenseType     string `json:"license_type"`
		InstanceName    string `json:"instance_name"`
		SubaccountID    string `json:"subaccount_id"`
		CrmCustomerID   string `json:"crm_customer_id"`
		GlobalAccountID string `json:"global_account_id"`
	} `json:"context"`
	Usable       bool        `json:"usable"`
	SubaccountID string      `json:"subaccount_id"`
	Protected    interface{} `json:"protected"`
	CreatedBy    string      `json:"created_by"`
	CreatedAt    time.Time   `json:"created_at"`
	UpdatedAt    time.Time   `json:"updated_at"`
	Labels       string      `json:"labels"`
}

func GetServiceInstanceData added in v1.495.0

func GetServiceInstanceData(btp *BTPUtils, options GetServiceInstanceOptions) (ServiceInstanceData, error)

Jump to

Keyboard shortcuts

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