abaputils

package
v1.217.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAddonDescriptorForRepositories added in v1.92.0

func CheckAddonDescriptorForRepositories(addonDescriptor AddonDescriptor) error

CheckAddonDescriptorForRepositories checks AddonDescriptor struct if it contains any repositories. If not it will return an error

func ConvertTime added in v1.65.0

func ConvertTime(logTimeStamp string) time.Time

ConvertTime formats an ABAP timestamp string from format /Date(1585576807000+0000)/ into a UNIX timestamp and returns it

func GetHTTPResponse added in v1.65.0

func GetHTTPResponse(requestType string, connectionDetails ConnectionDetailsHTTP, body []byte, client piperhttp.Sender) (*http.Response, error)

GetHTTPResponse wraps the SendRequest function of piperhttp

func HandleHTTPError added in v1.65.0

func HandleHTTPError(resp *http.Response, err error, message string, connectionDetails ConnectionDetailsHTTP) error

HandleHTTPError handles ABAP error messages which can occur when using OData services

The point of this function is to enrich the error received from a HTTP Request (which is passed as a parameter to this function). Further error details may be present in the response body of the HTTP response. If the response body is parseable, the included details are wrapped around the original error from the HTTP repsponse. If this is not possible, the original error is returned.

func PollEntity added in v1.65.0

func PollEntity(repositoryName string, connectionDetails ConnectionDetailsHTTP, client piperhttp.Sender, pollIntervall time.Duration) (string, error)

PollEntity periodically polls the pull/import entity to get the status. Check if the import is still running

func PrintLegacyLogs added in v1.197.0

func PrintLegacyLogs(repositoryName string, connectionDetails ConnectionDetailsHTTP, client piperhttp.Sender, errorOnSystem bool)

PrintLegacyLogs sorts and formats the received transport and execution log of an import; Deprecated with SAP BTP, ABAP Environment release 2205

func PrintLogs added in v1.65.0

func PrintLogs(repositoryName string, connectionDetails ConnectionDetailsHTTP, client piperhttp.Sender)

func ReadConfigFile added in v1.190.0

func ReadConfigFile(path string) (file []byte, err error)

ReadCOnfigFile reads a file from a specific path and returns the json string as []byte

Types

type AUtilsMock added in v1.64.0

type AUtilsMock struct {
	ReturnedConnectionDetailsHTTP ConnectionDetailsHTTP
	ReturnedError                 error
}

AUtilsMock mock

func (*AUtilsMock) Cleanup added in v1.64.0

func (autils *AUtilsMock) Cleanup()

Cleanup to reset AUtilsMock

func (*AUtilsMock) GetAbapCommunicationArrangementInfo added in v1.64.0

func (autils *AUtilsMock) GetAbapCommunicationArrangementInfo(options AbapEnvironmentOptions, oDataURL string) (ConnectionDetailsHTTP, error)

GetAbapCommunicationArrangementInfo mock

func (*AUtilsMock) GetPollIntervall added in v1.67.0

func (autils *AUtilsMock) GetPollIntervall() time.Duration

GetPollIntervall mock

type AbapBinding

type AbapBinding struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Version string `json:"version"`
	Env     string `json:"env"`
}

AbapBinding contains information about service binding in Cloud Foundry

type AbapConnection

type AbapConnection struct {
	Username                         string `json:"username"`
	Password                         string `json:"password"`
	CommunicationScenarioID          string `json:"communication_scenario_id"`
	CommunicationArrangementID       string `json:"communication_arrangement_id"`
	CommunicationSystemID            string `json:"communication_system_id"`
	CommunicationInboundUserID       string `json:"communication_inbound_user_id"`
	CommunicationInboundUserAuthMode string `json:"communication_inbound_user_auth_mode"`
}

AbapConnection contains information about the ABAP connection for the ABAP endpoint

type AbapEnvironmentCheckoutBranchOptions added in v1.65.0

type AbapEnvironmentCheckoutBranchOptions struct {
	AbapEnvOptions AbapEnvironmentOptions
	RepositoryName string `json:"repositoryName,omitempty"`
}

AbapEnvironmentCheckoutBranchOptions struct for the CheckoutBranch piper step

type AbapEnvironmentOptions

