cloudymsgraph

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MSGraphName = "msgraph"
View Source
const MSGraphVersionBeta = "beta"
View Source
const MSGraphVersionV1 = "v1.0"

Variables

View Source
var AzurePublic = MSGraphInstance{
	Name:  "Public",
	Login: "https://login.microsoftonline.com/",
	Base:  "https://graph.microsoft.com/",
}
View Source
var DefaultUserSelectFields = []string{
	"businessPhones",
	"displayName",
	"givenName",
	"id",
	"jobTitle",
	"mail",
	"mobilePhone",
	"officeLocation",
	"surname",
	"userPrincipalName",
	"assignedLicenses",
	"companyName",
}
View Source
var ErrInvalidInstanceName = errors.New("invalid instance name")
View Source
var GCCHighOffice365E3 = "aea38a85-9bd5-4981-aa00-616b411205bf"
View Source
var GCCHighProjectPlan3 = "64758d81-92b7-4855-bcac-06617becb3e8"
View Source
var GCCHighTeamsAudio = "4dee1f32-0808-4fd2-a2ed-fdd575e3a45f"
View Source
var GCCHighTeamsPhone = "985fcb26-7b94-475b-b512-89356697be71"
View Source
var GCCHighVisioPlan1 = "50a4284d-f0b2-4779-8de6-72c5f9b4349f"
View Source
var USGovernment = MSGraphInstance{
	Name:  "USGovernment",
	Login: "https://login.microsoftonline.us/",
	Base:  "https://graph.microsoft.us/",
}

Functions

func UserToAzure added in v0.0.2

func UserToAzure(user *cloudymodels.User) *models.User

func UserToCloudy added in v0.0.2

func UserToCloudy(user models.Userable) *cloudymodels.User

Types

type AzureUserManager

type AzureUserManager struct {
	Client  *msgraphsdk.GraphServiceClient
	Adapter *msgraphsdk.GraphRequestAdapter
	Cfg     *MSGraphConfig
}

func NewMsGraphUserManager added in v0.0.2

func NewMsGraphUserManager(ctx context.Context, cfg *MSGraphConfig) (*AzureUserManager, error)

func (*AzureUserManager) Configure

func (azum *AzureUserManager) Configure(cfg interface{}) error

func (*AzureUserManager) DebugSerialize

func (azum *AzureUserManager) DebugSerialize(v serialization.Parsable)

func (*AzureUserManager) DeleteUser

func (azum *AzureUserManager) DeleteUser(ctx context.Context, uid string) error

func (*AzureUserManager) Disable

func (azum *AzureUserManager) Disable(ctx context.Context, uid string) error

func (*AzureUserManager) Enable

func (azum *AzureUserManager) Enable(ctx context.Context, uid string) error

func (*AzureUserManager) ForceUserName added in v0.0.2

func (azum *AzureUserManager) ForceUserName(ctx context.Context, name string) (string, bool, error)

func (*AzureUserManager) GetUser

func (azum *AzureUserManager) GetUser(ctx context.Context, uid string) (*cloudymodels.User, error)

func (*AzureUserManager) ListUsers

func (azum *AzureUserManager) ListUsers(ctx context.Context, page interface{}, filter interface{}) ([]*cloudymodels.User, interface{}, error)

func (*AzureUserManager) NewUser

func (azum *AzureUserManager) NewUser(ctx context.Context, newUser *cloudymodels.User) (*cloudymodels.User, error)

func (*AzureUserManager) UpdateUser

func (azum *AzureUserManager) UpdateUser(ctx context.Context, usr *cloudymodels.User) error

type MSGraph

type MSGraph struct {
	Client  *msgraphsdk.GraphServiceClient
	Adapter *msgraphsdk.GraphRequestAdapter
	Cfg     *MSGraphConfig
}

func NewGraph

func NewGraph(ctx context.Context, tenantID string, clientID string, clientSecret string) (*MSGraph, error)

func (*MSGraph) Configure added in v0.0.2

func (azum *MSGraph) Configure(azCfg *MSGraphConfig) error

func (*MSGraph) DebugSerialize

func (graph *MSGraph) DebugSerialize(v serialization.Parsable)

type MSGraphConfig added in v0.0.2

type MSGraphConfig struct {
	TenantID     string
	ClientID     string
	ClientSecret string
	Region       string
	APIBase      string
	Version      string
	SelectFields []string
}

func (*MSGraphConfig) SetInstance added in v0.0.2

func (azcfg *MSGraphConfig) SetInstance(instance *MSGraphInstance)

func (*MSGraphConfig) SetInstanceName added in v0.0.2

func (azcfg *MSGraphConfig) SetInstanceName(name string) error

type MSGraphGroupManager added in v0.0.2

type MSGraphGroupManager struct {
	*MSGraph
}

func NewMSGraphGroupManager added in v0.0.2

func NewMSGraphGroupManager(ctx context.Context, cfg *MSGraphConfig) (*MSGraphGroupManager, error)

func (*MSGraphGroupManager) AddMembers added in v0.0.2

func (gm *MSGraphGroupManager) AddMembers(ctx context.Context, groupId string, userIds []string) error

Add member(s) to a group

