github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/imageservice/v2/members/doc.go (about) 1 /* 2 Package members enables management and retrieval of image members. 3 4 Members are projects other than the image owner who have access to the image. 5 6 Example to List Members of an Image 7 8 imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" 9 10 allPages, err := members.List(imageID).AllPages() 11 if err != nil { 12 panic(err) 13 } 14 15 allMembers, err := members.ExtractMembers(allPages) 16 if err != nil { 17 panic(err) 18 } 19 20 for _, member := range allMembers { 21 fmt.Printf("%+v\n", member) 22 } 23 24 Example to Add a Member to an Image 25 26 imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" 27 projectID := "fc404778935a4cebaddcb4788fb3ff2c" 28 29 member, err := members.Create(imageClient, imageID, projectID).Extract() 30 if err != nil { 31 panic(err) 32 } 33 34 Example to Update the Status of a Member 35 36 imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" 37 projectID := "fc404778935a4cebaddcb4788fb3ff2c" 38 39 updateOpts := members.UpdateOpts{ 40 Status: "accepted", 41 } 42 43 member, err := members.Update(imageClient, imageID, projectID, updateOpts).Extract() 44 if err != nil { 45 panic(err) 46 } 47 48 Example to Delete a Member from an Image 49 50 imageID := "2b6cacd4-cfd6-4b95-8302-4c04ccf0be3f" 51 projectID := "fc404778935a4cebaddcb4788fb3ff2c" 52 53 err := members.Delete(imageClient, imageID, projectID).ExtractErr() 54 if err != nil { 55 panic(err) 56 } 57 */ 58 package members