package ini
import "github.com/aws/aws-sdk-go-v2/internal/ini"
Package ini implements parsing of the AWS shared config file.
Example: sections, err := ini.OpenFile("/path/to/file") if err != nil { panic(err) } profile := "foo" section, ok := sections.GetSection(profile) if !ok { fmt.Printf("section %q could not be found", profile) }
Index ¶
- Constants
- type Section
- func NewSection(name string) Section
- func (t Section) Bool(k string) (bool, bool)
- func (t Section) Float64(k string) (float64, bool)
- func (t Section) Has(k string) bool
- func (t Section) Int(k string) (int64, bool)
- func (t Section) List() []string
- func (t Section) Map(k string) map[string]string
- func (t Section) String(k string) string
- func (t Section) UpdateSourceFile(property string, filepath string)
- func (t Section) UpdateValue(k string, v Value) error
- func (t Section) ValueType(k string) (ValueType, bool)
- type Sections
- func NewSections() Sections
- func OpenFile(path string) (sections Sections, err error)
- func Parse(r io.Reader, path string) (Sections, error)
- func (t Sections) DeleteSection(p string)
- func (t Sections) GetSection(p string) (Section, bool)
- func (t Sections) HasSection(p string) bool
- func (t Sections) List() []string
- func (t Sections) SetSection(p string, v Section) Sections
- type UnableToReadFile
- type Value
- func NewStringValue(str string) (Value, error)
- func (v Value) BoolValue() (bool, bool)
- func (v Value) FloatValue() (float64, bool)
- func (v Value) IntValue() (int64, bool)
- func (v Value) MapValue() map[string]string
- func (v Value) String() string
- func (v Value) StringValue() string
- type ValueType
Constants ¶
ValueType enums
Types ¶
type Section ¶
type Section struct { // Name is the Section profile name Name string // Errors is the list of errors Errors []error // Logs is the list of logs Logs []string // SourceFile is the INI Source file from where this section // was retrieved. They key is the property, value is the // source file the property was retrieved from. SourceFile map[string]string // contains filtered or unexported fields }
Section contains a name and values. This represent a sectioned entry in a configuration file.
func NewSection ¶
NewSection returns an initialize section for the name
func (Section) Bool ¶
Bool returns a bool value at k
func (Section) Float64 ¶
Float64 returns a float value at k
func (Section) Has ¶
Has will return whether or not an entry exists in a given section
func (Section) Int ¶
Int returns an integer value at k
func (Section) List ¶
List will return a list of all services in values
func (Section) Map ¶
Map returns a map value at k
func (Section) String ¶
String returns the string value at k
func (Section) UpdateSourceFile ¶
UpdateSourceFile updates source file for a property to provided filepath.
func (Section) UpdateValue ¶
UpdateValue updates value for a provided key with provided value
func (Section) ValueType ¶
ValueType will returned what type the union is set to. If k was not found, the NoneType will be returned.
type Sections ¶
type Sections struct {
// contains filtered or unexported fields
}
Sections is a map of Section structures that represent a configuration.
func NewSections ¶
func NewSections() Sections
NewSections returns empty ini Sections
func OpenFile ¶
OpenFile parses shared config from the given file path.
func Parse ¶
Parse parses shared config from the given reader.
func (Sections) DeleteSection ¶
DeleteSection deletes a section entry/value for provided section name./
func (Sections) GetSection ¶
GetSection will return section p. If section p does not exist, false will be returned in the second parameter.
func (Sections) HasSection ¶
HasSection denotes if Sections consist of a section with provided name.
func (Sections) List ¶
List will return a list of all sections that were successfully parsed.
func (Sections) SetSection ¶
SetSection sets a section value for provided section name.
type UnableToReadFile ¶
type UnableToReadFile struct { Err error }
UnableToReadFile is an error indicating that a ini file could not be read
func (*UnableToReadFile) Error ¶
func (e *UnableToReadFile) Error() string
Error returns an error message and the underlying error message if present
func (*UnableToReadFile) Unwrap ¶
func (e *UnableToReadFile) Unwrap() error
Unwrap returns the underlying error
type Value ¶
type Value struct { Type ValueType // contains filtered or unexported fields }
Value is a union container
func NewStringValue ¶
NewStringValue returns a Value type generated using a string input.
func (Value) BoolValue ¶
BoolValue returns a bool value
func (Value) FloatValue ¶
FloatValue returns a float value
func (Value) IntValue ¶
IntValue returns an integer value
func (Value) MapValue ¶
MapValue returns a map value for sub properties
func (Value) String ¶
func (Value) StringValue ¶
StringValue returns the string value
type ValueType ¶
type ValueType int
ValueType is an enum that will signify what type the Value is
func (ValueType) String ¶
Source Files ¶
errors.go go_module_metadata.go ini.go parse.go sections.go strings.go token.go tokenize.go value.go
- Version
- v1.8.3 (latest)
- Published
- Feb 18, 2025
- Platform
- windows/amd64
- Imports
- 6 packages
- Last checked
- now –
Tools for package owners.