type AbapEnvironmentOptions struct {
	Username          string `json:"username,omitempty"`
	Password          string `json:"password,omitempty"`
	Host              string `json:"host,omitempty"`
	CfAPIEndpoint     string `json:"cfApiEndpoint,omitempty"`
	CfOrg             string `json:"cfOrg,omitempty"`
	CfSpace           string `json:"cfSpace,omitempty"`
	CfServiceInstance string `json:"cfServiceInstance,omitempty"`
	CfServiceKeyName  string `json:"cfServiceKeyName,omitempty"`
}

AbapEnvironmentOptions contains cloud foundry fields and the host parameter for connections to ABAP Environment instances

type AbapEnvironmentPullGitRepoOptions

type AbapEnvironmentPullGitRepoOptions struct {
	AbapEnvOptions  AbapEnvironmentOptions
	RepositoryNames []string `json:"repositoryNames,omitempty"`
}

AbapEnvironmentPullGitRepoOptions struct for the PullGitRepo piper step

type AbapEnvironmentRunATCCheckOptions

type AbapEnvironmentRunATCCheckOptions struct {
	AbapEnvOptions AbapEnvironmentOptions
	AtcConfig      string `json:"atcConfig,omitempty"`
}

AbapEnvironmentRunATCCheckOptions struct for the RunATCCheck piper step

type AbapError

type AbapError struct {
	Code    string           `json:"code"`
	Message AbapErrorMessage `json:"message"`
}

AbapError contains the error code and the error message for ABAP errors

type AbapErrorMessage

type AbapErrorMessage struct {
	Lang  string `json:"lang"`
	Value string `json:"value"`
}

AbapErrorMessage contains the lanuage and value fields for ABAP errors

type AbapLogs

type AbapLogs struct {
	Results []LogResults `json:"results"`
}

AbapLogs struct for ABAP logs

type AbapLogsV2 added in v1.197.0

type AbapLogsV2 struct {
	Results []LogResultsV2 `json:"results"`
}

type AbapMetadata

type AbapMetadata struct {
	URI string `json:"uri"`
}

AbapMetadata contains the URI of metadata files

type AbapServiceKey

type AbapServiceKey struct {
	SapCloudService    string         `json:"sap.cloud.service"`
	URL                string         `json:"url"`
	SystemID           string         `json:"systemid"`
	Abap               AbapConnection `json:"abap"`
	Binding            AbapBinding    `json:"binding"`
	PreserveHostHeader bool           `json:"preserve_host_header"`
}

AbapServiceKey contains information about an ABAP service key

func ReadServiceKeyAbapEnvironment

func ReadServiceKeyAbapEnvironment(options AbapEnvironmentOptions, c command.ExecRunner) (AbapServiceKey, error)

ReadServiceKeyAbapEnvironment from Cloud Foundry and returns it. Depending on user/developer requirements if he wants to perform further Cloud Foundry actions

type AbapUtils added in v1.64.0

type AbapUtils struct {
	Exec      command.ExecRunner
	Intervall time.Duration
}

AbapUtils Struct

func (*AbapUtils) GetAbapCommunicationArrangementInfo added in v1.64.0

func (abaputils *AbapUtils) GetAbapCommunicationArrangementInfo(options AbapEnvironmentOptions, oDataURL string) (ConnectionDetailsHTTP, error)

GetAbapCommunicationArrangementInfo function fetches the communcation arrangement information in SAP CP ABAP Environment

func (*AbapUtils) GetPollIntervall added in v1.67.0

func (abaputils *AbapUtils) GetPollIntervall() time.Duration

GetPollIntervall returns the specified intervall from AbapUtils or a default value of 10 seconds

type AddonDescriptor added in v1.71.0

type AddonDescriptor struct {
	AddonProduct     string `json:"addonProduct"`
	AddonVersionYAML string `json:"addonVersion"`
	AddonVersion     string `json:"addonVersionAAK"`
	AddonSpsLevel    string
	AddonPatchLevel  string
	TargetVectorID   string
	Repositories     []Repository `json:"repositories"`
}

AddonDescriptor contains fields about the addonProduct

func ConstructAddonDescriptorFromJSON added in v1.88.0

func ConstructAddonDescriptorFromJSON(JSON []byte) (AddonDescriptor, error)

ConstructAddonDescriptorFromJSON : Create new AddonDescriptor filled with data from JSON

func ReadAddonDescriptor added in v1.71.0

func ReadAddonDescriptor(FileName string) (AddonDescriptor, error)

