edgio-go-sdk

edgio/env

This package groups Edgio Environment specific funcs.

env.NewClient(params common.ClientParams) (ClientStruct, error)

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.

env.NewClient Mandatory Params

env.NewClient Optional Params & Default Values

env.List(propertyID string) (ListResultType, error)

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.

env.List Mandatory Params

env.List Optional Params & Default Values

There is no optional parameters for that function

env.FilterList(params env.FilterParams) (common.FilteredListResultType[common.Env], error)

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.FilterList Mandatory Params

env.FilterList Optional Params

env.Get(params env.FilterParams) (common.Env, error)

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.Get Mandatory Params

env.Get Optional Params & Default Values

This func has no optional params.

env.GetByName(params FilterParams) (common.Env, error)


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.GetByName Mandatory Params

env.GetByName Optional Params

There is no optional parameters for that function

back to the main README