func (*MSGraphGroupManager) DeleteGroup added in v0.0.2

func (gm *MSGraphGroupManager) DeleteGroup(ctx context.Context, groupId string) error

func (*MSGraphGroupManager) GetGroup added in v0.0.2

func (gm *MSGraphGroupManager) GetGroup(ctx context.Context, id string) (*models.Group, error)

func (*MSGraphGroupManager) GetGroupMembers added in v0.0.2

func (gm *MSGraphGroupManager) GetGroupMembers(ctx context.Context, grpId string) ([]*models.User, error)

Get all the members of a group. This returns partial users only, typically just the user id, name and email fields

func (*MSGraphGroupManager) GetUserGroups added in v0.0.2

func (gm *MSGraphGroupManager) GetUserGroups(ctx context.Context, uid string) ([]*models.Group, error)

Get all the groups for a single user

func (*MSGraphGroupManager) ListGroups added in v0.0.2

func (gm *MSGraphGroupManager) ListGroups(ctx context.Context) ([]*models.Group, error)

List all the groups available

func (*MSGraphGroupManager) NewGroup added in v0.0.2

func (gm *MSGraphGroupManager) NewGroup(ctx context.Context, grp *models.Group) (*models.Group, error)

Create a new Group

func (*MSGraphGroupManager) RemoveMembers added in v0.0.2

func (gm *MSGraphGroupManager) RemoveMembers(ctx context.Context, groupId string, userIds []string) error

Remove members from a group

func (*MSGraphGroupManager) ToAzure added in v0.0.2

func (gm *MSGraphGroupManager) ToAzure(cg *models.Group) *graphmodels.Group

func (*MSGraphGroupManager) ToCloudy added in v0.0.2

func (*MSGraphGroupManager) UpdateGroup added in v0.0.2

func (gm *MSGraphGroupManager) UpdateGroup(ctx context.Context, grp *models.Group) (bool, error)

Update a group. This is generally just the name of the group.

type MSGraphInstance

type MSGraphInstance struct {
	Name  string
	Login string
	Base  string
}

type MSGraphLicenseManager added in v0.0.4

type MSGraphLicenseManager struct {
	*MSGraph
}

func NewMSGraphLicenseManager added in v0.0.4

func NewMSGraphLicenseManager(ctx context.Context, cfg *MSGraphConfig) (*MSGraphLicenseManager, error)

func NewMsGraphLicenseManager added in v0.0.2

func NewMsGraphLicenseManager(ctx context.Context, cfg *MSGraphConfig) (*MSGraphLicenseManager, error)

func (*MSGraphLicenseManager) AssignLicense added in v0.0.4

func (lm *MSGraphLicenseManager) AssignLicense(ctx context.Context, userId string, licenseSkus ...string) error

func (*MSGraphLicenseManager) GetAssigned added in v0.0.4

func (lm *MSGraphLicenseManager) GetAssigned(ctx context.Context, licenseSku string) ([]*cloudymodels.User, error)

GetAssigned gets a list of all the users with licenses https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/any(s:s/skuId eq 184efa21-98c3-4e5d-95ab-d07053a96e67) SEE : https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter

func (*MSGraphLicenseManager) GetUserAssigned added in v0.0.4

func (lm *MSGraphLicenseManager) GetUserAssigned(ctx context.Context, uid string) ([]*license.LicenseDescription, error)

func (*MSGraphLicenseManager) ListLicenses added in v0.0.4

ListLicenses List all the managed licenses

func (*MSGraphLicenseManager) RemoveLicense added in v0.0.4

func (lm *MSGraphLicenseManager) RemoveLicense(ctx context.Context, userId string, licenseSkus ...string) error

type MsGraphGroupManagerFactory added in v0.0.2

type MsGraphGroupManagerFactory struct {
	MSGraph
}

func (*MsGraphGroupManagerFactory) Create added in v0.0.2

func (ms *MsGraphGroupManagerFactory) Create(cfg interface{}) (cloudy.GroupManager, error)

func (*MsGraphGroupManagerFactory) FromEnv added in v0.0.5

func (ms *MsGraphGroupManagerFactory) FromEnv(env *cloudy.SegmentedEnvironment) (interface{}, error)

type MsGraphLicenseManagerFactory added in v0.0.4

type MsGraphLicenseManagerFactory struct {
	MSGraph
}

func (*MsGraphLicenseManagerFactory) Create added in v0.0.4

func (ms *MsGraphLicenseManagerFactory) Create(cfg interface{}) (license.LicenseManager, error)

func (*MsGraphLicenseManagerFactory) FromEnv added in v0.0.5

func (ms *MsGraphLicenseManagerFactory) FromEnv(env *cloudy.SegmentedEnvironment) (interface{}, error)

type MsGraphUserManagerFactory added in v0.0.2

type MsGraphUserManagerFactory struct{}

func (*MsGraphUserManagerFactory) Create added in v0.0.2

func (ms *MsGraphUserManagerFactory) Create(cfg interface{}) (cloudy.UserManager, error)

func (*MsGraphUserManagerFactory) FromEnv added in v0.0.5

func (ms *MsGraphUserManagerFactory) FromEnv(env *cloudy.SegmentedEnvironment) (interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL