cors

package
v7.0.79 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	XMLNS     string   `xml:"xmlns,attr,omitempty"`
	XMLName   xml.Name `xml:"CORSConfiguration"`
	CORSRules []Rule   `xml:"CORSRule"`
}

Config is the container for a CORS configuration for a bucket.

func NewConfig

func NewConfig(rules []Rule) *Config

NewConfig creates a new CORS configuration with the given rules.

func ParseBucketCorsConfig

func ParseBucketCorsConfig(reader io.Reader) (*Config, error)

ParseBucketCorsConfig parses a CORS configuration in XML from an io.Reader.

func (Config) ToXML

func (c Config) ToXML() ([]byte, error)

ToXML marshals the CORS configuration to XML.

type Rule

type Rule struct {
	AllowedHeader []string `xml:"AllowedHeader,omitempty"`
	AllowedMethod []string `xml:"AllowedMethod,omitempty"`
	AllowedOrigin []string `xml:"AllowedOrigin,omitempty"`
	ExposeHeader  []string `xml:"ExposeHeader,omitempty"`
	ID            string   `xml:"ID,omitempty"`
	MaxAgeSeconds int      `xml:"MaxAgeSeconds,omitempty"`
}

Rule is a single rule in a CORS configuration.

Jump to

Keyboard shortcuts

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