2023-03-28 20:12:41 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2020-10-06 18:24:05 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
type ServiceIntentionsConfigEntry struct {
|
|
|
|
Kind string
|
|
|
|
Name string
|
2021-09-13 21:53:52 +00:00
|
|
|
Partition string `json:",omitempty"`
|
2020-10-06 18:24:05 +00:00
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
|
|
|
Sources []*SourceIntention
|
|
|
|
|
|
|
|
Meta map[string]string `json:",omitempty"`
|
|
|
|
|
|
|
|
CreateIndex uint64
|
|
|
|
ModifyIndex uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
type SourceIntention struct {
|
|
|
|
Name string
|
2022-06-08 17:24:10 +00:00
|
|
|
Peer string `json:",omitempty"`
|
2021-09-13 21:53:52 +00:00
|
|
|
Partition string `json:",omitempty"`
|
2020-10-06 22:09:13 +00:00
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
Action IntentionAction `json:",omitempty"`
|
|
|
|
Permissions []*IntentionPermission `json:",omitempty"`
|
2020-10-06 18:24:05 +00:00
|
|
|
Precedence int
|
|
|
|
Type IntentionSourceType
|
|
|
|
Description string `json:",omitempty"`
|
|
|
|
|
|
|
|
LegacyID string `json:",omitempty" alias:"legacy_id"`
|
|
|
|
LegacyMeta map[string]string `json:",omitempty" alias:"legacy_meta"`
|
|
|
|
LegacyCreateTime *time.Time `json:",omitempty" alias:"legacy_create_time"`
|
|
|
|
LegacyUpdateTime *time.Time `json:",omitempty" alias:"legacy_update_time"`
|
|
|
|
}
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
func (e *ServiceIntentionsConfigEntry) GetKind() string { return e.Kind }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetName() string { return e.Name }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetPartition() string { return e.Partition }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetNamespace() string { return e.Namespace }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetMeta() map[string]string { return e.Meta }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetCreateIndex() uint64 { return e.CreateIndex }
|
|
|
|
func (e *ServiceIntentionsConfigEntry) GetModifyIndex() uint64 { return e.ModifyIndex }
|
2020-10-06 22:09:13 +00:00
|
|
|
|
|
|
|
type IntentionPermission struct {
|
|
|
|
Action IntentionAction
|
|
|
|
HTTP *IntentionHTTPPermission `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type IntentionHTTPPermission struct {
|
|
|
|
PathExact string `json:",omitempty" alias:"path_exact"`
|
|
|
|
PathPrefix string `json:",omitempty" alias:"path_prefix"`
|
|
|
|
PathRegex string `json:",omitempty" alias:"path_regex"`
|
|
|
|
|
|
|
|
Header []IntentionHTTPHeaderPermission `json:",omitempty"`
|
|
|
|
|
|
|
|
Methods []string `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type IntentionHTTPHeaderPermission struct {
|
|
|
|
Name string
|
|
|
|
Present bool `json:",omitempty"`
|
|
|
|
Exact string `json:",omitempty"`
|
|
|
|
Prefix string `json:",omitempty"`
|
|
|
|
Suffix string `json:",omitempty"`
|
|
|
|
Regex string `json:",omitempty"`
|
|
|
|
Invert bool `json:",omitempty"`
|
|
|
|
}
|