models

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceIdentifierValueIDSeparator = ";;;"
	FileDataFormat                   = "data:%s;base64,%s"
)
View Source
const (
	URLIDSeparator = ";;;;"
)

Variables

This section is empty.

Functions

func FileExtensionToMimeType added in v1.1.1

func FileExtensionToMimeType(extension string) string

FileExtensionToMimeType returns the MIME type for a given file extension if the extension is not recognized, it returns "application/octet-stream" - a generic binary file MIME type the function is used to set the MIME type for the certificate type in the MTLSSchema the certificate types that are allowed displayed in the web-api-asset.go file

func MimeTypeToFileExtension added in v1.1.1

func MimeTypeToFileExtension(mimeType string) string

MimeTypeToFileExtension returns the file extension for a given MIME type the function is used to set the certificate type in the MTLSSchema

Types

type AddPracticeMode

type AddPracticeMode struct {
	Mode        string `json:"mode"`
	SubPractice string `json:"subPractice,omitempty"`
}

AddPracticeMode represents the api input for adding a practice mode (sub practice) in a practice to add to an existing WebAPIAsset object

type AddPracticeWrapper

type AddPracticeWrapper struct {
	PracticeID       string            `json:"practiceId"`
	MainMode         string            `json:"mainMode"`
	SubPracticeModes []AddPracticeMode `json:"subPracticeModes,omitempty"`
	Triggers         []string          `json:"triggers,omitempty"`
}

AddPracticeWrapper represents the input for adding a practiceWrapper field to an existing WebAPIAseet object

type AddProxySetting

type AddProxySetting struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

AddProxySetting represents the input for adding a proxy setting field to an existing WebAPIAseet object

type AddSourceIdentifier

type AddSourceIdentifier struct {
	SourceIdentifier string   `json:"sourceIdentifier"`
	Values           []string `json:"values"`
}

AddSourceIdentifier represents the input for adding a source identifier field to an existing WebAPIAsset object

type AddTag added in v1.1.1

type AddTag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

AddTag represent the input for adding a tag field to an existing WebApplicationAsset object

type AddTags added in v1.1.1

type AddTags []AddTag

type Behavior

type Behavior struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Behaviors

type Behaviors []Behavior

func (Behaviors) ToSchema

func (behaviors Behaviors) ToSchema() []string

ToSchema returns a slice of behaviors IDs to be saved in the state file

type CreateWebAPIAssetInput

type CreateWebAPIAssetInput struct {
	Name              string                  `json:"name"`
	PracticeWrappers  PracticeWrappersInputs  `json:"practices,omitempty"`
	Profiles          []string                `json:"profiles,omitempty"`
	Behaviors         []string                `json:"behaviors,omitempty"`
	Tags              TagsInputs              `json:"tags,omitempty"`
	State             string                  `json:"state,omitempty"`
	ProxySettings     ProxySettingInputs      `json:"proxySetting,omitempty"`
	UpstreamURL       string                  `json:"upstreamURL,omitempty"`
	URLs              []string                `json:"URLs,omitempty"`
	SourceIdentifiers SourceIdentifiersInputs `json:"sourceIdentifiers,omitempty"`
	IsSharesURLs      bool                    `json:"isSharesURLs,omitempty"`
}

CreateWebAPIAssetInput represents the api input for creating a web API asset

type MTLSSchema added in v1.1.1

type MTLSSchema struct {
	FilenameID      string `json:"filename_id,omitempty"`
	Filename        string `json:"filename,omitempty"`
	CertificateType string `json:"certificate_type,omitempty"`
	DataID          string `json:"data_id,omitempty"`
	Data            string `json:"data"`
	Type            string `json:"type,omitempty"`
	EnableID        string `json:"enable_id,omitempty"`
	Enable          bool   `json:"enable,omitempty"`
}

MTLSSchema represents a field of web API asset as it is saved in the state file this structure is aligned with the input schema (see web-api-asset.go file)

func NewFileSchemaEncode added in v1.1.1

func NewFileSchemaEncode(filename, fileData, mTLSType, certificateType string, fileEnable bool) MTLSSchema

type MTLSSchemas added in v1.1.1

type MTLSSchemas []MTLSSchema

func (MTLSSchemas) ToIndicatorMap added in v1.1.1

