beta

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Users                  msgraph.UrlPart = "users"
	Groups                 msgraph.UrlPart = "groups"
	AppRoleAssignments     msgraph.UrlPart = "appRoleAssignments"
	SchemaExtensions       msgraph.UrlPart = "schemaExtensions"
	DirectoryRoles         msgraph.UrlPart = "directoryRoles"
	DirectoryRoleTemplates msgraph.UrlPart = "directoryRoleTemplates"
	DirectoryObjects       msgraph.UrlPart = "directoryObjects"
	Owners                 msgraph.UrlPart = "owners"
	Members                msgraph.UrlPart = "members"
	Refs                   msgraph.UrlPart = "$ref"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRoleAssignmentResponse

type AppRoleAssignmentResponse struct {
	OData
	AppRoleAssignment
}

type AppRoleAssignmentsResponse

type AppRoleAssignmentsResponse struct {
	OData
	AppRoleAssignments []*AppRoleAssignment `json:"value"`
}

type AppRoleAssignmentsService

type AppRoleAssignmentsService service

type Client

type Client struct {
	msgraph.BaseClient

	Users                  *UsersService
	Groups                 *GroupsService
	DirectoryRoles         *DirectoryRolesService
	DirectoryRoleTemplates *DirectoryRoleTemplatesService
	SchemaExtensions       *SchemaExtensionsService
	// contains filtered or unexported fields
}

A Client manages communication with the MS Graph API.

func NewClient

func NewClient(httpClient *http.Client) *Client

func NewDefaultClient

func NewDefaultClient(ctx context.Context) *Client

NewDefaultClient creates a new client with default configuration for MS Graph Beta API

type DirectoryRoleResponse

type DirectoryRoleResponse struct {
	OData
	DirectoryRole
}

type DirectoryRoleTemplateResponse

type DirectoryRoleTemplateResponse struct {
	models.OData
	models.DirectoryRoleTemplate
}

type DirectoryRoleTemplatesResponse

type DirectoryRoleTemplatesResponse struct {
	models.OData
	DirectoryRoleTemplates []*models.DirectoryRoleTemplate `json:"value"`
}

type DirectoryRoleTemplatesService

type DirectoryRoleTemplatesService service

func (*DirectoryRoleTemplatesService) GetDirectoryRoleTemplate

func (s *DirectoryRoleTemplatesService) GetDirectoryRoleTemplate(ctx context.Context, objectOrTemplateID string) (*DirectoryRoleResponse, error)

GetDirectoryRoleTemplate retrieves the properties and relationships of a directory role template object.

You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Azure portal. For details, see Role template IDs.

GET /directoryRoleTemplates/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryrole-get?view=graph-rest-beta&tabs=http

func (*DirectoryRoleTemplatesService) ListAll

ListAll retrieves a list of directoryRoleTemplate objects.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryroletemplate-list?view=graph-rest-beta&tabs=http

type DirectoryRolesResponse

type DirectoryRolesResponse struct {
	OData
	DirectoryRoles []*DirectoryRole `json:"value"`
}

type DirectoryRolesService

type DirectoryRolesService service

func (*DirectoryRolesService) ActivateDirectoryRole

func (s *DirectoryRolesService) ActivateDirectoryRole(ctx context.Context, roleTemplateID string) (*DirectoryRoleResponse, error)

ActivateDirectoryRole activates a directory role. To read a directory role or update its members, it must first be activated in the tenant.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryrole-post-directoryroles?view=graph-rest-beta&tabs=http

func (*DirectoryRolesService) AddMember

func (s *DirectoryRolesService) AddMember(ctx context.Context, objectOrTemplateIDOfDirectoryRole, directoryObjectID string) error

AddMember creates a new directory role member. You can use both the object ID and template ID of the directoryRole with this API. The template ID of a built-in role is immutable and can be seen in the role description on the Azure portal. For details, see Role template IDs.

POST /directoryRoles/{id}/members/$ref

objectOrTemplateIDOfDirectoryRole - the object ID and template ID of the directoryRole directoryObjectID - the directory object ID e.g. user ID, group ID etc.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryrole-post-members?view=graph-rest-beta&tabs=http

func (*DirectoryRolesService) GetDirectoryRole

func (s *DirectoryRolesService) GetDirectoryRole(ctx context.Context, directoryRoleID string) (*DirectoryRoleResponse, error)

