filepermissions

package
v0.0.0-...-f089ef2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUnixPermissions

func NewUnixPermissions(options ...UnixPermissionsOption) optional.Option[FilePermissions]

NewUnixPermissions creates a new UnixPermissions object and applies the given options.

func NewWindowsPermissions

func NewWindowsPermissions(options ...WindowsPermissionsOption) optional.Option[FilePermissions]

NewWindowsPermissions creates a new WindowsPermissions object and applies the given options.

Types

type FilePermissions

type FilePermissions interface {
	SetupPermissionsCommand(path string) string
	ResetPermissionsCommand(path string) string
}

FilePermissions interface defines all commands that can be used to set and reset file permissions. These functions are used to create args.Command that will be run by pulumi.

type UnixPermissions

type UnixPermissions struct {
	Owner       string
	Group       string
	Permissions string
}

UnixPermissions represents the owner, group, and permissions of a file. Permissions are represented by a string (should be an octal). There is no check on the octal format.

func (*UnixPermissions) ResetPermissionsCommand

func (p *UnixPermissions) ResetPermissionsCommand(path string) string

ResetPermissionsCommand returns a command that resets the owner, group, and permissions of a file to default.

func (*UnixPermissions) SetupPermissionsCommand

func (p *UnixPermissions) SetupPermissionsCommand(path string) string

SetupPermissionsCommand returns a command that sets the owner, group, and permissions of a file.

type UnixPermissionsOption

type UnixPermissionsOption = func(*UnixPermissions) error

func WithGroup

func WithGroup(group string) UnixPermissionsOption

WithGroup sets the group of the file.

func WithOwner

func WithOwner(owner string) UnixPermissionsOption

WithOwner sets the owner of the file.

func WithPermissions

func WithPermissions(permissions string) UnixPermissionsOption

WithPermissions sets the permissions of the file.

type WindowsPermissions

type WindowsPermissions struct {
	// DisableInheritance disables the inheritance of permissions from the parent directory.
	DisableInheritance bool

	// If you are familiar with the icacls command, you can provide a custom command directly.
	IcaclsCommand string
}

WindowsPermissions contains the information to configure the permissions of a file on Windows.

func (*WindowsPermissions) ResetPermissionsCommand

func (p *WindowsPermissions) ResetPermissionsCommand(path string) string

ResetPermissionsCommand returns a command that resets the owner, group, and permissions of a file to default.

func (*WindowsPermissions) SetupPermissionsCommand

func (p *WindowsPermissions) SetupPermissionsCommand(path string) string

SetupPermissionsCommand returns a command that sets the permissions of a file. It relies on the icacls command.

type WindowsPermissionsOption

type WindowsPermissionsOption = func(*WindowsPermissions) error

func WithDisableInheritance

func WithDisableInheritance() WindowsPermissionsOption

WithDisableInheritance disables the inheritance of permissions.

func WithIcaclsCommand

func WithIcaclsCommand(command string) WindowsPermissionsOption

WithIcaclsCommand sets the icacls command to use.

Jump to

Keyboard shortcuts

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