Documentation ¶
Overview ¶
Package rolebinding defines RoleBinding object definitions.
Index ¶
- type Metadata
- type RoleBinding
- func (r RoleBinding) GetKind() manifest.Kind
- func (r RoleBinding) GetManifestSource() string
- func (r RoleBinding) GetName() string
- func (r RoleBinding) GetOrganization() string
- func (r RoleBinding) GetValidator() govy.Validator[RoleBinding]
- func (r RoleBinding) GetVersion() manifest.Version
- func (r RoleBinding) SetManifestSource(src string) manifest.Object
- func (r RoleBinding) SetOrganization(org string) manifest.Object
- func (r RoleBinding) Validate() error
- type Spec
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RoleBinding ¶
type RoleBinding struct { APIVersion manifest.Version `json:"apiVersion"` Kind manifest.Kind `json:"kind"` Metadata Metadata `json:"metadata"` Spec Spec `json:"spec"` Organization string `json:"organization,omitempty"` ManifestSource string `json:"manifestSrc,omitempty"` }
RoleBinding represents relation between user and role.
Example ¶
package main import ( "context" "log" "github.com/nobl9/nobl9-go/internal/examples" "github.com/nobl9/nobl9-go/manifest" "github.com/nobl9/nobl9-go/manifest/v1alpha/rolebinding" ) func main() { // Create the object: myBinding := rolebinding.New( rolebinding.Metadata{ Name: "my-binding", }, rolebinding.Spec{ User: ptr("some-user-id"), RoleRef: "project-editor", ProjectRef: "default", }, ) // Verify the object: if err := myBinding.Validate(); err != nil { log.Fatal("role binding validation failed, err: %w", err) } // Apply the object: client := examples.GetOfflineEchoClient() if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myBinding}); err != nil { log.Fatal("failed to apply role binding, err: %w", err) } } func ptr[T any](v T) *T { return &v }
Output: apiVersion: n9/v1alpha kind: RoleBinding metadata: name: my-binding spec: user: some-user-id roleRef: project-editor projectRef: default
func New ¶
func New(metadata Metadata, spec Spec) RoleBinding
func (RoleBinding) GetKind ¶
func (r RoleBinding) GetKind() manifest.Kind
func (RoleBinding) GetManifestSource ¶
func (r RoleBinding) GetManifestSource() string
func (RoleBinding) GetName ¶
func (r RoleBinding) GetName() string
func (RoleBinding) GetOrganization ¶
func (r RoleBinding) GetOrganization() string
func (RoleBinding) GetValidator ¶ added in v0.82.0
func (r RoleBinding) GetValidator() govy.Validator[RoleBinding]
func (RoleBinding) GetVersion ¶
func (r RoleBinding) GetVersion() manifest.Version
func (RoleBinding) SetManifestSource ¶
func (r RoleBinding) SetManifestSource(src string) manifest.Object
func (RoleBinding) SetOrganization ¶
func (r RoleBinding) SetOrganization(org string) manifest.Object
func (RoleBinding) Validate ¶
func (r RoleBinding) Validate() error
Click to show internal directories.
Click to hide internal directories.