GetDirectoryRole retrieves the properties of a directoryRole object. The role must be activated in tenant for a successful response.

GET /directoryRoles/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryrole-get?view=graph-rest-beta&tabs=http

func (*DirectoryRolesService) ListAll

ListAll lists the directory roles that are activated in the tenant.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/directoryrole-list?view=graph-rest-beta&tabs=http

type GroupResponse

type GroupResponse struct {
	OData
	Group
}

type GroupsResponse

type GroupsResponse struct {
	OData
	Groups []*Group `json:"value"`
}

type GroupsService

type GroupsService service

func (*GroupsService) AddAppRoleAssignments

func (s *GroupsService) AddAppRoleAssignments(ctx context.Context, groupID, principalID, resourceID, appRoleID string) (*AppRoleAssignmentResponse, error)

AddAppRoleAssignments assigns an app role to a group. All direct members of the group will be considered assigned. To grant an app role assignment to a group, you need three identifiers:

principalId: The id of the group to which you are assigning the app role. resourceId: The id of the resource servicePrincipal which has defined the app role. appRoleId: The id of the appRole (defined on the resource service principal) to assign to the group.

POST /groups/{id}/appRoleAssignments

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-post-approleassignments?view=graph-rest-beta&tabs=http

func (*GroupsService) AddMember

func (s *GroupsService) AddMember(ctx context.Context, groupID, userID string) error

AddMember adds a member to a Microsoft 365 group or a security group through the members navigation property. You can add users, service principals or other groups.

POST /groups/{group-id}/members/$ref

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-beta&tabs=http

func (*GroupsService) AddOwner

func (s *GroupsService) AddOwner(ctx context.Context, groupID, userID string) error

AddOwner adds a user or service principal to the group's owners. The owners are a set of users or service principals who are allowed to modify the group object.

POST /groups/{id}/owners/$ref

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-post-owners?view=graph-rest-beta&tabs=http

func (*GroupsService) CreateGroup

func (s *GroupsService) CreateGroup(ctx context.Context, r *Group) (*GroupResponse, error)

CreateGroup creates a new group as specified in the request body. You can create the following types of groups:

Microsoft 365 group (unified group) Security group MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-post-groups?view=graph-rest-beta&tabs=http

func (*GroupsService) DeleteAppRoleAssignment

func (s *GroupsService) DeleteAppRoleAssignment(ctx context.Context, groupID, appRoleAssignmentID string) error

DeleteAppRoleAssignment deletes an appRoleAssignment that a group has been granted.

DELETE /groups/{id}/appRoleAssignments/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-delete-approleassignments?view=graph-rest-beta&tabs=http

func (*GroupsService) DeleteGroup

func (s *GroupsService) DeleteGroup(ctx context.Context, groupID string) error

DeleteGroup deletes group.

When deleted, Microsoft 365 groups are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. To learn more, see deletedItems. This applies only to Microsoft 365 groups. DELETE /groups/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-delete?view=graph-rest-beta&tabs=http

func (*GroupsService) GetGroup

func (s *GroupsService) GetGroup(ctx context.Context, groupID string, opts *ListOptions) (*GroupResponse, error)

GetGroup retrieves the properties and relationships of a group object.

GET /groups/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-get?view=graph-rest-beta&tabs=http

func (*GroupsService) ListAll

func (s *GroupsService) ListAll(ctx context.Context, opts *ListOptions) (*GroupsResponse, error)

ListAll lists all the groups in an organization, including but not limited to Microsoft 365 groups.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-list?view=graph-rest-beta&tabs=http

func (*GroupsService) ListAppRoleAssignments

func (s *GroupsService) ListAppRoleAssignments(ctx context.Context, groupID string, opts *ListOptions) (*AppRoleAssignmentsResponse, error)

ListAppRoleAssignments retrieves the list of appRoleAssignment that have been granted to a group.

GET /groups/{id}/appRoleAssignments

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-list-approleassignments?view=graph-rest-beta&tabs=http

func (*GroupsService) ListMembers

func (s *GroupsService) ListMembers(ctx context.Context, groupID string, opts *ListOptions) (*UsersResponse, error)

ListMembers retrieves a list of the group's direct members. A group can have users, organizational contacts, devices, service principals and other groups as members. Currently service principals are not listed as group members due to staged roll-out of service principals on Graph V1.0 endpoint. This operation is not transitive.

