cloudymsgraph

package module
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const BadRequest = "Request_BadRequest"
View Source
const ImageNotFoundCode = "ImageNotFound"
View Source
const MSGraphCredentialsKey = "msgraph"
View Source
const MsGraphName = "msgraph"
View Source
const ResourceNotFoundCode = "Request_ResourceNotFound"

Variables

View Source
var AdditionalAttributes = []string{
	"customSecurityAttributes",
	"businessPhones",
	"jobTitle",
	"mobilePhone",
	"officeLocation",
	"assignedLicenses",
	"companyName",
	"authorizationInfo",
	"streetAddress",
}
View Source
var AzurePublic = MsGraphInstance{
	Name:  "Public",
	Login: "https://login.microsoftonline.com/",
	Base:  "https://graph.microsoft.com/v1.0",
}
View Source
var DefaultUserSelectFields = []string{
	"accountEnabled",
	"displayName",
	"givenName",
	"id",
	"mail",
	"surname",
	"userPrincipalName",
}
View Source
var ErrInvalidInstanceName = errors.New("invalid instance name")
View Source
var GCCHighAADP2 = "e1b29dba-2e29-4e1e-9c0b-784303f4fb7f"
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 SigninActivityField = "signInActivity"
View Source
var USGovernment = MsGraphInstance{
	Name:  "USGovernment",
	Login: "https://login.microsoftonline.us/",
	Base:  "https://graph.microsoft.us/v1.0",
}

Functions

func GetErrorCodeAndMessage added in v0.0.19

func GetErrorCodeAndMessage(ctx context.Context, err error) (string, string)

func GroupToAzure added in v0.0.9

func GroupToAzure(cg *models.Group) *graphmodels.Group

func GroupToCloudy added in v0.0.9

func GroupToCloudy(g graphmodels.Groupable) *models.Group

func ParseUserCustomSecurityAttributes added in v0.0.25

func ParseUserCustomSecurityAttributes(user *cloudymodels.User) *models.CustomSecurityAttributeValue

func UpdateAzUser added in v0.0.22

func UpdateAzUser(ctx context.Context, azUser models.Userable, cUser *cloudymodels.User)

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

func UserToPatch added in v0.0.22

func UserToPatch(user *cloudymodels.User, currentUser *cloudymodels.User) *models.User

Types

type MSGraphCredentialLoader added in v0.0.11

type MSGraphCredentialLoader struct{}

func (*MSGraphCredentialLoader) ReadFromEnv added in v0.0.11

func (loader *MSGraphCredentialLoader) ReadFromEnv(env *cloudy.Environment) interface{}

type MsGraph added in v0.0.9

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.9

func (azUM *MsGraph) Configure(azConfig *MsGraphConfig) error

func (*MsGraph) DebugSerialize added in v0.0.9

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

type MsGraphConfig added in v0.0.9

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

func (*MsGraphConfig) SetInstance added in v0.0.9

func (azConfig *MsGraphConfig) SetInstance(instance *MsGraphInstance)

func (*MsGraphConfig) SetInstanceName added in v0.0.9

func (azConfig *MsGraphConfig) SetInstanceName(name string) error

type MsGraphGroupManager added in v0.0.9

type MsGraphGroupManager struct {
	*MsGraph
}

func NewMsGraphGroupManager added in v0.0.9

func NewMsGraphGroupManager(ctx context.Context, cfg *MsGraphConfig) (*MsGraphGroupManager, error)

func (*MsGraphGroupManager) AddMembers added in v0.0.9

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.9

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

func (*MsGraphGroupManager) GetGroup added in v0.0.9

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

func (*MsGraphGroupManager) GetGroupId added in v0.0.11

func (gm *MsGraphGroupManager) GetGroupId(ctx context.Context, name string) (string, error)

func (*MsGraphGroupManager) GetGroupMembers added in v0.0.9

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.9

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

Get all the groups for a single user

func (*MsGraphGroupManager) ListGroups added in v0.0.9

func (gm *MsGraphGroupManager) ListGroups(ctx context.Context, filter string, attrs []string) (*[]models.Group, error)

List all the groups available

func (*MsGraphGroupManager) NewGroup added in v0.0.9

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

Create a new Group

func (*MsGraphGroupManager) RemoveMembers added in v0.0.9

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

Remove members from a group

func (*MsGraphGroupManager) UpdateGroup added in v0.0.9

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 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.Environment) (interface{}, error)

type MsGraphInstance added in v0.0.9

type MsGraphInstance struct {
	Name  string
	Login string
	Base  string
}

type MsGraphInviteManager added in v0.0.11

type MsGraphInviteManager struct {
	*MsGraph
}

func NewMsGraphInviteManager added in v0.0.11

func NewMsGraphInviteManager(ctx context.Context, cfg *MsGraphConfig) (*MsGraphInviteManager, error)

func (*MsGraphInviteManager) CreateInvitation added in v0.0.11

func (im *MsGraphInviteManager) CreateInvitation(ctx context.Context, user *cloudymodels.User, emailInvite bool, inviteRedirectUrl string) error

type MsGraphInviteManagerFactory added in v0.0.11

type MsGraphInviteManagerFactory struct {
	MsGraph
}

func (*MsGraphInviteManagerFactory) Create added in v0.0.11

func (ms *MsGraphInviteManagerFactory) Create(cfg interface{}) (cloudy.InviteManager, error)

func (*MsGraphInviteManagerFactory) FromEnv added in v0.0.11

