Documentation
¶
Overview ¶
Package tenants manages and retrieves Projects in the ECL SSS Service.
Example to List Tenants
listOpts := tenants.ListOpts{} allPages, err := tenants.List(identityClient, listOpts).AllPages() if err != nil { panic(err) } allTenants, err := tenants.ExtractProjects(allPages) if err != nil { panic(err) } for _, tenant := range allTenants { fmt.Printf("%+v\n", tenant) }
Example to Create a Tenant
createOpts := projects.CreateOpts{ Name: "tenant_name", Description: "Tenant Description" } tenant, err := tenants.Create(identityClient, createOpts).Extract() if err != nil { panic(err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List enumerates the Projects to which the current token has access.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // Workspace ID. WorkspaceID string `json:"workspace_id" required:"true"` // TenantRegion of the tenant. TenantRegion string `json:"region" required:"true"` }
CreateOpts represents parameters used to create a tenant.
func (CreateOpts) ToTenantCreateMap ¶
func (opts CreateOpts) ToTenantCreateMap() (map[string]interface{}, error)
ToTenantCreateMap formats a CreateOpts into a create request.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult is the result of a Create request. Call its Extract method to interpret it as a Tenant.
func Create ¶
func Create(client *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create creates a new Project.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the result of a Get request. Call its Extract method to interpret it as a Tenant.
type InvalidListFilter ¶
type InvalidListFilter struct {
FilterName string
}
InvalidListFilter is returned by the ToUserListQuery method when validation of a filter does not pass
func (InvalidListFilter) Error ¶
func (e InvalidListFilter) Error() string
type ListOpts ¶
type ListOpts struct { }
ListOpts enables filtering of a list request. Currently SSS Tenant API does not support any of query parameters.
func (ListOpts) ToTenantListQuery ¶
ToTenantListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request
type Tenant ¶
type Tenant struct { // ID of contract which owns these tenants. ContractID string `json:"contract_id"` // ID is the unique ID of the tenant. TenantID string `json:"tenant_id"` // Name of the tenant. TenantName string `json:"tenant_name"` // Description of the tenant. Description string `json:"description"` // TenantRegion the tenant belongs. TenantRegion string `json:"region"` // Time that the tenant is created. StartTime time.Time `json:"-"` // SSS API endpoint for the region. RegionApiEndpoint string `json:"region_api_endpoint"` // Users information who have access to this tenant. User []User `json:"users"` // Brand ID which this tenant belongs. (ex. ecl2) BrandID string `json:"brand_id"` // Workspace ID of the tenant. WorkspaceID string `json:"workspace_id"` }
Tenant represents an ECL SSS Tenant.
func ExtractTenants ¶
func ExtractTenants(r pagination.Page) ([]Tenant, error)
ExtractTenants returns a slice of Tenants contained in a single page of results.
func (*Tenant) UnmarshalJSON ¶
UnmarshalJSON creates JSON format of tenant
type TenantPage ¶
type TenantPage struct {
pagination.LinkedPageBase
}
TenantPage is a single page of Tenant results.
func (TenantPage) IsEmpty ¶
func (r TenantPage) IsEmpty() (bool, error)
IsEmpty determines whether or not a page of Tenants contains any results.
func (TenantPage) NextPageURL ¶
func (r TenantPage) NextPageURL() (string, error)
NextPageURL extracts the "next" link from the links section of the result.