GET /groups/{id}/members

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-beta&tabs=http

func (*GroupsService) ListOwners

func (s *GroupsService) ListOwners(ctx context.Context, groupID string, opts *ListOptions) (*UsersResponse, error)

ListOwners retrieves a list of the group's owners. The owners are a set of users who are allowed to modify the group object. Owners are currently not available in Microsoft Graph for groups that were created in Exchange or groups that are synchronized from an on-premises environment.

GET /groups/{id}/owners

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-list-owners?view=graph-rest-beta&tabs=http

func (*GroupsService) RemoveMember

func (s *GroupsService) RemoveMember(ctx context.Context, groupID, userID string) error

RemoveMember removes a member from a group via the members navigation property.

DELETE /groups/{id}/members/{id}/$ref

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-delete-members?view=graph-rest-beta&tabs=http

func (*GroupsService) RemoveOwner

func (s *GroupsService) RemoveOwner(ctx context.Context, groupID, userID string) error

RemoveOwner removes an owner from a Microsoft 365 group, a security group, or a mail-enabled security group through the owners navigation property. Once owners are assigned to a group, the last owner of the group cannot be removed.

DELETE /groups/{id}/owners/{id}/$ref

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-delete-owners?view=graph-rest-beta&tabs=http

func (*GroupsService) UpdateGroup

func (s *GroupsService) UpdateGroup(ctx context.Context, r *Group) error

UpdateGroup updates the properties of a group object.

PATCH /groups/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-update?view=graph-rest-beta&tabs=http

type SchemaExtensionResponse

type SchemaExtensionResponse struct {
	OData
	SchemaExtension
}

type SchemaExtensionsResponse

type SchemaExtensionsResponse struct {
	OData
	SchemaExtensions []*SchemaExtension `json:"value"`
}

type SchemaExtensionsService

type SchemaExtensionsService service

func (*SchemaExtensionsService) CreateSchemaExtension

func (s *SchemaExtensionsService) CreateSchemaExtension(ctx context.Context, r SchemaExtension) (*SchemaExtensionResponse, error)

CreateSchemaExtension creates a new schemaExtension definition to extend a supporting resource type.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/schemaextension-post-schemaextensions?view=graph-rest-beta&tabs=http

func (*SchemaExtensionsService) DeleteSchemaExtension

func (s *SchemaExtensionsService) DeleteSchemaExtension(ctx context.Context, schemaExtensionID string) error

DeleteSchemaExtension deletes the definition of a schema extension. Only the app that created the schema extension (owner app) can delete the schema extension definition, and only when the extension is in the InDevelopment state. Deleting a schema extension definition does not affect accessing custom data that has been added to resource instances based on that definition.

DELETE /schemaExtensions/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/schemaextension-delete?view=graph-rest-beta&tabs=http

func (*SchemaExtensionsService) GetSchemaExtension

func (s *SchemaExtensionsService) GetSchemaExtension(ctx context.Context, schemaExtensionID string, opts *ListOptions) (*SchemaExtensionResponse, error)

GetSchemaExtension retrieves the properties of the specified schemaExtension definition.

GET /schemaExtensions/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/schemaextension-get?view=graph-rest-beta&tabs=http

func (*SchemaExtensionsService) ListAll

func (s *SchemaExtensionsService) ListAll(ctx context.Context, opts *ListOptions) (*SchemaExtensionsResponse, error)

ListAll retrieves a list of schemaExtension objects created by any apps you own in the current tenant (that can be InDevelopment, Available, or Deprecated), and all other schema extensions owned by other apps that are marked as Available.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/schemaextension-list?view=graph-rest-beta&tabs=http

func (*SchemaExtensionsService) UpdateSchemaExtension

func (s *SchemaExtensionsService) UpdateSchemaExtension(ctx context.Context, r SchemaExtension) error

UpdateSchemaExtension updates properties in the definition of the specified schemaExtension. This means custom properties or target resource types cannot be removed from the definition, but new custom properties can be added and the description of the extension changed. Additive updates to the extension can only be made when the extension is in the InDevelopment or Available status.

PATCH /schemaExtensions/{id}

Warning: * One application can only create up to 5 schema extensions. Keep that in mind! * Extension schema can be deleted only if the status is not set to "Available". (InDevelopment=>Available=>Deprecated)

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/schemaextension-update?view=graph-rest-beta&tabs=http

type UserResponse

