usergroup

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package usergroup defines UserGroup object definitions.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Member

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

type Metadata

type Metadata struct {
	Name string `json:"name"`
}

type Spec

type Spec struct {
	DisplayName string   `json:"displayName"`
	Members     []Member `json:"members"`
}

Spec represents content of UserGroup's Spec

type UserGroup

type UserGroup 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"`
}

UserGroup represents a UserGroup object.

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/usergroup"
)

func main() {
	// Create the object:
	myUserGroup := usergroup.New(
		usergroup.Metadata{
			Name: "my-group",
		},
		usergroup.Spec{
			DisplayName: "My Group",
			Members: []usergroup.Member{
				{ID: "321"},
				{ID: "123"},
			},
		},
	)
	// Verify the object:
	if err := myUserGroup.Validate(); err != nil {
		log.Fatalf("user group validation failed, err: %v", err)
	}
	// Apply the object:
	client := examples.GetOfflineEchoClient()
	if err := client.Objects().V1().Apply(context.Background(), []manifest.Object{myUserGroup}); err != nil {
		log.Fatalf("failed to apply user group, err: %v", err)
	}
}
Output:

apiVersion: n9/v1alpha
kind: UserGroup
metadata:
  name: my-group
spec:
  displayName: My Group
  members:
  - id: "321"
  - id: "123"

func New

func New(metadata Metadata, spec Spec) UserGroup

func (UserGroup) GetKind

func (u UserGroup) GetKind() manifest.Kind

func (UserGroup) GetManifestSource

func (u UserGroup) GetManifestSource() string

func (UserGroup) GetName

func (u UserGroup) GetName() string

func (UserGroup) GetOrganization

func (u UserGroup) GetOrganization() string

func (UserGroup) GetValidator added in v0.82.0

func (u UserGroup) GetValidator() govy.Validator[UserGroup]

func (UserGroup) GetVersion

func (u UserGroup) GetVersion() manifest.Version

func (UserGroup) SetManifestSource

func (u UserGroup) SetManifestSource(src string) manifest.Object

func (UserGroup) SetOrganization

func (u UserGroup) SetOrganization(org string) manifest.Object

func (UserGroup) Validate

func (u UserGroup) Validate() error

Jump to

Keyboard shortcuts

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