Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,7 @@ for _, item := range items {
ctx := context.TODO()
id := administrativeunit.NewAdministrativeUnitID("administrativeUnitId")

payload := administrativeunit.RestoreRequest{
// ...
}


read, err := client.Restore(ctx, id, payload, administrativeunit.DefaultRestoreOperationOptions())
read, err := client.Restore(ctx, id, administrativeunit.DefaultRestoreOperationOptions())
if err != nil {
// handle the error
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ func (p *CheckMemberGroupsCustomPager) NextPageLink() *odata.Link {
}

// CheckMemberGroups - Invoke action checkMemberGroups. Check for membership in a specified list of group IDs, and
// return from that list those groups (identified by IDs) of which the specified user, group, service principal,
// organizational contact, device, or directory object is a member. This function is transitive. You can check up to a
// maximum of 20 groups per request. This function supports all groups provisioned in Microsoft Entra ID. Because
// Microsoft 365 groups cannot contain other groups, membership in a Microsoft 365 group is always direct.
// return from that list the IDs of groups where a specified object is a member. The specified object can be of one of
// the following types: - user - group - service principal - organizational contact - device - directory object This
// function is transitive. You can check up to a maximum of 20 groups per request. This function supports all groups
// provisioned in Microsoft Entra ID. Because Microsoft 365 groups cannot contain other groups, membership in a
// Microsoft 365 group is always direct.
func (c AdministrativeUnitClient) CheckMemberGroups(ctx context.Context, id beta.AdministrativeUnitId, input CheckMemberGroupsRequest, options CheckMemberGroupsOperationOptions) (result CheckMemberGroupsOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (o CreateAdministrativeUnitOperationOptions) ToQuery() *client.QueryParams
return &out
}

// CreateAdministrativeUnit - Create administrativeUnit. Use this API to create a new administrativeUnit.
// CreateAdministrativeUnit - Create administrativeUnit. Create a new administrativeUnit.
func (c AdministrativeUnitClient) CreateAdministrativeUnit(ctx context.Context, input beta.AdministrativeUnit, options CreateAdministrativeUnitOperationOptions) (result CreateAdministrativeUnitOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (o CreateValidatesPropertyOperationOptions) ToQuery() *client.QueryParams {
// nickname properties: 1. Validate the prefix and suffix naming policy 2. Validate the custom banned words policy 3.
// Validate the mail nickname is unique This API returns with the first failure encountered. If one or more properties
// fail multiple validations, only the property with the first validation failure is returned. However, you can validate
// both the mail nickname and the display name and receive a collection of validation errors if you are only validating
// both the mail nickname and the display name and receive a collection of validation errors if you're only validating
// the prefix and suffix naming policy.
func (c AdministrativeUnitClient) CreateValidatesProperty(ctx context.Context, input CreateValidatesPropertyRequest, options CreateValidatesPropertyOperationOptions) (result CreateValidatesPropertyOperationResponse, err error) {
opts := client.RequestOptions{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ func (o RestoreOperationOptions) ToQuery() *client.QueryParams {
return &out
}

// Restore - Invoke action restore. Restore a recently deleted application, externalUserProfile, group,
// pendingExternalUserProfile, servicePrincipal, administrative unit, or user object from deleted items. If an item was
// accidentally deleted, you can fully restore the item. This isn't applicable to security groups, which are deleted
// permanently. Also, restoring an application doesn't restore the associated service principal automatically. You must
// call this API to explicitly restore the deleted service principal. A recently deleted item remains available for up
// to 30 days. After 30 days, the item is permanently deleted.
func (c AdministrativeUnitClient) Restore(ctx context.Context, id beta.AdministrativeUnitId, input RestoreRequest, options RestoreOperationOptions) (result RestoreOperationResponse, err error) {
// Restore - Invoke action restore. Restore a recently deleted directory object from deleted items. The following types
// are supported: - administrativeUnit - application - certificateBasedAuthPki - certificateAuthorityDetail -
// externalUserProfile - group - pendingExternalUserProfile - servicePrincipal - user If an item was accidentally
// deleted, you can fully restore the item. This isn't applicable to security groups, which are deleted permanently.
// Also, restoring an application doesn't restore the associated service principal automatically. You must call this API
// to explicitly restore the deleted service principal. A recently deleted item remains available for up to 30 days.
// After 30 days, the item is permanently deleted.
func (c AdministrativeUnitClient) Restore(ctx context.Context, id beta.AdministrativeUnitId, options RestoreOperationOptions) (result RestoreOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
Expand All @@ -75,10 +76,6 @@ func (c AdministrativeUnitClient) Restore(ctx context.Context, id beta.Administr
return
}

if err = req.Marshal(input); err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (o UpdateAdministrativeUnitOperationOptions) ToQuery() *client.QueryParams
return &out
}

// UpdateAdministrativeUnit - Update administrativeunit. Update the properties of an administrativeUnit object.
// UpdateAdministrativeUnit - Update administrativeUnit. Update the properties of an administrativeUnit object.
func (c AdministrativeUnitClient) UpdateAdministrativeUnit(ctx context.Context, id beta.AdministrativeUnitId, input beta.AdministrativeUnit, options UpdateAdministrativeUnitOperationOptions) (result UpdateAdministrativeUnitOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
Expand Down

This file was deleted.

9 changes: 9 additions & 0 deletions microsoft-graph/administrativeunits/beta/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"

"github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/administrativeunit"
"github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/deletedmember"
"github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/extension"
"github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/member"
"github.com/hashicorp/go-azure-sdk/microsoft-graph/administrativeunits/beta/scopedrolemember"
Expand All @@ -16,6 +17,7 @@ import (

type Client struct {
AdministrativeUnit *administrativeunit.AdministrativeUnitClient
DeletedMember *deletedmember.DeletedMemberClient
Extension *extension.ExtensionClient
Member *member.MemberClient
ScopedRoleMember *scopedrolemember.ScopedRoleMemberClient
Expand All @@ -28,6 +30,12 @@ func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *msgraph.Clien
}
configureFunc(administrativeUnitClient.Client)

deletedMemberClient, err := deletedmember.NewDeletedMemberClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building DeletedMember client: %+v", err)
}
configureFunc(deletedMemberClient.Client)

extensionClient, err := extension.NewExtensionClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Extension client: %+v", err)
Expand All @@ -48,6 +56,7 @@ func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *msgraph.Clien

return &Client{
AdministrativeUnit: administrativeUnitClient,
DeletedMember: deletedMemberClient,
Extension: extensionClient,
Member: memberClient,
ScopedRoleMember: scopedRoleMemberClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package deletedmember

import (
"fmt"

"github.com/hashicorp/go-azure-sdk/sdk/client/msgraph"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)

// Copyright (c) HashiCorp Inc. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type DeletedMemberClient struct {
Client *msgraph.Client
}

func NewDeletedMemberClientWithBaseURI(sdkApi sdkEnv.Api) (*DeletedMemberClient, error) {
client, err := msgraph.NewClient(sdkApi, "deletedmember", defaultApiVersion)
if err != nil {
return nil, fmt.Errorf("instantiating DeletedMemberClient: %+v", err)
}

return &DeletedMemberClient{
Client: client,
}, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package deletedmember

import (
"context"
"encoding/json"
"net/http"

"github.com/hashicorp/go-azure-sdk/microsoft-graph/common-types/beta"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

// Copyright (c) HashiCorp Inc. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type GetDeletedMemberOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model beta.DirectoryObject
}

type GetDeletedMemberOperationOptions struct {
Expand *odata.Expand
Metadata *odata.Metadata
RetryFunc client.RequestRetryFunc
Select *[]string
}

func DefaultGetDeletedMemberOperationOptions() GetDeletedMemberOperationOptions {
return GetDeletedMemberOperationOptions{}
}

func (o GetDeletedMemberOperationOptions) ToHeaders() *client.Headers {
out := client.Headers{}

return &out
}

func (o GetDeletedMemberOperationOptions) ToOData() *odata.Query {
out := odata.Query{}
if o.Expand != nil {
out.Expand = *o.Expand
}
if o.Metadata != nil {
out.Metadata = *o.Metadata
}
if o.Select != nil {
out.Select = *o.Select
}
return &out
}

func (o GetDeletedMemberOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}

return &out
}

// GetDeletedMember - Get deletedMembers from administrativeUnits
func (c DeletedMemberClient) GetDeletedMember(ctx context.Context, id beta.AdministrativeUnitIdDeletedMemberId, options GetDeletedMemberOperationOptions) (result GetDeletedMemberOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "application/json; charset=utf-8",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
OptionsObject: options,
Path: id.ID(),
RetryFunc: options.RetryFunc,
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

var respObj json.RawMessage
if err = resp.Unmarshal(&respObj); err != nil {
return
}
model, err := beta.UnmarshalDirectoryObjectImplementation(respObj)
if err != nil {
return
}
result.Model = model

return
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package deletedmember

import (
"context"
"fmt"
"net/http"

"github.com/hashicorp/go-azure-sdk/microsoft-graph/common-types/beta"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

// Copyright (c) HashiCorp Inc. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type GetDeletedMembersCountOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model *[]byte
}

type GetDeletedMembersCountOperationOptions struct {
Filter *string
Metadata *odata.Metadata
RetryFunc client.RequestRetryFunc
Search *string
}

func DefaultGetDeletedMembersCountOperationOptions() GetDeletedMembersCountOperationOptions {
return GetDeletedMembersCountOperationOptions{}
}

func (o GetDeletedMembersCountOperationOptions) ToHeaders() *client.Headers {
out := client.Headers{}

return &out
}

func (o GetDeletedMembersCountOperationOptions) ToOData() *odata.Query {
out := odata.Query{}
if o.Filter != nil {
out.Filter = *o.Filter
}
if o.Metadata != nil {
out.Metadata = *o.Metadata
}
if o.Search != nil {
out.Search = *o.Search
}
return &out
}

func (o GetDeletedMembersCountOperationOptions) ToQuery() *client.QueryParams {
out := client.QueryParams{}

return &out
}

// GetDeletedMembersCount - Get the number of the resource
func (c DeletedMemberClient) GetDeletedMembersCount(ctx context.Context, id beta.AdministrativeUnitId, options GetDeletedMembersCountOperationOptions) (result GetDeletedMembersCountOperationResponse, err error) {
opts := client.RequestOptions{
ContentType: "text/plain",
ExpectedStatusCodes: []int{
http.StatusOK,
},
HttpMethod: http.MethodGet,
OptionsObject: options,
Path: fmt.Sprintf("%s/deletedMembers/$count", id.ID()),
RetryFunc: options.RetryFunc,
}

req, err := c.Client.NewRequest(ctx, opts)
if err != nil {
return
}

var resp *client.Response
resp, err = req.Execute(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
}
if err != nil {
return
}

var model []byte
result.Model = &model
if err = resp.Unmarshal(result.Model); err != nil {
return
}

return
}
Loading
Loading