func (ms *MsGraphInviteManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type MsGraphLicenseManager added in v0.0.9

type MsGraphLicenseManager struct {
	*MsGraph
}

func NewMsGraphLicenseManager added in v0.0.2

func NewMsGraphLicenseManager(ctx context.Context, cfg *MsGraphConfig) (*MsGraphLicenseManager, error)

func (*MsGraphLicenseManager) AssignLicense added in v0.0.9

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

func (*MsGraphLicenseManager) GetAssigned added in v0.0.9

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.9

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

func (*MsGraphLicenseManager) ListLicenses added in v0.0.9

ListLicenses List all the managed licenses

func (*MsGraphLicenseManager) RemoveLicense added in v0.0.9

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

type MsGraphLicenseManagerFactory added in v0.0.4

type MsGraphLicenseManagerFactory struct {
	MsGraph
}

func (*MsGraphLicenseManagerFactory) Create added in v0.0.4

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

func (*MsGraphLicenseManagerFactory) FromEnv added in v0.0.5

func (lm *MsGraphLicenseManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type MsGraphUserManager added in v0.0.9

type MsGraphUserManager struct {
	*MsGraph
}

func NewMsGraphUserManager added in v0.0.2

func NewMsGraphUserManager(ctx context.Context, cfg *MsGraphConfig) (*MsGraphUserManager, error)

func NewMsGraphUserManagerFromEnv added in v0.0.9

func NewMsGraphUserManagerFromEnv(ctx context.Context, env *cloudy.Environment) (*MsGraphUserManager, error)

func (*MsGraphUserManager) AssocateCerificateMFA added in v0.0.9

func (um *MsGraphUserManager) AssocateCerificateMFA(ctx context.Context, uid string, certId string, replace bool) error

Associates a certificate ID as a second factor authentication

func (*MsGraphUserManager) DeleteUser added in v0.0.9

func (um *MsGraphUserManager) DeleteUser(ctx context.Context, uid string) error

func (*MsGraphUserManager) Disable added in v0.0.9

func (um *MsGraphUserManager) Disable(ctx context.Context, uid string) error

func (*MsGraphUserManager) Enable added in v0.0.9

func (um *MsGraphUserManager) Enable(ctx context.Context, uid string) error

func (*MsGraphUserManager) ForceUserName added in v0.0.9

func (um *MsGraphUserManager) ForceUserName(ctx context.Context, name string) (string, bool, error)

func (*MsGraphUserManager) GetCertificateMFA added in v0.0.9

func (um *MsGraphUserManager) GetCertificateMFA(ctx context.Context, uid string) ([]string, error)

Associates a certificate ID as a second factor authentication

func (*MsGraphUserManager) GetProfilePicture added in v0.0.9

func (um *MsGraphUserManager) GetProfilePicture(ctx context.Context, uid string) ([]byte, error)

func (*MsGraphUserManager) GetUser added in v0.0.9

func (um *MsGraphUserManager) GetUser(ctx context.Context, uid string) (*cloudymodels.User, error)

func (*MsGraphUserManager) GetUserByEmail added in v0.0.11

func (um *MsGraphUserManager) GetUserByEmail(ctx context.Context, email string, opts *cloudy.UserOptions) (*cloudymodels.User, error)

func (*MsGraphUserManager) GetUserWithAttributes added in v0.0.26

func (um *MsGraphUserManager) GetUserWithAttributes(ctx context.Context, uid string, attrs []string) (*cloudymodels.User, error)

func (*MsGraphUserManager) ListUsers added in v0.0.9

func (um *MsGraphUserManager) ListUsers(ctx context.Context, filter string, attrs []string) (*[]cloudymodels.User, error)

func (*MsGraphUserManager) NewUser added in v0.0.9

func (um *MsGraphUserManager) NewUser(ctx context.Context, newUser *cloudymodels.User) (*cloudymodels.User, error)

func (*MsGraphUserManager) SetUserPassword added in v0.0.29

func (um *MsGraphUserManager) SetUserPassword(ctx context.Context, uid string, pwd string, mustChange bool) error

func (*MsGraphUserManager) UpdateUser added in v0.0.9

func (um *MsGraphUserManager) UpdateUser(ctx context.Context, usr *cloudymodels.User) error

func (*MsGraphUserManager) UploadProfilePicture added in v0.0.9

func (um *MsGraphUserManager) UploadProfilePicture(ctx context.Context, uid string, picture []byte) error

type MsGraphUserManagerFactory added in v0.0.2

type MsGraphUserManagerFactory struct {
	MsGraph
}

func (*MsGraphUserManagerFactory) Create added in v0.0.2

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

func (*MsGraphUserManagerFactory) FromEnv added in v0.0.5

func (umf *MsGraphUserManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)

type UserCustomSecurityAttributes added in v0.0.11

type UserCustomSecurityAttributes struct {
	AccountType            string `json:"AccountType,omitempty"`
	Citizenship            string `json:"Citizenship,omitempty"`
	ContractNumber         string `json:"ContractNumber,omitempty"`
	ContractExpirationDate string `json:"ContractExpirationDate,omitempty"`
	Justification          string `json:"Justification,omitempty"`
	ProgramRole            string `json:"ProgramRole,omitempty"`
	Sponsor                string `json:"Sponsor,omitempty"`
	StatusReason           string `json:"StatusReason,omitempty"`
}

Jump to

Keyboard shortcuts

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