Skip to content

Commit

Permalink
Merge pull request #1039 from hashicorp/deps/hamilton-0.59.0
Browse files Browse the repository at this point in the history
Update Hamilton to v0.59.0
  • Loading branch information
manicminer authored Mar 1, 2023
2 parents 75e7ea8 + e8ef9b9 commit 5d0d5ff
Show file tree
Hide file tree
Showing 67 changed files with 438 additions and 708 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
github.com/manicminer/hamilton v0.58.0
github.com/manicminer/hamilton v0.59.0
golang.org/x/text v0.7.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/manicminer/hamilton v0.43.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk=
github.com/manicminer/hamilton v0.55.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk=
github.com/manicminer/hamilton v0.58.0 h1:aMB8AN2t1sDm1RlC/qDziN3MVhLTY3j+b8rSkqV5U1M=
github.com/manicminer/hamilton v0.58.0/go.mod h1:kvNZuh/KneyjgSvx/DU/117zjgPDWV7b18LLJivHMa8=
github.com/manicminer/hamilton v0.59.0 h1:RLGwWamCtTUa53sdAbv04XzRu3e9RwJoPcAN/VReydY=
github.com/manicminer/hamilton v0.59.0/go.mod h1:kvNZuh/KneyjgSvx/DU/117zjgPDWV7b18LLJivHMa8=
github.com/manicminer/hamilton-autorest v0.3.0/go.mod h1:NselDpNTImEmOc/fa41kPg6YhDt/6S95ejWbTGZ6tlg=
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func administrativeUnitMemberResource() *schema.Resource {
func administrativeUnitMemberResourceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient
directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient
tenantId := meta.(*clients.Client).TenantID

id := parse.NewAdministrativeUnitMemberID(d.Get("administrative_unit_object_id").(string), d.Get("member_object_id").(string))

Expand Down Expand Up @@ -96,7 +97,7 @@ func administrativeUnitMemberResourceCreate(ctx context.Context, d *schema.Resou
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", id.MemberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, id.MemberId)))
client.BaseClient.Endpoint, tenantId, id.MemberId)))

members := &msgraph.Members{*memberObject}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func administrativeUnitResourceCustomizeDiff(ctx context.Context, diff *schema.R
func administrativeUnitResourceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient
directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient
tenantId := meta.(*clients.Client).TenantID

displayName := d.Get("display_name").(string)

Expand Down Expand Up @@ -197,7 +198,7 @@ func administrativeUnitResourceCreate(ctx context.Context, d *schema.ResourceDat
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", memberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, memberId)))
client.BaseClient.Endpoint, tenantId, memberId)))

members = append(members, *memberObject)
}
Expand All @@ -214,6 +215,7 @@ func administrativeUnitResourceCreate(ctx context.Context, d *schema.ResourceDat
func administrativeUnitResourceUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient
directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient
tenantId := meta.(*clients.Client).TenantID

administrativeUnitId := d.Id()
displayName := d.Get("display_name").(string)
Expand Down Expand Up @@ -287,7 +289,7 @@ func administrativeUnitResourceUpdate(ctx context.Context, d *schema.ResourceDat
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", memberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, memberId)))
client.BaseClient.Endpoint, tenantId, memberId)))

newMembers = append(newMembers, *memberObject)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/services/administrativeunits/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
administrativeUnitsClient := msgraph.NewAdministrativeUnitsClient(o.TenantID)
administrativeUnitsClient := msgraph.NewAdministrativeUnitsClient()
o.ConfigureClient(&administrativeUnitsClient.BaseClient)

// SDK uses wrong endpoint for v1.0 API, see https://github.com/manicminer/hamilton/issues/222
administrativeUnitsClient.BaseClient.ApiVersion = msgraph.VersionBeta

directoryObjectsClient := msgraph.NewDirectoryObjectsClient(o.TenantID)
directoryObjectsClient := msgraph.NewDirectoryObjectsClient()
o.ConfigureClient(&directoryObjectsClient.BaseClient)

return &Client{
Expand Down
8 changes: 5 additions & 3 deletions internal/services/applications/application_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ func applicationResourceCreate(ctx context.Context, d *schema.ResourceData, meta
appTemplatesClient := meta.(*clients.Client).Applications.ApplicationTemplatesClient
directoryObjectsClient := meta.(*clients.Client).Applications.DirectoryObjectsClient
callerId := meta.(*clients.Client).ObjectID
tenantId := meta.(*clients.Client).TenantID
displayName := d.Get("display_name").(string)
templateId := d.Get("template_id").(string)

Expand Down Expand Up @@ -1009,7 +1010,7 @@ func applicationResourceCreate(ctx context.Context, d *schema.ResourceData, meta

// @odata.id returned by API cannot be relied upon, so construct our own
callerObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, callerId)))
client.BaseClient.Endpoint, tenantId, callerId)))