type UserResponse struct {
	OData
	User
}

func (*UserResponse) UnmarshalJSON

func (u *UserResponse) UnmarshalJSON(data []byte) error

type UsersResponse

type UsersResponse struct {
	OData
	Users []*User `json:"value"`
}

type UsersService

type UsersService service

func (*UsersService) AddAppRoleAssignments

func (s *UsersService) AddAppRoleAssignments(ctx context.Context, userID, principalID, resourceID, appRoleID string) (*AppRoleAssignmentResponse, error)

AddAppRoleAssignments assigns an app role to a user. To grant an app role assignment to a user, you need three identifiers:

principalId: The id of the group to which you are assigning the app role. resourceId: The id of the resource servicePrincipal which has defined the app role. appRoleId: The id of the appRole (defined on the resource service principal) to assign to the group.

POST /users/{id | userPrincipalName}/appRoleAssignments

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-post-approleassignments?view=graph-rest-beta&tabs=http

func (*UsersService) CreateUser

func (s *UsersService) CreateUser(ctx context.Context, r *User) (*UserResponse, error)

CreateUser creates a new user. The request body contains the user to create. At a minimum, you must specify the required properties for the user. You can optionally specify any other writable properties.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-beta&tabs=http

func (*UsersService) DeleteAppRoleAssignment

func (s *UsersService) DeleteAppRoleAssignment(ctx context.Context, userID, appRoleAssignmentID string) error

DeleteAppRoleAssignment deletes an appRoleAssignment that has been granted to a user.

DELETE /groups/{id}/appRoleAssignments/{id}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/group-delete-approleassignments?view=graph-rest-beta&tabs=http

func (*UsersService) DeleteUser

func (s *UsersService) DeleteUser(ctx context.Context, userID string) error

DeleteUser deletes user. When deleted, user resources are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. To learn more, see deletedItems. At a minimum, you must specify the required properties for the user. You can optionally specify any other writable properties.

DELETE /users/{id | userPrincipalName}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-delete?view=graph-rest-beta&tabs=http

func (*UsersService) GetUser

func (s *UsersService) GetUser(ctx context.Context, userID string, opts *ListOptions) (*UserResponse, error)

GetUser retrieves the properties and relationships of user object.

GET /users/{id | userPrincipalName}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-beta&tabs=http

func (*UsersService) ListAll

func (s *UsersService) ListAll(ctx context.Context, opts *ListOptions) (*UsersResponse, error)

ListAll retrieves a list of user objects.

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta&tabs=http

func (*UsersService) ListAppRoleAssignments

func (s *UsersService) ListAppRoleAssignments(ctx context.Context, userID string, opts *ListOptions) (*AppRoleAssignmentsResponse, error)

ListAppRoleAssignments retrieves the list of appRoleAssignment that a user has been granted. This operation also returns app roles assigned to groups that the user is a direct member of

GET /users/{id | userPrincipalName}/appRoleAssignments

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-list-approleassignments?view=graph-rest-beta&tabs=http

func (*UsersService) UpdateSchemaExtensions

func (s *UsersService) UpdateSchemaExtensions(ctx context.Context, userID, schemaExtensionID string, schemaExtensionData map[string]string) error

UpdateSchemaExtensions updates the schema extensions of a user object. You can extend and add custom data to an existing group instance with the additional graphlearn_courses complex type extension defined in the body of a PATCH request. If you want to update the values of the extension data, put the entire extension complex type in the body of a PATCH request (similar to adding custom data to an existing resource). You can also remove custom data added to a resource instance by setting the corresponding extension property to null. To remove a schema extension from a resource instance, set the extension complex type in that instance to null.

PATCH /users/{id | userPrincipalName}

Warning: * One application can only create up to 5 schema extensions. Keep that in mind! * Extension schema can be deleted only if the status is not set to "Available". (InDevelopment=>Available=>Deprecated)

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-update?view=graph-rest-beta&tabs=http

func (*UsersService) UpdateUser

func (s *UsersService) UpdateUser(ctx context.Context, usr User) error

UpdateUser updates the properties of a user object. Not all properties can be updated by Member or Guest users with their default permissions without Administrator roles. Compare member and guest default permissions to see properties they can manage.

PATCH /users/{id | userPrincipalName}

MS Graph API doc: https://docs.microsoft.com/en-us/graph/api/user-update?view=graph-rest-beta&tabs=http

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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