package
1.0.0-beta.32
Repository: https://github.com/scaleway/scaleway-sdk-go.git
Documentation: pkg.go.dev
# README
Scaleway config
TL;DR
Recommended config file:
# Get your credentials on https://console.scaleway.com/project/credentials
access_key: SCWXXXXXXXXXXXXXXXXX
secret_key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
default_organization_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
default_project_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
default_region: fr-par
default_zone: fr-par-1
Config file path
The function GetConfigPath
will try to locate the config file in the following ways:
- Custom directory:
$SCW_CONFIG_PATH
- XDG base directory:
$XDG_CONFIG_HOME/scw/config.yaml
- Unix home directory:
$HOME/.config/scw/config.yaml
- Windows home directory:
%USERPROFILE%/.config/scw/config.yaml
Reading config order
ClientOption ordering will decide the order in which the config should apply:
p, _ := scw.MustLoadConfig().GetActiveProfile()
scw.NewClient(
scw.WithProfile(p), // active profile applies first
scw.WithEnv(), // existing env variables may overwrite active profile
scw.WithDefaultRegion(scw.RegionFrPar) // any prior region set will be discarded to usr the new one
)
Environment variables
Variable | Description | Legacy variables |
---|---|---|
$SCW_ACCESS_KEY | Access key of a token (get yours) | $SCALEWAY_ACCESS_KEY (used by terraform) |
$SCW_SECRET_KEY | Secret key of a token (get yours) | $SCW_TOKEN (used by cli), $SCALEWAY_TOKEN (used by terraform), $SCALEWAY_ACCESS_KEY (used by terraform) |
$SCW_DEFAULT_ORGANIZATION_ID | Your default organization ID (get yours) | $SCW_ORGANIZATION (used by cli),$SCALEWAY_ORGANIZATION (used by terraform) |
$SCW_DEFAULT_PROJECT_ID | Your default project ID (get yours) | |
$SCW_DEFAULT_REGION | Your default region | $SCW_REGION (used by cli),$SCALEWAY_REGION (used by terraform) |
$SCW_DEFAULT_ZONE | Your default availability zone | $SCW_ZONE (used by cli),$SCALEWAY_ZONE (used by terraform) |
$SCW_API_URL | Url of the API | - |
$SCW_INSECURE | Set this to true to enable the insecure mode | $SCW_TLSVERIFY (inverse flag used by the cli) |
$SCW_PROFILE | Set the config profile to use | - |
# Functions
BoolPtr returns a pointer to the bool value passed in.
BoolSlicePtr converts a slice of bool values into a slice of bool pointers.
BytesPtr returns a pointer to the []byte value passed in.
BytesSlicePtr converts a slice of []byte values into a slice of []byte pointers.
DecodeJSONObject will attempt to decode the string input as a JSONValue.
EncodeJSONObject marshals the value into a JSON string, and optionally base64 encodes the string before returning it.
Float32Ptr returns a pointer to the float32 value passed in.
Float32SlicePtr converts a slice of float32 values into a slice of float32 pointers.
Float64Ptr returns a pointer to the float64 value passed in.
Float64SlicePtr converts a slice of float64 values into a slice of float64 pointers.
GetCacheDirectory returns the default cache directory.
GetConfigPath returns the default path.
GetScwConfigDir returns the path to scw config folder.
Int32Ptr returns a pointer to the int32 value passed in.
Int32SlicePtr converts a slice of int32 values into a slice of int32 pointers.
Int64Ptr returns a pointer to the int64 value passed in.
Int64SlicePtr converts a slice of int64 values into a slice of int64 pointers.
IPPtr returns a pointer to the net.IP value passed in.
LoadConfig read the config from the default path.
LoadConfigFromPath read the config from the given path.
No description provided by the author
MergeProfiles merges profiles in a new one.
MustLoadConfig is like LoadConfig but panic instead of returning an error.
NewClient instantiate a new Client object.
No description provided by the author
No description provided by the author
NewMoneyFromFloat converts a float with currency to a Money.
ParseRegion parses a string value into a Region and returns an error if it has a bad format.
ParseZone parses a string value into a Zone and returns an error if it has a bad format.
SizePtr returns a pointer to the Size value passed in.
StringPtr returns a pointer to the string value passed in.
StringSlicePtr converts a slice of string values into a slice of string pointers.
StringsPtr returns a pointer to the []string value passed in.
StringsSlicePtr converts a slice of []string values into a slice of []string pointers.
TimeDurationPtr returns a pointer to the Duration value passed in.
TimePtr returns a pointer to the Time value passed in.
Uint32Ptr returns a pointer to the uint32 value passed in.
Uint32SlicePtr converts a slice of uint32 values into a slice of uint32 pointers.
Uint64Ptr returns a pointer to the uint64 value passed in.
Uint64SlicePtr converts a slice of uint64 values into a slice of uint64 pointers.
WithAllPages aggregate all pages in the response of a List request.
WithAPIURL client option overrides the API URL of the Scaleway API to the given URL.
WithAuth client option sets the client access key and secret key.
WithAuthRequest overwrites the client access key and secret key used in the request.
WithContext request option sets the context of a ScalewayRequest.
WithDefaultOrganizationID client option sets the client default organization ID.
WithDefaultPageSize client option overrides the default page size of the SDK.
WithDefaultProjectID client option sets the client default project ID.
WithDefaultRegion client option sets the client default region.
WithDefaultZone client option sets the client default zone.
WithEnv client option configures a client from the environment variables.
WithHTTPClient client option allows passing a custom http.Client which will be used for all requests.
WithInsecure client option enables insecure transport on the client.
WithJWT client option sets the client session token.
WithoutAuth client option sets the client token to an empty token.
WithProfile client option configures a client from the given profile.
WithRegions aggregate results from requested regions in the response of a List request.
WithUserAgent client option append a user agent to the default user agent of the SDK.
WithZones aggregate results from requested zones in the response of a List request.
# Constants
No description provided by the author
The modes for escaping a value before it is marshaled, and unmarshalled.
Environment variables.
Reserved name for the default profile.
No description provided by the author
No description provided by the author
No description provided by the author
The modes for escaping a value before it is marshaled, and unmarshalled.
No description provided by the author
The modes for escaping a value before it is marshaled, and unmarshalled.
RegionFrPar represents the fr-par region.
RegionNlAms represents the nl-ams region.
RegionPlWaw represents the pl-waw region.
Environment variables.
Environment variables.
Environment variables.
Up-to-date.
Environment variables.
Environment variables.
Environment variables.
Environment variables.
Environment variables.
Environment variables.
Environment variables.
#nosec G101.
No description provided by the author
ZoneFrPar1 represents the fr-par-1 zone.
ZoneFrPar2 represents the fr-par-2 zone.
ZoneFrPar3 represents the fr-par-3 zone.
ZoneNlAms1 represents the nl-ams-1 zone.
ZoneNlAms2 represents the nl-ams-2 zone.
ZoneNlAms3 represents the nl-ams-3 zone.
ZonePlWaw1 represents the pl-waw-1 zone.
ZonePlWaw2 represents the pl-waw-2 zone.
ZonePlWaw3 represents the pl-waw-3 zone.
# Variables
AllRegions is an array that list all regions.
AllZones is an array that list all zones.
ErrNoHomeDir errors when no user directory is found.
# Structs
Client is the Scaleway client which performs API requests.
No description provided by the author
ConfigFileNotFound indicates that the config file could not be found.
DeniedAuthenticationError implements the SdkError interface.
Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution.
File is the structure used to receive / send a file from / to the API.
No description provided by the author
No description provided by the author
InvalidClientOptionError indicates that at least one of client data has been badly provided for the client creation.
InvalidRequestError is only returned by the instance API.
IPNet inherits net.IPNet and represents an IP network.
Money represents an amount of money with its currency type.
No description provided by the author
No description provided by the author
PreconditionFailedError implements the SdkError interface.
No description provided by the author
No description provided by the author
No description provided by the author
ResourceExpiredError implements the SdkError interface.
No description provided by the author
No description provided by the author
ResponseError is an error type for the Scaleway API.
ScalewayRequest contains all the contents related to performing a request on the Scaleway API.
ServiceInfo contains API metadata These metadata are only here for debugging.
TimeSeries represents a time series that could be used for graph purposes.
TimeSeriesPoint represents a point of a time series.
No description provided by the author
UnknownResource is only returned by the instance API.
# Interfaces
SdkError is a base interface for all Scaleway SDK errors.
# Type aliases
ClientOption is a function which applies options to a settings object.
Decimal is a representation of a decimal value, such as 2.5.
EscapeMode is the mode that should be use for escaping a value.
JSONObject represent any JSON object.
Region is a geographical location.
RequestOption is a function that applies options to a ScalewayRequest.
Size represents a size in bytes.
Zone is an availability zone.