ownersFirst20 := msgraph.Owners{*callerObject}
var ownersExtra msgraph.Owners
Expand All @@ -1031,7 +1032,7 @@ func applicationResourceCreate(ctx context.Context, d *schema.ResourceData, meta

ownerObject := msgraph.DirectoryObject{
ODataId: (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, ownerId))),
client.BaseClient.Endpoint, tenantId, ownerId))),
Id: &ownerId,
}

Expand Down Expand Up @@ -1115,6 +1116,7 @@ func applicationResourceCreate(ctx context.Context, d *schema.ResourceData, meta

func applicationResourceUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).Applications.ApplicationsClient
tenantId := meta.(*clients.Client).TenantID
applicationId := d.Id()
displayName := d.Get("display_name").(string)

Expand Down Expand Up @@ -1211,7 +1213,7 @@ func applicationResourceUpdate(ctx context.Context, d *schema.ResourceData, meta
for _, ownerId := range ownersToAdd {
newOwners = append(newOwners, msgraph.DirectoryObject{
ODataId: (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, ownerId))),
client.BaseClient.Endpoint, tenantId, ownerId))),
Id: &ownerId,
})
}
Expand Down
6 changes: 3 additions & 3 deletions internal/services/applications/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
applicationsClient := msgraph.NewApplicationsClient(o.TenantID)
applicationsClient := msgraph.NewApplicationsClient()
o.ConfigureClient(&applicationsClient.BaseClient)

// See https://github.com/microsoftgraph/msgraph-metadata/issues/273
applicationsClient.BaseClient.ApiVersion = msgraph.VersionBeta

applicationTemplatesClient := msgraph.NewApplicationTemplatesClient(o.TenantID)
applicationTemplatesClient := msgraph.NewApplicationTemplatesClient()
o.ConfigureClient(&applicationTemplatesClient.BaseClient)

directoryObjectsClient := msgraph.NewDirectoryObjectsClient(o.TenantID)
directoryObjectsClient := msgraph.NewDirectoryObjectsClient()
o.ConfigureClient(&directoryObjectsClient.BaseClient)

