This package groups Edgio Environment specific funcs.
credentials := common.Creds{
Key: "some-api-key",
Secret: "some-api-secret",
}
envClient, err := env.NewClient(common.ClientParams{
Credentials: credentials,
Config: common.ClientConfig{AccessToken: "some-access-token"},
})
This func returns a new client with the provided parameters, with an access token already set, and the default edgio params values for service, scope and API version (which can be overwritten if needed) to interact with your application's environments.
params.Credentials
params.Credentials.Key
: Edgio REST API Client Key. This is the API Client's identifier on Edgio. You can generate your api client accessinghttps://edgio.app/<your-org-name>/clients
.params.Credentials.Secret
: Edgio REST API Client Secret. This is the API Client' secret, unique for each API Client. You can generate your api client accessinghttps://edgio.app/<your-org-name>/clients
.
params.Credentials
params.Credentials.Scopes
: Edgio REST API Client scopes requested by the client. Different APIs needs different scopes. Refer to the REST API docs to figure which ones you need.- Default value:
app.cache+app.cache.purge+app.waf+app.waf:edit+app.waf:read+app.accounts+app.config
(all scopes).
- Default value:
params.Credentials.AuthURL
: Edgio REST API auth url. You will probably never need to change this, but we included the option just in case (e. g.: future enterprise self-hosted option).- Default value:
https://id.edgio.app/connect/token
(Edgio's default auth API url).
- Default value:
params.Config
params.Config.ApiVersion
: Intended REST API Version. Each one of the Edgio REST APIs has its own Version, that must be provided when creating the client.- Default value:
v0.1
- Default value:
params.Config.Service
: Intended REST API Service. Each one of the Edgio REST APIs has its own Service, that must be provided when creating the client.- Default value:
accounts
- Default value:
params.Config.Scope
: Intended REST API Scope. Each one of the Edgio REST APIs has its own Scope, that must be provided when creating the client.- Default value:
environments
- Default value:
params.Config.Url
: Edgio REST API resources url. You will probably never need to change this, but we included the option just in case (e. g.: future enterprise self-hosted option).- Default value:
https://edgioapis.com
(Edgio's default resources API url).
- Default value:
credentials := common.Creds{
Key: "some-api-key",
Secret: "some-api-secret",
}
client, err := env.NewClient(env.ClientParams{
Credentials: credentials,
Config: common.ClientConfig{},
})
envs, err := client.List("some-property-id") // [{ "ID": "some-id", "Name": "some-env-name", "LegacyAccNumber": "some-acc-number", "DefaultDomainName": "some-domain-name", "DNSDomainName": "some-dns", "CanMembersDeploy": true, "OnlyMaintainersCanDeploy": true, "HTTPRequestLogging": true, "PciCompliance": true, "CreatedAt": "2019-08-24T14:15:22Z", "UpdatedAt": "2019-08-24T14:15:22Z" }]
This func list environments for a given Edgio property. Edgio's list page size was defaulted to 100 for now, which is the highest value. The idea is to return all environments until actual pagination is implemented. Returns a list of environments for a given Property or an error if anything goes wrong.
propertyID
: Property ID from the property which owns the environments to be retrieved
There is no optional parameters for that function
params := common.ClientParams{
Credentials: common.Creds{ ... }
}
client, _ := env.NewClient(params)
filterParams := env.FilterParams{
PropertyID: "some-property-id",
Name: "some-env",
}
FilteredList, _ := client.FilterList(filterParams)
fmt.Println(FilteredList) // [{ "ID": "some-id", "Name": "some-env", "LegacyAccNumber": "some-acc-number", "DefaultDomainName": "some-domain-name", "DNSDomainName": "some-dns", "CanMembersDeploy": true, "OnlyMaintainersCanDeploy": true, "HTTPRequestLogging": true, "PciCompliance": true, "CreatedAt": "2019-08-24T14:15:22Z", "UpdatedAt": "2019-08-24T14:15:22Z" }]
Filters the list of environments for a given Property by the environment name, and returns a list of environments for a given Property that contain the provided name, or all environments if no name is provided.
env.FilterParams.propertyID
: Property ID from the property which owns the environments to be retrieved
env.FilterParams.Name
: The string to be used as a environment name filter
params := common.ClientParams{
Credentials: common.Creds{ ... },
Config: common.ClientConfig{OrgID: "some-org-id"},
}
client, _ := env.NewClient(params)
env, _ := client.Get(env.FilterParams{ ID: "some-env-id" })
fmt.Println(env) // { "ID": "some-env-id", "Name": "some-env", "LegacyAccNumber": "some-acc-number", "DefaultDomainName": "some-domain-name", "DNSDomainName": "some-dns", "CanMembersDeploy": true, "OnlyMaintainersCanDeploy": true, "HTTPRequestLogging": true, "PciCompliance": true, "CreatedAt": "2019-08-24T14:15:22Z", "UpdatedAt": "2019-08-24T14:15:22Z" }
This func retrieves an environment by ID and returns it, or empty if none was found.
env.FilterParams.ID
: The string to be used as ID to get the desired environment
This func has no optional params.
envClient, err := env.NewClient(common.ClientParams{
Credentials: common.Creds{ ... },
})
env, _ := envClient.GetByName(env.FilterParams{PropertyID: "some-property-id", Name: "some-env-name"})
fmt.Println(env) // { "id": "some-id", "name": "some-env-name", "legacy_account_number": "", "default_domain_name": "", "dns_domain_name": "", "can_members_deploy": true, "only_maintainers_can_deploy": true, "http_request_logging": true, "pci_compliance": true, "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z" }
This func returns the first environment in the list that matches the name, or nil if no environments match the name.
env.FilterParams.PropertyID
: Property ID from the property which owns the environments to be retrievedenv.FilterParams.Name
: The string to be used as a environment name filter
There is no optional parameters for that function