Documentation ¶
Overview ¶
Package members enables management and retrieval of image members.
Members are projects other than the image owner who have access to the image.
Example to List Members of an Image
imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" allPages, err := members.List(imageID).AllPages() if err != nil { panic(err) } allMembers, err := members.ExtractMembers(allPages) if err != nil { panic(err) } for _, member := range allMembers { fmt.Printf("%+v\n", member) }
Example to Add a Member to an Image
imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" projectID := "fc404778935a4cebaddcb4788fb3ff2c" member, err := members.Create(imageClient, imageID, projectID).Extract() if err != nil { panic(err) }
Example to Update the Status of a Member
imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" projectID := "fc404778935a4cebaddcb4788fb3ff2c" updateOpts := members.UpdateOpts{ Status: "accepted", } member, err := members.Update(imageClient, imageID, projectID, updateOpts).Extract() if err != nil { panic(err) }
Example to Delete a Member from an Image
imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" projectID := "fc404778935a4cebaddcb4788fb3ff2c" err := members.Delete(imageClient, imageID, projectID).ExtractErr() if err != nil { panic(err) }
Index ¶
- func List(client *gophercloud.ServiceClient, id string) pagination.Pager
- type CreateResult
- type DeleteResult
- type DetailsResult
- type Member
- type MemberPage
- type MemberSchemas
- type MemberSchemasResult
- type MembersSchemas
- type MembersSchemasResult
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, id string) pagination.Pager
List members returns list of members for specifed image id.
Types ¶
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a Create operation. Call its Extract method to interpret it as a Member.
func Create ¶
func Create(client *gophercloud.ServiceClient, id string, member string) (r CreateResult)
Create member for specific image
Preconditions ¶
- The specified images must exist.
- You can only add a new member to an image which 'visibility' attribute is private.
- You must be the owner of the specified image.
Synchronous Postconditions ¶
With correct permissions, you can see the member status of the image as pending through API calls.
More details here: http://developer.openstack.org/api-ref-image-v2.html#createImageMember-v2
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult represents the result of a Delete operation. Call its ExtractErr method to determine if the request succeeded or failed.
func Delete ¶
func Delete(client *gophercloud.ServiceClient, imageID string, memberID string) (r DeleteResult)
Delete membership for given image. Callee should be image owner.
type DetailsResult ¶
type DetailsResult struct {
// contains filtered or unexported fields
}
DetailsResult represents the result of a Get operation. Call its Extract method to interpret it as a Member.
func Get ¶
func Get(client *gophercloud.ServiceClient, imageID string, memberID string) (r DetailsResult)
Get image member details.
type Member ¶
type Member struct { CreatedAt time.Time `json:"created_at"` ImageID string `json:"image_id"` MemberID string `json:"member_id"` Schema string `json:"schema"` Status string `json:"status"` UpdatedAt time.Time `json:"updated_at"` }
Member represents a member of an Image.
func ExtractMembers ¶
func ExtractMembers(r pagination.Page) ([]Member, error)
ExtractMembers returns a slice of Members contained in a single page of results.
type MemberPage ¶
type MemberPage struct {
pagination.SinglePageBase
}
MemberPage is a single page of Members results.
func (MemberPage) IsEmpty ¶
func (r MemberPage) IsEmpty() (bool, error)
IsEmpty determines whether or not a MemberPage contains any results.
type MemberSchemas ¶
type MemberSchemas struct { // Name is the name of schemas Name string `json:"name"` // Properties is the explaination of schemas properties Properties *json.RawMessage `json:"properties"` }
MemberSchemas presents the result of getting member schemas request
type MemberSchemasResult ¶
type MemberSchemasResult struct {
// contains filtered or unexported fields
}
MemberSchemasResult represents the result of member schemas request
func (MemberSchemasResult) Extract ¶
func (r MemberSchemasResult) Extract() (*MemberSchemas, error)
Extract interprets the result as an MemberSchemas
type MembersSchemas ¶
type MembersSchemas struct { // Name is the name of schemas Name string `json:"name"` // Links is the links of schemas Links []map[string]string `json:"links"` // Properties is the explaination of schemas properties Properties *json.RawMessage `json:"properties"` }
MembersSchemas presents the result of getting members schemas request
type MembersSchemasResult ¶
type MembersSchemasResult struct {
// contains filtered or unexported fields
}
MembersSchemasResult represents the result of members schemas request
func (MembersSchemasResult) Extract ¶
func (r MembersSchemasResult) Extract() (*MembersSchemas, error)
Extract interprets the result as an MemberSchemas
type UpdateOpts ¶
type UpdateOpts struct {
Status string
}
UpdateOpts represents options to an Update request.
func (UpdateOpts) ToImageMemberUpdateMap ¶
func (opts UpdateOpts) ToImageMemberUpdateMap() (map[string]interface{}, error)
ToMemberUpdateMap formats an UpdateOpts structure into a request body.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional attributes to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of an Update operation. Call its Extract method to interpret it as a Member.
func Update ¶
func Update(client *gophercloud.ServiceClient, imageID string, memberID string, opts UpdateOptsBuilder) (r UpdateResult)
Update function updates member.