Documentation ¶
Overview ¶
Package usergroup defines UserGroup object definitions.
Index ¶
- type Member
- type Metadata
- type Spec
- type UserGroup
- func (u UserGroup) GetKind() manifest.Kind
- func (u UserGroup) GetManifestSource() string
- func (u UserGroup) GetName() string
- func (u UserGroup) GetOrganization() string
- func (u UserGroup) GetVersion() manifest.Version
- func (u UserGroup) SetManifestSource(src string) manifest.Object
- func (u UserGroup) SetOrganization(org string) manifest.Object
- func (u UserGroup) Validate() error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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"` }
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 (UserGroup) GetManifestSource ¶
func (UserGroup) GetOrganization ¶
func (UserGroup) GetVersion ¶
func (UserGroup) SetManifestSource ¶
Click to show internal directories.
Click to hide internal directories.