func (mtlsInputs MTLSSchemas) ToIndicatorMap() map[string]MTLSSchema

type Practice

type Practice struct {
	ID string `json:"id"`
}

type PracticeMode

type PracticeMode struct {
	Mode        string `json:"mode"`
	SubPractice string `json:"subPractice,omitempty"`
}

type PracticeModeInput

type PracticeModeInput struct {
	Mode        string `json:"mode"`
	SubPractice string `json:"subPractice,omitempty"`
}

PracticeModeInput represents the api input for creating a practice mode field in the practice field of the web API asset

type PracticeWrapper

type PracticeWrapper struct {
	PracticeWrapperID string         `json:"id"`
	MainMode          string         `json:"mainMode,omitempty"`
	SubPracticeModes  []PracticeMode `json:"subPracticeModes,omitempty"`
	Triggers          []Trigger      `json:"triggers,omitempty"`
	Practice          Practice       `json:"practice"`
}

PracticeWrapper represents a PracticeWrapper object returned from mgmt

func (PracticeWrapper) ToSchema

func (practiceWrapper PracticeWrapper) ToSchema() SchemaPracticeWrapper

ToSchema converts a single PracticeWrapper as returned from the API to a single SchemaPracticeWrapper to be saved in the state file

type PracticeWrapperInput

type PracticeWrapperInput struct {
	PracticeWrapperID string              `json:"practiceWrapperId,omitempty"`
	PracticeID        string              `json:"practiceId"`
	MainMode          string              `json:"mainMode"`
	SubPracticeModes  []PracticeModeInput `json:"subPracticeModes,omitempty"`
	Triggers          []string            `json:"triggers,omitempty"`
	Behaviors         []string            `json:"behaviors,omitempty"`
}

PracticeWrapperInput represents the api input for creating a practice field in the web API asset

type PracticeWrappersInputs

type PracticeWrappersInputs []PracticeWrapperInput

type PracticesWrappers

type PracticesWrappers []PracticeWrapper

func (PracticesWrappers) ToSchema

func (wrappers PracticesWrappers) ToSchema() []SchemaPracticeWrapper

ToSchema converts the practices field as returned from the API to a slice of SchemaPracticeWrapper to be saved in the state file

type Profile

type Profile struct {
	ID string `json:"id"`
}

Profile represents a profileId associated with the web API asset

type Profiles

type Profiles []Profile

func (Profiles) ToSchema

func (profiles Profiles) ToSchema() []string

ToSchema returns a slice of profiles IDs to be saved in the state file

type ProxySetting