return &Client{
Expand Down
4 changes: 2 additions & 2 deletions internal/services/approleassignments/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
appRoleAssignedToClient := msgraph.NewAppRoleAssignedToClient(o.TenantID)
appRoleAssignedToClient := msgraph.NewAppRoleAssignedToClient()
o.ConfigureClient(&appRoleAssignedToClient.BaseClient)

servicePrincipalsClient := msgraph.NewServicePrincipalsClient(o.TenantID)
servicePrincipalsClient := msgraph.NewServicePrincipalsClient()
o.ConfigureClient(&servicePrincipalsClient.BaseClient)

return &Client{
Expand Down
4 changes: 2 additions & 2 deletions internal/services/conditionalaccess/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
namedLocationsClient := msgraph.NewNamedLocationsClient(o.TenantID)
namedLocationsClient := msgraph.NewNamedLocationsClient()
o.ConfigureClient(&namedLocationsClient.BaseClient)

policiesClient := msgraph.NewConditionalAccessPoliciesClient(o.TenantID)
policiesClient := msgraph.NewConditionalAccessPoliciesClient()
o.ConfigureClient(&policiesClient.BaseClient)

return &Client{
Expand Down
2 changes: 1 addition & 1 deletion internal/services/directoryobjects/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
directoryObjectsClient := msgraph.NewDirectoryObjectsClient(o.TenantID)
directoryObjectsClient := msgraph.NewDirectoryObjectsClient()
o.ConfigureClient(&directoryObjectsClient.BaseClient)

return &Client{
Expand Down
10 changes: 5 additions & 5 deletions internal/services/directoryroles/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
directoryObjectsClient := msgraph.NewDirectoryObjectsClient(o.TenantID)
directoryObjectsClient := msgraph.NewDirectoryObjectsClient()
o.ConfigureClient(&directoryObjectsClient.BaseClient)

directoryRolesClient := msgraph.NewDirectoryRolesClient(o.TenantID)
directoryRolesClient := msgraph.NewDirectoryRolesClient()
o.ConfigureClient(&directoryRolesClient.BaseClient)

directoryRoleTemplatesClient := msgraph.NewDirectoryRoleTemplatesClient(o.TenantID)
directoryRoleTemplatesClient := msgraph.NewDirectoryRoleTemplatesClient()
o.ConfigureClient(&directoryRoleTemplatesClient.BaseClient)

roleAssignmentsClient := msgraph.NewRoleAssignmentsClient(o.TenantID)
roleAssignmentsClient := msgraph.NewRoleAssignmentsClient()
o.ConfigureClient(&roleAssignmentsClient.BaseClient)

roleDefinitionsClient := msgraph.NewRoleDefinitionsClient(o.TenantID)
roleDefinitionsClient := msgraph.NewRoleDefinitionsClient()
o.ConfigureClient(&roleDefinitionsClient.BaseClient)

return &Client{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func directoryRoleMemberResource() *schema.Resource {
func directoryRoleMemberResourceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient
directoryObjectsClient := meta.(*clients.Client).DirectoryRoles.DirectoryObjectsClient
tenantId := meta.(*clients.Client).TenantID

id := parse.NewDirectoryRoleMemberID(d.Get("role_object_id").(string), d.Get("member_object_id").(string))

Expand Down Expand Up @@ -98,7 +99,7 @@ func directoryRoleMemberResourceCreate(ctx context.Context, d *schema.ResourceDa
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", id.MemberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, id.MemberId)))
client.BaseClient.Endpoint, tenantId, id.MemberId)))

role.Members = &msgraph.Members{*memberObject}

Expand Down
2 changes: 1 addition & 1 deletion internal/services/domains/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
msClient := msgraph.NewDomainsClient(o.TenantID)
msClient := msgraph.NewDomainsClient()
o.ConfigureClient(&msClient.BaseClient)

return &Client{
Expand Down
3 changes: 2 additions & 1 deletion internal/services/domains/domains_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func domainsDataSource() *schema.Resource {
func domainsDataSourceRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).Domains.DomainsClient
client.BaseClient.DisableRetries = true
tenantId := meta.(*clients.Client).TenantID

adminManaged := d.Get("admin_managed").(bool)
onlyDefault := d.Get("only_default").(bool)
Expand Down Expand Up @@ -208,7 +209,7 @@ func domainsDataSourceRead(ctx context.Context, d *schema.ResourceData, meta int
return tf.ErrorDiagF(err, "Unable to compute hash for domain names")
}

d.SetId(fmt.Sprintf("domains#%s#%s", client.BaseClient.TenantId, base64.URLEncoding.EncodeToString(h.Sum(nil))))
d.SetId(fmt.Sprintf("domains#%s#%s", tenantId, base64.URLEncoding.EncodeToString(h.Sum(nil))))
tf.Set(d, "domains", domains)

return nil
Expand Down
6 changes: 3 additions & 3 deletions internal/services/groups/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
administrativeUnitsClient := msgraph.NewAdministrativeUnitsClient(o.TenantID)
administrativeUnitsClient := msgraph.NewAdministrativeUnitsClient()
o.ConfigureClient(&administrativeUnitsClient.BaseClient)

// SDK uses wrong endpoint for v1.0 API, see https://github.com/manicminer/hamilton/issues/222
administrativeUnitsClient.BaseClient.ApiVersion = msgraph.VersionBeta

directoryObjectsClient := msgraph.NewDirectoryObjectsClient(o.TenantID)
directoryObjectsClient := msgraph.NewDirectoryObjectsClient()
o.ConfigureClient(&directoryObjectsClient.BaseClient)

groupsClient := msgraph.NewGroupsClient(o.TenantID)
groupsClient := msgraph.NewGroupsClient()
o.ConfigureClient(&groupsClient.BaseClient)

// Group members not returned in full when using v1.0 API, see https://github.com/hashicorp/terraform-provider-azuread/issues/1018
Expand Down
3 changes: 2 additions & 1 deletion internal/services/groups/group_member_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func groupMemberResource() *schema.Resource {
func groupMemberResourceCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(*clients.Client).Groups.GroupsClient
directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient
tenantId := meta.(*clients.Client).TenantID
groupId := d.Get("group_object_id").(string)
memberId := d.Get("member_object_id").(string)

Expand Down Expand Up @@ -102,7 +103,7 @@ func groupMemberResourceCreate(ctx context.Context, d *schema.ResourceData, meta
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", memberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, memberId)))
client.BaseClient.Endpoint, tenantId, memberId)))

group.Members = &msgraph.Members{*memberObject}

Expand Down
18 changes: 10 additions & 8 deletions internal/services/groups/group_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func groupResourceCreate(ctx context.Context, d *schema.ResourceData, meta inter
directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient
administrativeUnitsClient := meta.(*clients.Client).Groups.AdministrativeUnitsClient
callerId := meta.(*clients.Client).ObjectID
tenantId := meta.(*clients.Client).TenantID

displayName := d.Get("display_name").(string)

Expand Down Expand Up @@ -521,7 +522,7 @@ func groupResourceCreate(ctx context.Context, d *schema.ResourceData, meta inter
// return nil, errors.New("ODataId was nil")
//}
ownerObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, id)))
client.BaseClient.Endpoint, tenantId, id)))

