acls

package
v1.1.31 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package acls manages acls in the OpenStack Key Manager Service.

All functions have a Secret and Container equivalent.

Example to Get a Secret's ACL

acl, err := acls.GetSecretACL(client, secretID).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", acl)

Example to Set a Secret's ACL

users := []string{"uuid", "uuid"}
iFalse := false
setOpts := acls.SetOpts{
	Type:          "read",
	users:         &users,
	ProjectAccess: &iFalse,
}

aclRef, err := acls.SetSecretACL(client, secretID, setOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", aclRef)

Example to Update a Secret's ACL

users := []string{}
setOpts := acls.SetOpts{
	Type:  "read",
	users: &users,
}

aclRef, err := acls.UpdateSecretACL(client, secretID, setOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%v\n", aclRef)

Example to Delete a Secret's ACL

err := acls.DeleteSecretACL(client, secretID).ExtractErr()
if err != nil {
	panci(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL map[string]ACLDetails

ACL represents an ACL on a resource.

type ACLDetails

type ACLDetails struct {
	// Created is when the ACL was created.
	Created time.Time `json:"-"`

	// ProjectAccess denotes project-level access of the resource.
	ProjectAccess bool `json:"project-access"`

	// Updated is when the ACL was updated
	Updated time.Time `json:"-"`

	// Users are the UserIDs who have access to the resource.
	Users []string `json:"users"`
}

ACLDetails represents the details of an ACL.

func (*ACLDetails) UnmarshalJSON

func (r *ACLDetails) UnmarshalJSON(b []byte) error

type ACLRef

type ACLRef string

ACLRef represents an ACL reference.

type ACLRefResult

type ACLRefResult struct {
	gophercloud.Result
}

ACLRefResult is the response from a Set or Update operation. Call its Extract method to interpret it as an ACLRef.

func SetContainerACL

func SetContainerACL(client *gophercloud.ServiceClient, containerID string, opts SetOptsBuilder) (r ACLRefResult)

SetContainerACL will set an ACL on a container.

func SetSecretACL

func SetSecretACL(client *gophercloud.ServiceClient, secretID string, opts SetOptsBuilder) (r ACLRefResult)

SetSecretACL will set an ACL on a secret.

func UpdateContainerACL

func UpdateContainerACL(client *gophercloud.ServiceClient, containerID string, opts SetOptsBuilder) (r ACLRefResult)

UpdateContainerACL will update an ACL on a container.

func UpdateSecretACL

func UpdateSecretACL(client *gophercloud.ServiceClient, secretID string, opts SetOptsBuilder) (r ACLRefResult)

UpdateSecretACL will update an ACL on a secret.

func (ACLRefResult) Extract

func (r ACLRefResult) Extract() (*ACLRef, error)

type ACLResult

type ACLResult struct {
	// contains filtered or unexported fields
}

ACLResult is the response from a Get operation. Call its Extract method to interpret it as an ACL.

func GetContainerACL

func GetContainerACL(client *gophercloud.ServiceClient, containerID string) (r ACLResult)

GetContainerACL retrieves the ACL of a container.

func GetSecretACL

func GetSecretACL(client *gophercloud.ServiceClient, secretID string) (r ACLResult)

GetSecretACL retrieves the ACL of a secret.

func (ACLResult) Extract

func (r ACLResult) Extract() (*ACL, error)

Extract interprets any commonResult as an ACL.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

func DeleteContainerACL

func DeleteContainerACL(client *gophercloud.ServiceClient, containerID string) (r DeleteResult)

DeleteContainerACL will delete an ACL from a conatiner.

func DeleteSecretACL

func DeleteSecretACL(client *gophercloud.ServiceClient, secretID string) (r DeleteResult)

DeleteSecretACL will delete an ACL from a secret.

type SetOpt

type SetOpt struct {
	// Type is the type of ACL to set. ie: read.
	Type string `json:"-" required:"true"`

	// Users are the list of Keystone user UUIDs.
	Users *[]string `json:"users,omitempty"`

	// ProjectAccess toggles if all users in a project can access the resource.
	ProjectAccess *bool `json:"project-access,omitempty"`
}

SetOpt represents options to set a particular ACL type on a resource.

type SetOpts

type SetOpts []SetOpt

SetOpts represents options to set an ACL on a resource.

func (SetOpts) ToACLSetMap

func (opts SetOpts) ToACLSetMap() (map[string]interface{}, error)

ToACLSetMap formats a SetOpts into a set request.

type SetOptsBuilder

type SetOptsBuilder interface {
	ToACLSetMap() (map[string]interface{}, error)
}

SetOptsBuilder allows extensions to add additional parameters to the Set request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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