ReadAddonDescriptor parses AddonDescriptor YAML file

func (*AddonDescriptor) AsJSON added in v1.88.0

func (me *AddonDescriptor) AsJSON() []byte

AsJSON : dito

func (*AddonDescriptor) AsJSONstring added in v1.177.0

func (me *AddonDescriptor) AsJSONstring() string

AsJSONstring : dito

func (*AddonDescriptor) GetRepositoriesInBuildScope added in v1.176.0

func (me *AddonDescriptor) GetRepositoriesInBuildScope() []Repository

func (*AddonDescriptor) InitFromJSONstring added in v1.177.0

func (me *AddonDescriptor) InitFromJSONstring(JSONstring string) error

initFromJSON : Init from json string

func (*AddonDescriptor) SetRepositories added in v1.88.0

func (me *AddonDescriptor) SetRepositories(Repositories []Repository)

SetRepositories : dito

type BranchEntity

type BranchEntity struct {
	Metadata      AbapMetadata `json:"__metadata"`
	ScName        string       `json:"sc_name"`
	Namespace     string       `json:"namepsace"`
	BranchName    string       `json:"branch_name"`
	ParentBranch  string       `json:"derived_from"`
	CreatedBy     string       `json:"created_by"`
	CreatedOn     string       `json:"created_on"`
	IsActive      bool         `json:"is_active"`
	CommitID      string       `json:"commit_id"`
	CommitMessage string       `json:"commit_message"`
	LastCommitBy  string       `json:"last_commit_by"`
	LastCommitOn  string       `json:"last_commit_on"`
}

BranchEntity struct for the Branch entity A4C_A2G_GHA_SC_BRANCH

type ClientMock added in v1.65.0

type ClientMock struct {
	Token      string
	Body       string
	BodyList   []string
	StatusCode int
	Error      error
}

ClientMock contains information about the client mock

func (*ClientMock) DownloadFile added in v1.177.0

func (c *ClientMock) DownloadFile(url, filename string, header http.Header, cookies []*http.Cookie) error

DownloadFile : Empty file download

func (*ClientMock) SendRequest added in v1.65.0

func (c *ClientMock) SendRequest(method, url string, bdy io.Reader, hdr http.Header, cookies []*http.Cookie) (*http.Response, error)

SendRequest sets a HTTP response for a client mock

func (*ClientMock) SetOptions added in v1.65.0

func (c *ClientMock) SetOptions(opts piperhttp.ClientOptions)

SetOptions sets clientOptions for a client mock

type CloneEntity added in v1.74.0

type CloneEntity struct {
	Metadata          AbapMetadata `json:"__metadata"`
	UUID              string       `json:"uuid"`
	ScName            string       `json:"sc_name"`
	BranchName        string       `json:"branch_name"`
	ImportType        string       `json:"import_type"`
	Namespace         string       `json:"namepsace"`
	Status            string       `json:"status"`
	StatusDescription string       `json:"status_descr"`
	StartedByUser     string       `json:"user_name"`
	StartTime         string       `json:"start_time"`
	ChangeTime        string       `json:"change_time"`
}

CloneEntity struct for the Clone entity A4C_A2G_GHA_SC_CLONE

type Communication added in v1.64.0

type Communication interface {
	GetAbapCommunicationArrangementInfo(options AbapEnvironmentOptions, oDataURL string) (ConnectionDetailsHTTP, error)
	GetPollIntervall() time.Duration
}

Communication for defining function used for communication

type ConnectionDetailsHTTP

type ConnectionDetailsHTTP struct {
	Host       string
	User       string `json:"user"`
	Password   string `json:"password"`
	URL        string `json:"url"`
	XCsrfToken string `json:"xcsrftoken"`
}

ConnectionDetailsHTTP contains fields for HTTP connections including the XCSRF token

type EntitySetsForManageGitRepository added in v1.197.0

type EntitySetsForManageGitRepository struct {
	EntitySets []string `json:"EntitySets"`
}

type LogProtocol added in v1.197.0

type LogProtocol struct {
	Metadata      AbapMetadata `json:"__metadata"`
	OverviewIndex int          `json:"log_index"`
	ProtocolLine  int          `json:"index_no"`
	Type          string       `json:"type"`
	Description   string       `json:"descr"`
}

type LogProtocolResults added in v1.197.0

type LogProtocolResults struct {
	Results []LogProtocol `json:"results"`
}

type LogResults

type LogResults struct {
	Index       string `json:"index_no"`
	Type        string `json:"type"`
	Description string `json:"descr"`
	Timestamp   string `json:"timestamp"`
}

LogResults struct for Execution and Transport Log entities A4C_A2G_GHA_SC_LOG_EXE and A4C_A2G_GHA_SC_LOG_TP

type LogResultsV2 added in v1.197.0

type LogResultsV2 struct {
	Metadata      AbapMetadata       `json:"__metadata"`
	Index         int                `json:"log_index"`
	Name          string             `json:"log_name"`
	Status        string             `json:"type_of_found_issues"`
	Timestamp     string             `json:"timestamp"`
	ToLogProtocol LogProtocolResults `json:"to_Log_Protocol"`
}

type PullEntity

type PullEntity struct {
	Metadata          AbapMetadata `json:"__metadata"`
	UUID              string       `json:"uuid"`
	Namespace         string       `json:"namepsace"`
	ScName            string       `json:"sc_name"`
	ImportType        string       `json:"import_type"`
	BranchName        string       `json:"branch_name"`
	StartedByUser     string       `json:"user_name"`
	Status            string       `json:"status"`
	StatusDescription string       `json:"status_descr"`
	CommitID          string       `json:"commit_id"`
	StartTime         string       `json:"start_time"`
	ChangeTime        string       `json:"change_time"`
	ToExecutionLog    AbapLogs     `json:"to_Execution_log"`
	ToTransportLog    AbapLogs     `json:"to_Transport_log"`
	ToLogOverview     AbapLogsV2   `json:"to_Log_Overview"`
}

PullEntity struct for the Pull/Import entity A4C_A2G_GHA_SC_IMP

func GetPullStatus added in v1.197.0

func GetPullStatus(repositoryName string, connectionDetails ConnectionDetailsHTTP, client piperhttp.Sender) (body PullEntity, status string, err error)

type ReadAddonDescriptorType added in v1.85.0

type ReadAddonDescriptorType func(FileName string) (AddonDescriptor, error)

ReadAddonDescriptorType is the type for ReadAddonDescriptor for mocking

type RepositoriesConfig added in v1.92.0

type RepositoriesConfig struct {
	BranchName      string
	RepositoryName  string
	RepositoryNames []string
	Repositories    string
}

RepositoriesConfig struct for parsing one or multiple branches and repositories configurations

type Repository added in v1.72.0

type Repository struct {
	Name                string `json:"name"`
	UseClassicCTS       bool   `json:"useClassicCTS"`
	Tag                 string `json:"tag"`
	Branch              string `json:"branch"`
	CommitID            string `json:"commitID"`
	VersionYAML         string `json:"version"`
	Version             string `json:"versionAAK"`
	AdditionalPiecelist string `json:"additionalPiecelist"`
	PackageName         string
	PackageType         string
	SpLevel             string
	PatchLevel          string
	PredecessorCommitID string
	Status              string
	Namespace           string
	SarXMLFilePath      string
	Languages           []string `json:"languages"`
	InBuildScope        bool
}

Repository contains fields for the repository/component version

func GetRepositories added in v1.92.0

func GetRepositories(config *RepositoriesConfig) ([]Repository, error)

GetRepositories for parsing one or multiple branches and repositories from repositories file or branchName and repositoryName configuration

func (*Repository) GetAakAasLanguageVector added in v1.131.0

func (me *Repository) GetAakAasLanguageVector() string

GetAakAasLanguageVector : dito

func (*Repository) GetCloneLogString added in v1.187.0

func (repo *Repository) GetCloneLogString() (logString string)

func (*Repository) GetCloneRequestBody added in v1.187.0

func (repo *Repository) GetCloneRequestBody() (body string)

func (*Repository) GetLogStringForCommitOrTag added in v1.187.0

func (repo *Repository) GetLogStringForCommitOrTag() (logString string)

func (*Repository) GetPullLogString added in v1.187.0

func (repo *Repository) GetPullLogString() (logString string)

func (*Repository) GetPullRequestBody added in v1.187.0

func (repo *Repository) GetPullRequestBody() (body string)

func (*Repository) GetRequestBodyForCommitOrTag added in v1.187.0

func (repo *Repository) GetRequestBodyForCommitOrTag() (requestBodyString string)

Jump to

Keyboard shortcuts

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