if ownerObject.ODataType == nil {
return nil, errors.New("ownerObject ODataType was nil")
Expand Down Expand Up @@ -624,7 +625,7 @@ func groupResourceCreate(ctx context.Context, d *schema.ResourceData, meta inter
}
}
} else {
err = addGroupToAdministrativeUnit(ctx, administrativeUnitsClient, administrativeUnitId, group)
err = addGroupToAdministrativeUnit(ctx, administrativeUnitsClient, tenantId, administrativeUnitId, group)
if err != nil {
return tf.ErrorDiagF(err, "Adding group %q to administrative unit with object ID: %q", *group.ID(), administrativeUnitId)
}
Expand Down Expand Up @@ -879,7 +880,7 @@ func groupResourceCreate(ctx context.Context, d *schema.ResourceData, meta inter
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve member principal object %q", memberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, memberId)))
client.BaseClient.Endpoint, tenantId, memberId)))

members = append(members, *memberObject)
}
Expand Down Expand Up @@ -907,6 +908,7 @@ func groupResourceUpdate(ctx context.Context, d *schema.ResourceData, meta inter
directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient
administrativeUnitClient := meta.(*clients.Client).Groups.AdministrativeUnitsClient
callerId := meta.(*clients.Client).ObjectID
tenantId := meta.(*clients.Client).TenantID

groupId := d.Id()
displayName := d.Get("display_name").(string)
Expand Down Expand Up @@ -1111,7 +1113,7 @@ func groupResourceUpdate(ctx context.Context, d *schema.ResourceData, meta inter
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve owner principal object %q", memberId)
//}
memberObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, memberId)))
client.BaseClient.Endpoint, tenantId, memberId)))

newMembers = append(newMembers, *memberObject)
}
Expand Down Expand Up @@ -1156,7 +1158,7 @@ func groupResourceUpdate(ctx context.Context, d *schema.ResourceData, meta inter
// return tf.ErrorDiagF(errors.New("ODataId was nil"), "Could not retrieve owner principal object %q", ownerId)
//}
ownerObject.ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
client.BaseClient.Endpoint, client.BaseClient.TenantId, ownerId)))
client.BaseClient.Endpoint, tenantId, ownerId)))

newOwners = append(newOwners, *ownerObject)
}
Expand Down Expand Up @@ -1191,7 +1193,7 @@ func groupResourceUpdate(ctx context.Context, d *schema.ResourceData, meta inter

if len(administrativeUnitsToJoin) > 0 {
for _, newAdministrativeUnitId := range administrativeUnitsToJoin {
err := addGroupToAdministrativeUnit(ctx, administrativeUnitClient, newAdministrativeUnitId, &group)
err := addGroupToAdministrativeUnit(ctx, administrativeUnitClient, tenantId, newAdministrativeUnitId, &group)
if err != nil {
return tf.ErrorDiagF(err, "Could not add group %q to administrative unit with object ID: %q", *group.ID(), newAdministrativeUnitId)
}
Expand Down Expand Up @@ -1354,12 +1356,12 @@ func groupResourceDelete(ctx context.Context, d *schema.ResourceData, meta inter
return nil
}

func addGroupToAdministrativeUnit(ctx context.Context, auClient *msgraph.AdministrativeUnitsClient, administrativeUnitId string, group *msgraph.Group) error {
func addGroupToAdministrativeUnit(ctx context.Context, auClient *msgraph.AdministrativeUnitsClient, tenantId, administrativeUnitId string, group *msgraph.Group) error {
members := msgraph.Members{
group.DirectoryObject,
}
members[0].ODataId = (*odata.Id)(utils.String(fmt.Sprintf("%s/v1.0/%s/directoryObjects/%s",
auClient.BaseClient.Endpoint, auClient.BaseClient.TenantId, *group.DirectoryObject.ID())))
auClient.BaseClient.Endpoint, tenantId, *group.DirectoryObject.ID())))
_, err := auClient.AddMembers(ctx, administrativeUnitId, &members)
return err
}
4 changes: 2 additions & 2 deletions internal/services/invitations/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
invitationsClient := msgraph.NewInvitationsClient(o.TenantID)
invitationsClient := msgraph.NewInvitationsClient()
o.ConfigureClient(&invitationsClient.BaseClient)

usersClient := msgraph.NewUsersClient(o.TenantID)
usersClient := msgraph.NewUsersClient()
o.ConfigureClient(&usersClient.BaseClient)

return &Client{
Expand Down
2 changes: 1 addition & 1 deletion internal/services/policies/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Client struct {
}

func NewClient(o *common.ClientOptions) *Client {
claimsMappingPolicyClient := msgraph.NewClaimsMappingPolicyClient(o.TenantID)
claimsMappingPolicyClient := msgraph.NewClaimsMappingPolicyClient()
o.ConfigureClient(&claimsMappingPolicyClient.BaseClient)

return &Client{
Expand Down
Loading

0 comments on commit 5d0d5ff

Please sign in to comment.