Product Help

EntraIDConnector Package Methods and Functions

CreateEntraIDConnector

func CreateEntraIDConnector(clientId, clientSecret, tenantId, servicePrincipal string) (*EntraIDConnector, error)

CreateEntraIDConnector creates a new EntraIDConnector instance based on the parameters passed in.

Parameters:

  • Each parameter corresponds to a field in the EntraIDConnector struct.

Returns:

  • *EntraIDConnector: A new instance based on the parameters.

AuthenticatedRequest

func (eic *EntraIDConnector) AuthenticatedRequest(ctx context.Context, url, requestType, contentType string, contents []byte) (*http.Response, error)

AuthenticatedRequest makes an authenticated HTTP request with the given url, request type, content type, and body of the request.

Parameters:

  • ctx: Context for the request.

  • url: The URL to send the request to.

  • requestType: GET or POST.

  • contentType: application/json ect.

  • contents: Body of the request.

Returns:

  • *http.Response: A HTTP reponse from the request.

  • error: Any errors from the method.

AuthenticatedGetRequest

func (eic *EntraIDConnector) AuthenticatedGetRequest(ctx context.Context, url string) (*http.Response, error)

AuthenticatedGetRequest calls AuthenticatedRequest and passes in GET as the request type.

Parameters:

  • ctx: Context of the request.

  • url: The URL for the request.

Returns:

  • *http.Response: The response from the HTTP request.

  • error: Any errors from the method.

AuthenticatedPostRequest

func (eic *EntraIDConnector) AuthenticatedPostRequest(ctx context.Context, url, contentType string, contents []byte) (*http.Response, error)

AuthenticatedPostRequest calls AuthenticatedRequest and passes in POST as the request type.

Parameters:

  • ctx: Context of the request.

  • url: The URL for the request.

  • contents: The body of the POST request.

Returns:

  • *http.Response: The response from the HTTP request.

  • error: Any errors from the method.

BulkRequest

func (eic *EntraIDConnector) BulkRequest(ctx context.Context, contents []byte) (*http.Response, error)

BulkRequest makes a POST request to a bulkUpload Microsoft API.

Parameters:

  • ctx: Context of the request.

  • contents: The body of the POST request.

Returns:

  • *http.Response: The response from the HTTP request.

  • error: Any errors from the method.

GetProvisioningLogs

func (eic *EntraIDConnector) GetProvisioningLogs(ctx context.Context, filter *helper_structs.ProvisioningLogsFilter) (*http.Response, error)

GetProvisioningLogs fetches the provisioning logs by making a GET request to the graph.microsoft.com/v1.0/auditLogs/provisioningEvents Microsoft endpoint. Checks the provisioning logs filter.

Parameters:

  • ctx: Context of the request.

  • filter: If filter is nil, a new provisioning logs filter will be created and attached to the query.

Returns:

  • *http.Response: The response from the HTTP request.

  • error: Any errors from the method.

ValidateMembershipRule

func (eic *EntraIDConnector) ValidateMembershipRule(ctx context.Context, membershipRule string) (bool, error)

ValidateMembershipRule makes a POST request to the graph.microsoft.com/beta/directoryObjects/validateProperties Microsoft endpoint to see if a group has a particular membershipRule.

Parameters:

  • ctx: Context of the request.

  • membershipRule: The rule you are checking.

Returns:

  • bool: Validated or Not.

  • error: Any errors from the method.

CreateDynamicGroup

func (eic *EntraIDConnector) CreateDynamicGroup(ctx context.Context, displayName, description, membershipRule string, securityEnabled, mailEnabled bool) (*http.Response, error)

CreateDynamicGroup makes a POST request to the graph.microsoft.com/v1.0/groups Microsoft endpoint to create a dynamic group.

Parameters:

  • ctx: Context of the request.

  • displayName: Parameter for the request.

  • description: Parameter for the request.

  • membershipRule: Parameter for the request.

  • securityEnabled: Parameter for the request.

  • mailEnabled: Parameter for the request.

Returns:

  • *http.Response: The response from the HTTP request.

  • error: Any errors from the method.

GetAllGroups

func (eic *EntraIDConnector) GetAllGroups(ctx context.Context) ([]models.Group, error)

GetAllGroups makes a GET request to the graph.microsoft.com/v1.0/groups Microsoft endpoint to fetch all groups.

Parameters:

  • ctx: Context of the request.

Returns:

  • []models.Group: A slice of a Group struct that describes a group.

  • error: Any errors from the method.

GetDynamicGroups

func (eic *EntraIDConnector) GetDynamicGroups(ctx context.Context) ([]models.Group, error)

GetDynamicGroups fetches dynamic groups from the graph.microsoft.com/v1.0/groups Microsoft endpoint.

Parameters:

  • ctx: Context of the request.

Returns:

  • []models.Group: A slice of a Group struct that describes a group.

  • error: Any errors from the method.

GetAllUsers

func (eic *EntraIDConnector) GetAllUsers(ctx context.Context, fields []string) ([]models.User, error)

GetAllUsers retrieves all users with mandatory fields and additional specified fields.

Parameters:

  • fields: Mandatory fields: id, userPrincipalName, groupMemberships. Additional fields can be specified via the 'fields' parameter.

  • ctx: Context of the request.

Returns:

  • []models.User: A slice of Users.

  • error: Any errors from the method.

Last modified: 28 January 2025