type ProxySetting struct {
	ID    string `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

ProxySetting represents a ProxySetting object returned from mgmt key and value fields are defined by the user id field is a unique uuid generated by mgmt

type ProxySettingInput

type ProxySettingInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	ID    string `json:"id,omitempty"`
}

ProxySettingInput represents the api input for creating a proxy setting field in the web API asset

type ProxySettingInputs

type ProxySettingInputs []ProxySettingInput

func (ProxySettingInputs) ToIndicatorsMap

func (inputs ProxySettingInputs) ToIndicatorsMap() map[string]ProxySettingInput

ToIndicatorsMap converts a ProxySettingInputs to a map from a proxy setting key to the proxy setting struct itself

type ProxySettings

type ProxySettings []ProxySetting

type SchemaPracticeMode

type SchemaPracticeMode struct {
	Mode        string `json:"mode"`
	SubPractice string `json:"sub_practice,omitempty"`
}

SchemaPracticeMode represents a PracticeMode field of a practice field of a web API asset as it is saved in the state file this structure is aligned with the input schema (see web-api-asset.go file)

type SchemaPracticeWrapper

type SchemaPracticeWrapper struct {
	PracticeWrapperID string            `json:"practice_wrapper_id"`
	PracticeID        string            `json:"id"`
	MainMode          string            `json:"main_mode,omitempty"`
	SubPracticeModes  map[string]string `json:"sub_practices_modes,omitempty"`
	Triggers          []string          `json:"triggers,omitempty"`
}

SchemaPracticeWrapper represents a field of web API asset as it is saved in the state file this structure is aligned with the input schema (see web-api-asset.go file)

type SchemaSourceIdentifier

type SchemaSourceIdentifier struct {
	ID               string   `json:"id,omitempty"`
	SourceIdentifier string   `json:"identifier"`
	Values           []string `json:"values"`
	ValuesIDs        []string `json:"values_ids"`
}

SchemaSourceIdentifier represents the SourceIdentifier field of a web APi asset as it is saved in the state file this structure is aligned with the input schema (see web-api-asset.go file)

type SchemaTag added in v1.1.1

type SchemaTag struct {
	ID    string `json:"id,omitempty"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

type SourceIdentifier

type SourceIdentifier struct {
	ID               string                  `json:"id"`
	SourceIdentifier string                  `json:"sourceIdentifier"`
	Values           []SourceIdentifierValue `json:"values"`
}

SourceIdentifier represents a SourceIdentifier object returned from mgmt sourceIdentifier field is defined by the user id field is a unique uuid generated by mgmt

func (SourceIdentifier) ToSchema

func (sourceIdentifier SourceIdentifier) ToSchema() SchemaSourceIdentifier

ToSchema converts a single SourceIdentifier as returned from the API to a single SchemaSourceIdentifier to be saved in the state file

type SourceIdentifierInput

type SourceIdentifierInput struct {
	SourceIdentifier string    `json:"sourceIdentifier"`
	Values           []string  `json:"values"`
	ValuesIDs        ValuesIDs `json:"valuesIDs,omitempty"`
	ID               string    `json:"id,omitempty"`
}

SourceIdentifierInput represents the api input for creating a source identifier field in the web API asset

type SourceIdentifierValue

type SourceIdentifierValue struct {
	ID              string `json:"id"`
	IdentifierValue string `json:"IdentifierValue"`
}

SourceIdentifierValue represents a SourceIdentifierValue object returned from mgmt IdentifierValue field is defined by the user id field is a unique uuid generated by mgmt

type SourceIdentifiers

type SourceIdentifiers []SourceIdentifier

func (SourceIdentifiers) ToSchema

func (sourceIdentifiers SourceIdentifiers) ToSchema() []SchemaSourceIdentifier

ToSchema converts the SourceIdentifiers field as returned from the API to a slice of SchemaSourceIdentifier to be saved in the state file

type SourceIdentifiersInputs

type SourceIdentifiersInputs []SourceIdentifierInput

func (SourceIdentifiersInputs) ToIndicatorsMap

func (inputs SourceIdentifiersInputs) ToIndicatorsMap() map[string]SourceIdentifierInput

ToIndicatorsMap converts a SourceIdentifiersInputs to a map from a source identifier field to the source identifier struct itself

type Tag added in v1.1.1

type Tag struct {
	ID    string `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

func (Tag) ToSchema added in v1.1.1

func (tag Tag) ToSchema() SchemaTag

type TagInput added in v1.1.1

type TagInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	ID    string `json:"ID,omitempty"`
}

type Tags added in v1.1.1

type Tags []Tag

func (Tags) ToSchema added in v1.1.1

func (tags Tags) ToSchema() []SchemaTag

type TagsInputs added in v1.1.1

type TagsInputs []TagInput

func (TagsInputs) ToIndicatorsMap added in v1.1.1

func (inputs TagsInputs) ToIndicatorsMap() map[string]TagInput

type Trigger

type Trigger struct {
	ID string `json:"id"`
}

type URL

type URL struct {
	ID  string `json:"id"`
	URL string `json:"URL"`
}

URL represents a URL object returned from mgmt url field is defined by the user id field is a unique uuid generated by mgmt

type URLs

type URLs []URL

func (URLs) ToSchema

func (urls URLs) ToSchema() ([]string, []string)

ToSchema converts the URLs as returned from the APi to 2 slices of strings to be saved in the state file: 1. IDs slice 2. URLs slice

type UpdateProxySetting

type UpdateProxySetting struct {
	ID    string `json:"id"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

UpdateProxySetting represents the input for updating an existing proxy setting field of an existing WebAPIAsset object

type UpdateSourceIdentifier

type UpdateSourceIdentifier struct {
	ID               string                        `json:"id"`
	SourceIdentifier string                        `json:"sourceIdentifier"`
	AddValues        []string                      `json:"addValues"`
	RemoveValues     []string                      `json:"removeValues"`
	UpdateValues     []UpdateSourceIdentifierValue `json:"updateValues"`
}

UpdateSourceIdentifier represents the input for updating an existing proxy setting field of an existing WebAPIAsset object

type UpdateSourceIdentifierValue

type UpdateSourceIdentifierValue struct {
	ID              string `json:"id"`
	IdentifierValue string `json:"identifierValue"`
}

UpdateSourceIdentifierValue represents the input for updating an existing source identifier value in a source identifier field of an existing WebAPIAsset object

type UpdateSourceIdentifiers added in v1.1.1

type UpdateSourceIdentifiers []UpdateSourceIdentifier

func (UpdateSourceIdentifiers) ToIndicatorsMap added in v1.1.1

func (updates UpdateSourceIdentifiers) ToIndicatorsMap() map[string]UpdateSourceIdentifier

type UpdateURL

type UpdateURL struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

UpdateURL represents the input for updating an existing url field of an existing WebAPIAsset object

type UpdateWebAPIAssetInput

type UpdateWebAPIAssetInput struct {
	Name                    string                  `json:"name,omitempty"`
	AddPracticeWrappers     []AddPracticeWrapper    `json:"addPractices,omitempty"`
	RemovePracticeWrappers  []string                `json:"removePractices,omitempty"`
	AddProfiles             []string                `json:"addProfiles,omitempty"`
	RemoveProfiles          []string                `json:"removeProfiles,omitempty"`
	AddBehaviors            []string                `json:"addBehaviors,omitempty"`
	RemoveBehaviors         []string                `json:"removeBehaviors,omitempty"`
	AddTags                 AddTags                 `json:"addTags,omitempty"`
	RemoveTags              []string                `json:"removeTags,omitempty"`
	State                   string                  `json:"state,omitempty"`
	AddProxySetting         []AddProxySetting       `json:"addProxySetting,omitempty"`
	RemoveProxySetting      []string                `json:"removeProxySetting,omitempty"`
	UpdateProxySetting      []UpdateProxySetting    `json:"updateProxySetting,omitempty"`
	UpstreamURL             string                  `json:"upstreamURL,omitempty"`
	AddURLs                 []string                `json:"addURLs,omitempty"`
	RemoveURLs              []string                `json:"removeURLs,omitempty"`
	UpdateURLs              []UpdateURL             `json:"updateURLs,omitempty"`
	AddSourceIdentifiers    []AddSourceIdentifier   `json:"addSourceIdentifiers,omitempty"`
	RemoveSourceIdentifiers []string                `json:"removeSourceIdentifiers,omitempty"`
	UpdateSourceIdentifiers UpdateSourceIdentifiers `json:"updateSourceIdentifiers,omitempty"`
	IsSharesURLs            bool                    `json:"isSharesURLs,omitempty"`
}

UpdateWebAPIAssetInput represents the input for updating an existing WebAPIAseet object

type ValuesIDs

type ValuesIDs []string

func (ValuesIDs) ToIndicatorsMap

func (ids ValuesIDs) ToIndicatorsMap() map[string]string

type WebAPIAsset

type WebAPIAsset struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	AssetType         string            `json:"assetType"`
	Class             string            `json:"class"`
	Category          string            `json:"category"`
	Family            string            `json:"family"`
	Group             string            `json:"group"`
	Order             string            `json:"order"`
	Kind              string            `json:"kind"`
	MainAttributes    string            `json:"mainAttributes"`
	IntelligenceTags  string            `json:"intelligenceTags"`
	State             string            `json:"state,omitempty"`
	UpstreamURL       string            `json:"upstreamURL,omitempty"`
	Sources           string            `json:"sources"`
	URLs              URLs              `json:"URLs"`
	ProxySettings     ProxySettings     `json:"proxySetting"`
	SourceIdentifiers SourceIdentifiers `json:"sourceIdentifiers"`
	Behaviors         Behaviors         `json:"behaviors,omitempty"`
	Profiles          Profiles          `json:"profiles,omitempty"`
	Practices         PracticesWrappers `json:"practices,omitempty"`
	Tags              Tags              `json:"tags,omitempty"`
	ReadOnly          bool              `json:"readOnly"`
	IsSharesURLs      bool              `json:"isSharesURLs"`
}

WebAPIAsset represents the response from mgmt after creating the asset

Jump to

Keyboard shortcuts

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