From 91f1da73283f636d9722081aedfd366e05fde99f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sat, 12 Dec 2020 01:24:02 +0000 Subject: [PATCH] CodeGen from PR 10820 in Azure/azure-rest-api-specs Add AppAssignedTo API (#10820) --- services/graphrbac/1.6/graphrbac/CHANGELOG.md | 12 + .../graphrbac/1.6/graphrbac/applications.go | 16 + .../1.6/graphrbac/deletedapplications.go | 5 + services/graphrbac/1.6/graphrbac/domains.go | 2 + services/graphrbac/1.6/graphrbac/enums.go | 4 +- .../1.6/graphrbac/graphrbacapi/interfaces.go | 4 + services/graphrbac/1.6/graphrbac/groups.go | 17 + services/graphrbac/1.6/graphrbac/models.go | 467 ++++++++++++++++-- .../1.6/graphrbac/oauth2permissiongrant.go | 5 + services/graphrbac/1.6/graphrbac/objects.go | 3 + .../1.6/graphrbac/serviceprincipals.go | 245 +++++++++ .../graphrbac/1.6/graphrbac/signedinuser.go | 4 + services/graphrbac/1.6/graphrbac/users.go | 8 + 13 files changed, 761 insertions(+), 31 deletions(-) create mode 100644 services/graphrbac/1.6/graphrbac/CHANGELOG.md diff --git a/services/graphrbac/1.6/graphrbac/CHANGELOG.md b/services/graphrbac/1.6/graphrbac/CHANGELOG.md new file mode 100644 index 000000000000..2b26b1092d48 --- /dev/null +++ b/services/graphrbac/1.6/graphrbac/CHANGELOG.md @@ -0,0 +1,12 @@ +Generated from https://github.com/Azure/azure-rest-api-specs/tree/3c764635e7d442b3e74caf593029fcd440b3ef82 + +Code generator @microsoft.azure/autorest.go@~2.1.161 + +## Breaking Changes + +- Function `NewGroupListResultPage` parameter(s) have been changed from `(func(context.Context, GroupListResult) (GroupListResult, error))` to `(GroupListResult, func(context.Context, GroupListResult) (GroupListResult, error))` +- Function `NewOAuth2PermissionGrantListResultPage` parameter(s) have been changed from `(func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error))` to `(OAuth2PermissionGrantListResult, func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error))` +- Function `NewDirectoryObjectListResultPage` parameter(s) have been changed from `(func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error))` to `(DirectoryObjectListResult, func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error))` +- Function `NewUserListResultPage` parameter(s) have been changed from `(func(context.Context, UserListResult) (UserListResult, error))` to `(UserListResult, func(context.Context, UserListResult) (UserListResult, error))` +- Function `NewServicePrincipalListResultPage` parameter(s) have been changed from `(func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error))` to `(ServicePrincipalListResult, func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error))` +- Function `NewApplicationListResultPage` parameter(s) have been changed from `(func(context.Context, ApplicationListResult) (ApplicationListResult, error))` to `(ApplicationListResult, func(context.Context, ApplicationListResult) (ApplicationListResult, error))` diff --git a/services/graphrbac/1.6/graphrbac/applications.go b/services/graphrbac/1.6/graphrbac/applications.go index 1b0a3f42c799..d32f8e0e4e2f 100644 --- a/services/graphrbac/1.6/graphrbac/applications.go +++ b/services/graphrbac/1.6/graphrbac/applications.go @@ -81,6 +81,7 @@ func (client ApplicationsClient) AddOwner(ctx context.Context, applicationObject result, err = client.AddOwnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "AddOwner", resp, "Failure responding to request") + return } return @@ -161,6 +162,7 @@ func (client ApplicationsClient) Create(ctx context.Context, parameters Applicat result, err = client.CreateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request") + return } return @@ -235,6 +237,7 @@ func (client ApplicationsClient) Delete(ctx context.Context, applicationObjectID result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request") + return } return @@ -307,6 +310,7 @@ func (client ApplicationsClient) Get(ctx context.Context, applicationObjectID st result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request") + return } return @@ -380,6 +384,7 @@ func (client ApplicationsClient) GetServicePrincipalsIDByAppID(ctx context.Conte result, err = client.GetServicePrincipalsIDByAppIDResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "GetServicePrincipalsIDByAppID", resp, "Failure responding to request") + return } return @@ -459,9 +464,11 @@ func (client ApplicationsClient) List(ctx context.Context, filter string) (resul result.alr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request") + return } if result.alr.hasNextLink() && result.alr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -553,6 +560,7 @@ func (client ApplicationsClient) ListKeyCredentials(ctx context.Context, applica result, err = client.ListKeyCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request") + return } return @@ -626,6 +634,7 @@ func (client ApplicationsClient) ListNext(ctx context.Context, nextLink string) result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request") + return } return @@ -700,9 +709,11 @@ func (client ApplicationsClient) ListOwners(ctx context.Context, applicationObje result.dolr, err = client.ListOwnersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -813,6 +824,7 @@ func (client ApplicationsClient) ListPasswordCredentials(ctx context.Context, ap result, err = client.ListPasswordCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request") + return } return @@ -887,6 +899,7 @@ func (client ApplicationsClient) Patch(ctx context.Context, applicationObjectID result, err = client.PatchResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request") + return } return @@ -962,6 +975,7 @@ func (client ApplicationsClient) RemoveOwner(ctx context.Context, applicationObj result, err = client.RemoveOwnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "RemoveOwner", resp, "Failure responding to request") + return } return @@ -1036,6 +1050,7 @@ func (client ApplicationsClient) UpdateKeyCredentials(ctx context.Context, appli result, err = client.UpdateKeyCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request") + return } return @@ -1111,6 +1126,7 @@ func (client ApplicationsClient) UpdatePasswordCredentials(ctx context.Context, result, err = client.UpdatePasswordCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/deletedapplications.go b/services/graphrbac/1.6/graphrbac/deletedapplications.go index cb2dd07d73c9..5aa143f43bcf 100644 --- a/services/graphrbac/1.6/graphrbac/deletedapplications.go +++ b/services/graphrbac/1.6/graphrbac/deletedapplications.go @@ -73,6 +73,7 @@ func (client DeletedApplicationsClient) HardDelete(ctx context.Context, applicat result, err = client.HardDeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "HardDelete", resp, "Failure responding to request") + return } return @@ -151,9 +152,11 @@ func (client DeletedApplicationsClient) List(ctx context.Context, filter string) result.alr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "List", resp, "Failure responding to request") + return } if result.alr.hasNextLink() && result.alr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -245,6 +248,7 @@ func (client DeletedApplicationsClient) ListNext(ctx context.Context, nextLink s result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "ListNext", resp, "Failure responding to request") + return } return @@ -318,6 +322,7 @@ func (client DeletedApplicationsClient) Restore(ctx context.Context, objectID st result, err = client.RestoreResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "Restore", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/domains.go b/services/graphrbac/1.6/graphrbac/domains.go index ace3959ac60f..55e97b20ee30 100644 --- a/services/graphrbac/1.6/graphrbac/domains.go +++ b/services/graphrbac/1.6/graphrbac/domains.go @@ -71,6 +71,7 @@ func (client DomainsClient) Get(ctx context.Context, domainName string) (result result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", resp, "Failure responding to request") + return } return @@ -144,6 +145,7 @@ func (client DomainsClient) List(ctx context.Context, filter string) (result Dom result, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/enums.go b/services/graphrbac/1.6/graphrbac/enums.go index 2e9cbd70f6a6..660192e74e60 100644 --- a/services/graphrbac/1.6/graphrbac/enums.go +++ b/services/graphrbac/1.6/graphrbac/enums.go @@ -55,6 +55,8 @@ type ObjectType string const ( // ObjectTypeApplication ... ObjectTypeApplication ObjectType = "Application" + // ObjectTypeAppRoleAssignment ... + ObjectTypeAppRoleAssignment ObjectType = "AppRoleAssignment" // ObjectTypeDirectoryObject ... ObjectTypeDirectoryObject ObjectType = "DirectoryObject" // ObjectTypeGroup ... @@ -67,7 +69,7 @@ const ( // PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. func PossibleObjectTypeValues() []ObjectType { - return []ObjectType{ObjectTypeApplication, ObjectTypeDirectoryObject, ObjectTypeGroup, ObjectTypeServicePrincipal, ObjectTypeUser} + return []ObjectType{ObjectTypeApplication, ObjectTypeAppRoleAssignment, ObjectTypeDirectoryObject, ObjectTypeGroup, ObjectTypeServicePrincipal, ObjectTypeUser} } // UserType enumerates the values for user type. diff --git a/services/graphrbac/1.6/graphrbac/graphrbacapi/interfaces.go b/services/graphrbac/1.6/graphrbac/graphrbacapi/interfaces.go index ccdb4489006b..c37bd5beaa12 100644 --- a/services/graphrbac/1.6/graphrbac/graphrbacapi/interfaces.go +++ b/services/graphrbac/1.6/graphrbac/graphrbacapi/interfaces.go @@ -96,6 +96,10 @@ type ServicePrincipalsClientAPI interface { Get(ctx context.Context, objectID string) (result graphrbac.ServicePrincipal, err error) List(ctx context.Context, filter string) (result graphrbac.ServicePrincipalListResultPage, err error) ListComplete(ctx context.Context, filter string) (result graphrbac.ServicePrincipalListResultIterator, err error) + ListAppRoleAssignedTo(ctx context.Context, objectID string) (result graphrbac.AppRoleAssignmentListResultPage, err error) + ListAppRoleAssignedToComplete(ctx context.Context, objectID string) (result graphrbac.AppRoleAssignmentListResultIterator, err error) + ListAppRoleAssignments(ctx context.Context, objectID string) (result graphrbac.AppRoleAssignmentListResultPage, err error) + ListAppRoleAssignmentsComplete(ctx context.Context, objectID string) (result graphrbac.AppRoleAssignmentListResultIterator, err error) ListKeyCredentials(ctx context.Context, objectID string) (result graphrbac.KeyCredentialListResult, err error) ListNext(ctx context.Context, nextLink string) (result graphrbac.ServicePrincipalListResult, err error) ListOwners(ctx context.Context, objectID string) (result graphrbac.DirectoryObjectListResultPage, err error) diff --git a/services/graphrbac/1.6/graphrbac/groups.go b/services/graphrbac/1.6/graphrbac/groups.go index 02b021e4d212..d03739fb3afd 100644 --- a/services/graphrbac/1.6/graphrbac/groups.go +++ b/services/graphrbac/1.6/graphrbac/groups.go @@ -81,6 +81,7 @@ func (client GroupsClient) AddMember(ctx context.Context, groupObjectID string, result, err = client.AddMemberResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure responding to request") + return } return @@ -163,6 +164,7 @@ func (client GroupsClient) AddOwner(ctx context.Context, objectID string, parame result, err = client.AddOwnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddOwner", resp, "Failure responding to request") + return } return @@ -246,6 +248,7 @@ func (client GroupsClient) Create(ctx context.Context, parameters GroupCreatePar result, err = client.CreateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure responding to request") + return } return @@ -320,6 +323,7 @@ func (client GroupsClient) Delete(ctx context.Context, objectID string) (result result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure responding to request") + return } return @@ -392,6 +396,7 @@ func (client GroupsClient) Get(ctx context.Context, objectID string) (result ADG result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure responding to request") + return } return @@ -471,9 +476,11 @@ func (client GroupsClient) GetGroupMembers(ctx context.Context, objectID string) result.dolr, err = client.GetGroupMembersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -563,6 +570,7 @@ func (client GroupsClient) GetGroupMembersNext(ctx context.Context, nextLink str result, err = client.GetGroupMembersNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure responding to request") + return } return @@ -643,6 +651,7 @@ func (client GroupsClient) GetMemberGroups(ctx context.Context, objectID string, result, err = client.GetMemberGroupsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure responding to request") + return } return @@ -726,6 +735,7 @@ func (client GroupsClient) IsMemberOf(ctx context.Context, parameters CheckGroup result, err = client.IsMemberOfResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure responding to request") + return } return @@ -806,9 +816,11 @@ func (client GroupsClient) List(ctx context.Context, filter string) (result Grou result.glr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request") + return } if result.glr.hasNextLink() && result.glr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -900,6 +912,7 @@ func (client GroupsClient) ListNext(ctx context.Context, nextLink string) (resul result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure responding to request") + return } return @@ -974,9 +987,11 @@ func (client GroupsClient) ListOwners(ctx context.Context, objectID string) (res result.dolr, err = client.ListOwnersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListOwners", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -1088,6 +1103,7 @@ func (client GroupsClient) RemoveMember(ctx context.Context, groupObjectID strin result, err = client.RemoveMemberResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure responding to request") + return } return @@ -1162,6 +1178,7 @@ func (client GroupsClient) RemoveOwner(ctx context.Context, objectID string, own result, err = client.RemoveOwnerResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveOwner", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/models.go b/services/graphrbac/1.6/graphrbac/models.go index be2bbcfcf452..8f42b8769b53 100644 --- a/services/graphrbac/1.6/graphrbac/models.go +++ b/services/graphrbac/1.6/graphrbac/models.go @@ -105,7 +105,7 @@ type ADGroup struct { ObjectID *string `json:"objectId,omitempty"` // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' ObjectType ObjectType `json:"objectType,omitempty"` } @@ -142,6 +142,11 @@ func (ag ADGroup) AsApplication() (*Application, bool) { return nil, false } +// AsAppRoleAssignment is the BasicDirectoryObject implementation for ADGroup. +func (ag ADGroup) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return nil, false +} + // AsADGroup is the BasicDirectoryObject implementation for ADGroup. func (ag ADGroup) AsADGroup() (*ADGroup, bool) { return &ag, true @@ -338,7 +343,7 @@ type Application struct { ObjectID *string `json:"objectId,omitempty"` // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' ObjectType ObjectType `json:"objectType,omitempty"` } @@ -456,6 +461,11 @@ func (a Application) AsApplication() (*Application, bool) { return &a, true } +// AsAppRoleAssignment is the BasicDirectoryObject implementation for Application. +func (a Application) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return nil, false +} + // AsADGroup is the BasicDirectoryObject implementation for Application. func (a Application) AsADGroup() (*ADGroup, bool) { return nil, false @@ -1089,8 +1099,11 @@ func (page ApplicationListResultPage) Values() []Application { } // Creates a new instance of the ApplicationListResultPage type. -func NewApplicationListResultPage(getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { - return ApplicationListResultPage{fn: getNextPage} +func NewApplicationListResultPage(cur ApplicationListResult, getNextPage func(context.Context, ApplicationListResult) (ApplicationListResult, error)) ApplicationListResultPage { + return ApplicationListResultPage{ + fn: getNextPage, + alr: cur, + } } // ApplicationUpdateParameters request parameters for updating a new application. @@ -1174,6 +1187,363 @@ type AppRole struct { Value *string `json:"value,omitempty"` } +// AppRoleAssignment appRoleAssignment information. +type AppRoleAssignment struct { + // ID - The role id that was assigned to the principal. This role must be declared by the target resource application resourceId in its appRoles property. + ID *string `json:"id,omitempty"` + // PrincipalDisplayName - The display name of the principal that was granted the access. + PrincipalDisplayName *string `json:"principalDisplayName,omitempty"` + // PrincipalID - The unique identifier (objectId) for the principal being granted the access. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The type of principal. This can either be "User", "Group" or "ServicePrincipal". + PrincipalType *string `json:"principalType,omitempty"` + // ResourceDisplayName - The display name of the resource to which the assignment was made. + ResourceDisplayName *string `json:"resourceDisplayName,omitempty"` + // ResourceID - The unique identifier (objectId) for the target resource (service principal) for which the assignment was made. + ResourceID *string `json:"resourceId,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // ObjectID - READ-ONLY; The object ID. + ObjectID *string `json:"objectId,omitempty"` + // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. + DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + ObjectType ObjectType `json:"objectType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppRoleAssignment. +func (ara AppRoleAssignment) MarshalJSON() ([]byte, error) { + ara.ObjectType = ObjectTypeAppRoleAssignment + objectMap := make(map[string]interface{}) + if ara.ID != nil { + objectMap["id"] = ara.ID + } + if ara.PrincipalDisplayName != nil { + objectMap["principalDisplayName"] = ara.PrincipalDisplayName + } + if ara.PrincipalID != nil { + objectMap["principalId"] = ara.PrincipalID + } + if ara.PrincipalType != nil { + objectMap["principalType"] = ara.PrincipalType + } + if ara.ResourceDisplayName != nil { + objectMap["resourceDisplayName"] = ara.ResourceDisplayName + } + if ara.ResourceID != nil { + objectMap["resourceId"] = ara.ResourceID + } + if ara.ObjectType != "" { + objectMap["objectType"] = ara.ObjectType + } + for k, v := range ara.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsApplication is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsApplication() (*Application, bool) { + return nil, false +} + +// AsAppRoleAssignment is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return &ara, true +} + +// AsADGroup is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsADGroup() (*ADGroup, bool) { + return nil, false +} + +// AsServicePrincipal is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsServicePrincipal() (*ServicePrincipal, bool) { + return nil, false +} + +// AsUser is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsUser() (*User, bool) { + return nil, false +} + +// AsDirectoryObject is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsDirectoryObject() (*DirectoryObject, bool) { + return nil, false +} + +// AsBasicDirectoryObject is the BasicDirectoryObject implementation for AppRoleAssignment. +func (ara AppRoleAssignment) AsBasicDirectoryObject() (BasicDirectoryObject, bool) { + return &ara, true +} + +// UnmarshalJSON is the custom unmarshaler for AppRoleAssignment struct. +func (ara *AppRoleAssignment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ara.ID = &ID + } + case "principalDisplayName": + if v != nil { + var principalDisplayName string + err = json.Unmarshal(*v, &principalDisplayName) + if err != nil { + return err + } + ara.PrincipalDisplayName = &principalDisplayName + } + case "principalId": + if v != nil { + var principalID string + err = json.Unmarshal(*v, &principalID) + if err != nil { + return err + } + ara.PrincipalID = &principalID + } + case "principalType": + if v != nil { + var principalType string + err = json.Unmarshal(*v, &principalType) + if err != nil { + return err + } + ara.PrincipalType = &principalType + } + case "resourceDisplayName": + if v != nil { + var resourceDisplayName string + err = json.Unmarshal(*v, &resourceDisplayName) + if err != nil { + return err + } + ara.ResourceDisplayName = &resourceDisplayName + } + case "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + ara.ResourceID = &resourceID + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if ara.AdditionalProperties == nil { + ara.AdditionalProperties = make(map[string]interface{}) + } + ara.AdditionalProperties[k] = additionalProperties + } + case "objectId": + if v != nil { + var objectID string + err = json.Unmarshal(*v, &objectID) + if err != nil { + return err + } + ara.ObjectID = &objectID + } + case "deletionTimestamp": + if v != nil { + var deletionTimestamp date.Time + err = json.Unmarshal(*v, &deletionTimestamp) + if err != nil { + return err + } + ara.DeletionTimestamp = &deletionTimestamp + } + case "objectType": + if v != nil { + var objectType ObjectType + err = json.Unmarshal(*v, &objectType) + if err != nil { + return err + } + ara.ObjectType = objectType + } + } + } + + return nil +} + +// AppRoleAssignmentListResult appRoleAssignment list operation result. +type AppRoleAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - A collection of AppRoleAssignment. + Value *[]AppRoleAssignment `json:"value,omitempty"` + // OdataNextLink - The URL to get the next set of results. + OdataNextLink *string `json:"odata.nextLink,omitempty"` +} + +// AppRoleAssignmentListResultIterator provides access to a complete listing of AppRoleAssignment values. +type AppRoleAssignmentListResultIterator struct { + i int + page AppRoleAssignmentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppRoleAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppRoleAssignmentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppRoleAssignmentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppRoleAssignmentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppRoleAssignmentListResultIterator) Response() AppRoleAssignmentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppRoleAssignmentListResultIterator) Value() AppRoleAssignment { + if !iter.page.NotDone() { + return AppRoleAssignment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppRoleAssignmentListResultIterator type. +func NewAppRoleAssignmentListResultIterator(page AppRoleAssignmentListResultPage) AppRoleAssignmentListResultIterator { + return AppRoleAssignmentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aralr AppRoleAssignmentListResult) IsEmpty() bool { + return aralr.Value == nil || len(*aralr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aralr AppRoleAssignmentListResult) hasNextLink() bool { + return aralr.OdataNextLink != nil && len(*aralr.OdataNextLink) != 0 +} + +// appRoleAssignmentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aralr AppRoleAssignmentListResult) appRoleAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aralr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aralr.OdataNextLink))) +} + +// AppRoleAssignmentListResultPage contains a page of AppRoleAssignment values. +type AppRoleAssignmentListResultPage struct { + fn func(context.Context, AppRoleAssignmentListResult) (AppRoleAssignmentListResult, error) + aralr AppRoleAssignmentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppRoleAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppRoleAssignmentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aralr) + if err != nil { + return err + } + page.aralr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppRoleAssignmentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppRoleAssignmentListResultPage) NotDone() bool { + return !page.aralr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppRoleAssignmentListResultPage) Response() AppRoleAssignmentListResult { + return page.aralr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppRoleAssignmentListResultPage) Values() []AppRoleAssignment { + if page.aralr.IsEmpty() { + return nil + } + return *page.aralr.Value +} + +// Creates a new instance of the AppRoleAssignmentListResultPage type. +func NewAppRoleAssignmentListResultPage(cur AppRoleAssignmentListResult, getNextPage func(context.Context, AppRoleAssignmentListResult) (AppRoleAssignmentListResult, error)) AppRoleAssignmentListResultPage { + return AppRoleAssignmentListResultPage{ + fn: getNextPage, + aralr: cur, + } +} + // CheckGroupMembershipParameters request parameters for IsMemberOf API call. type CheckGroupMembershipParameters struct { // AdditionalProperties - Unmatched properties from the message are deserialized this collection @@ -1304,6 +1674,7 @@ func (cgmr *CheckGroupMembershipResult) UnmarshalJSON(body []byte) error { // BasicDirectoryObject represents an Azure Active Directory object. type BasicDirectoryObject interface { AsApplication() (*Application, bool) + AsAppRoleAssignment() (*AppRoleAssignment, bool) AsADGroup() (*ADGroup, bool) AsServicePrincipal() (*ServicePrincipal, bool) AsUser() (*User, bool) @@ -1318,7 +1689,7 @@ type DirectoryObject struct { ObjectID *string `json:"objectId,omitempty"` // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' ObjectType ObjectType `json:"objectType,omitempty"` } @@ -1334,6 +1705,10 @@ func unmarshalBasicDirectoryObject(body []byte) (BasicDirectoryObject, error) { var a Application err := json.Unmarshal(body, &a) return a, err + case string(ObjectTypeAppRoleAssignment): + var ara AppRoleAssignment + err := json.Unmarshal(body, &ara) + return ara, err case string(ObjectTypeGroup): var ag ADGroup err := json.Unmarshal(body, &ag) @@ -1389,6 +1764,11 @@ func (do DirectoryObject) AsApplication() (*Application, bool) { return nil, false } +// AsAppRoleAssignment is the BasicDirectoryObject implementation for DirectoryObject. +func (do DirectoryObject) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return nil, false +} + // AsADGroup is the BasicDirectoryObject implementation for DirectoryObject. func (do DirectoryObject) AsADGroup() (*ADGroup, bool) { return nil, false @@ -1652,8 +2032,11 @@ func (page DirectoryObjectListResultPage) Values() []BasicDirectoryObject { } // Creates a new instance of the DirectoryObjectListResultPage type. -func NewDirectoryObjectListResultPage(getNextPage func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error)) DirectoryObjectListResultPage { - return DirectoryObjectListResultPage{fn: getNextPage} +func NewDirectoryObjectListResultPage(cur DirectoryObjectListResult, getNextPage func(context.Context, DirectoryObjectListResult) (DirectoryObjectListResult, error)) DirectoryObjectListResultPage { + return DirectoryObjectListResultPage{ + fn: getNextPage, + dolr: cur, + } } // Domain active Directory Domain information. @@ -2239,12 +2622,15 @@ func (page GroupListResultPage) Values() []ADGroup { } // Creates a new instance of the GroupListResultPage type. -func NewGroupListResultPage(getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { - return GroupListResultPage{fn: getNextPage} +func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { + return GroupListResultPage{ + fn: getNextPage, + glr: cur, + } } -// InformationalURL represents a group of URIs that provide terms of service, marketing, support and privacy -// policy information about an application. The default value for each string is null. +// InformationalURL represents a group of URIs that provide terms of service, marketing, support and +// privacy policy information about an application. The default value for each string is null. type InformationalURL struct { // TermsOfService - The terms of service URI TermsOfService *string `json:"termsOfService,omitempty"` @@ -2410,8 +2796,8 @@ type KeyCredentialsUpdateParameters struct { } // OAuth2Permission represents an OAuth 2.0 delegated permission scope. The specified OAuth 2.0 delegated -// permission scopes may be requested by client applications (through the requiredResourceAccess collection on -// the Application object) when calling a resource application. The oauth2Permissions property of the +// permission scopes may be requested by client applications (through the requiredResourceAccess collection +// on the Application object) when calling a resource application. The oauth2Permissions property of the // ServicePrincipal entity and of the Application entity is a collection of OAuth2Permission. type OAuth2Permission struct { // AdminConsentDescription - Permission help text that appears in the admin consent and app assignment experiences. @@ -2596,8 +2982,11 @@ func (page OAuth2PermissionGrantListResultPage) Values() []OAuth2PermissionGrant } // Creates a new instance of the OAuth2PermissionGrantListResultPage type. -func NewOAuth2PermissionGrantListResultPage(getNextPage func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error)) OAuth2PermissionGrantListResultPage { - return OAuth2PermissionGrantListResultPage{fn: getNextPage} +func NewOAuth2PermissionGrantListResultPage(cur OAuth2PermissionGrantListResult, getNextPage func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error)) OAuth2PermissionGrantListResultPage { + return OAuth2PermissionGrantListResultPage{ + fn: getNextPage, + oa2pglr: cur, + } } // OdataError active Directory OData error information. @@ -2879,8 +3268,8 @@ type PreAuthorizedApplication struct { Extensions *[]PreAuthorizedApplicationExtension `json:"extensions,omitempty"` } -// PreAuthorizedApplicationExtension representation of an app PreAuthorizedApplicationExtension required by a -// pre authorized client app. +// PreAuthorizedApplicationExtension representation of an app PreAuthorizedApplicationExtension required by +// a pre authorized client app. type PreAuthorizedApplicationExtension struct { // Conditions - The extension's conditions. Conditions *[]string `json:"conditions,omitempty"` @@ -2894,10 +3283,11 @@ type PreAuthorizedApplicationPermission struct { AccessGrants *[]string `json:"accessGrants,omitempty"` } -// RequiredResourceAccess specifies the set of OAuth 2.0 permission scopes and app roles under the specified -// resource that an application requires access to. The specified OAuth 2.0 permission scopes may be requested -// by client applications (through the requiredResourceAccess collection) when calling a resource application. -// The requiredResourceAccess property of the Application entity is a collection of RequiredResourceAccess. +// RequiredResourceAccess specifies the set of OAuth 2.0 permission scopes and app roles under the +// specified resource that an application requires access to. The specified OAuth 2.0 permission scopes may +// be requested by client applications (through the requiredResourceAccess collection) when calling a +// resource application. The requiredResourceAccess property of the Application entity is a collection of +// RequiredResourceAccess. type RequiredResourceAccess struct { // AdditionalProperties - Unmatched properties from the message are deserialized this collection AdditionalProperties map[string]interface{} `json:""` @@ -3089,7 +3479,7 @@ type ServicePrincipal struct { ObjectID *string `json:"objectId,omitempty"` // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' ObjectType ObjectType `json:"objectType,omitempty"` } @@ -3165,6 +3555,11 @@ func (sp ServicePrincipal) AsApplication() (*Application, bool) { return nil, false } +// AsAppRoleAssignment is the BasicDirectoryObject implementation for ServicePrincipal. +func (sp ServicePrincipal) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return nil, false +} + // AsADGroup is the BasicDirectoryObject implementation for ServicePrincipal. func (sp ServicePrincipal) AsADGroup() (*ADGroup, bool) { return nil, false @@ -3433,7 +3828,8 @@ func (sp *ServicePrincipal) UnmarshalJSON(body []byte) error { return nil } -// ServicePrincipalBase active Directory service principal common properties shared among GET, POST and PATCH +// ServicePrincipalBase active Directory service principal common properties shared among GET, POST and +// PATCH type ServicePrincipalBase struct { // AccountEnabled - whether or not the service principal account is enabled AccountEnabled *bool `json:"accountEnabled,omitempty"` @@ -3607,8 +4003,11 @@ func (page ServicePrincipalListResultPage) Values() []ServicePrincipal { } // Creates a new instance of the ServicePrincipalListResultPage type. -func NewServicePrincipalListResultPage(getNextPage func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error)) ServicePrincipalListResultPage { - return ServicePrincipalListResultPage{fn: getNextPage} +func NewServicePrincipalListResultPage(cur ServicePrincipalListResult, getNextPage func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error)) ServicePrincipalListResultPage { + return ServicePrincipalListResultPage{ + fn: getNextPage, + splr: cur, + } } // ServicePrincipalObjectResult service Principal Object Result. @@ -3636,8 +4035,8 @@ type ServicePrincipalUpdateParameters struct { Tags *[]string `json:"tags,omitempty"` } -// SignInName contains information about a sign-in name of a local account user in an Azure Active Directory -// B2C tenant. +// SignInName contains information about a sign-in name of a local account user in an Azure Active +// Directory B2C tenant. type SignInName struct { // AdditionalProperties - Unmatched properties from the message are deserialized this collection AdditionalProperties map[string]interface{} `json:""` @@ -3738,7 +4137,7 @@ type User struct { ObjectID *string `json:"objectId,omitempty"` // DeletionTimestamp - READ-ONLY; The time at which the directory object was deleted. DeletionTimestamp *date.Time `json:"deletionTimestamp,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' + // ObjectType - Possible values include: 'ObjectTypeDirectoryObject', 'ObjectTypeApplication', 'ObjectTypeAppRoleAssignment', 'ObjectTypeGroup', 'ObjectTypeServicePrincipal', 'ObjectTypeUser' ObjectType ObjectType `json:"objectType,omitempty"` } @@ -3793,6 +4192,11 @@ func (u User) AsApplication() (*Application, bool) { return nil, false } +// AsAppRoleAssignment is the BasicDirectoryObject implementation for User. +func (u User) AsAppRoleAssignment() (*AppRoleAssignment, bool) { + return nil, false +} + // AsADGroup is the BasicDirectoryObject implementation for User. func (u User) AsADGroup() (*ADGroup, bool) { return nil, false @@ -4482,8 +4886,11 @@ func (page UserListResultPage) Values() []User { } // Creates a new instance of the UserListResultPage type. -func NewUserListResultPage(getNextPage func(context.Context, UserListResult) (UserListResult, error)) UserListResultPage { - return UserListResultPage{fn: getNextPage} +func NewUserListResultPage(cur UserListResult, getNextPage func(context.Context, UserListResult) (UserListResult, error)) UserListResultPage { + return UserListResultPage{ + fn: getNextPage, + ulr: cur, + } } // UserUpdateParameters request parameters for updating an existing work or school account user. diff --git a/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go b/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go index 963bb9a5a1f0..74618ef492bf 100644 --- a/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go +++ b/services/graphrbac/1.6/graphrbac/oauth2permissiongrant.go @@ -73,6 +73,7 @@ func (client OAuth2PermissionGrantClient) Create(ctx context.Context, body *OAut result, err = client.CreateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Create", resp, "Failure responding to request") + return } return @@ -150,6 +151,7 @@ func (client OAuth2PermissionGrantClient) Delete(ctx context.Context, objectID s result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "Delete", resp, "Failure responding to request") + return } return @@ -228,9 +230,11 @@ func (client OAuth2PermissionGrantClient) List(ctx context.Context, filter strin result.oa2pglr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "List", resp, "Failure responding to request") + return } if result.oa2pglr.hasNextLink() && result.oa2pglr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -322,6 +326,7 @@ func (client OAuth2PermissionGrantClient) ListNext(ctx context.Context, nextLink result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "ListNext", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/objects.go b/services/graphrbac/1.6/graphrbac/objects.go index 62b103255d81..b4b182461089 100644 --- a/services/graphrbac/1.6/graphrbac/objects.go +++ b/services/graphrbac/1.6/graphrbac/objects.go @@ -79,9 +79,11 @@ func (client ObjectsClient) GetObjectsByObjectIds(ctx context.Context, parameter result.dolr, err = client.GetObjectsByObjectIdsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -172,6 +174,7 @@ func (client ObjectsClient) GetObjectsByObjectIdsNext(ctx context.Context, nextL result, err = client.GetObjectsByObjectIdsNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/serviceprincipals.go b/services/graphrbac/1.6/graphrbac/serviceprincipals.go index 3bfdfe9d53d9..6a310c947234 100644 --- a/services/graphrbac/1.6/graphrbac/serviceprincipals.go +++ b/services/graphrbac/1.6/graphrbac/serviceprincipals.go @@ -80,6 +80,7 @@ func (client ServicePrincipalsClient) Create(ctx context.Context, parameters Ser result, err = client.CreateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure responding to request") + return } return @@ -154,6 +155,7 @@ func (client ServicePrincipalsClient) Delete(ctx context.Context, objectID strin result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure responding to request") + return } return @@ -226,6 +228,7 @@ func (client ServicePrincipalsClient) Get(ctx context.Context, objectID string) result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure responding to request") + return } return @@ -305,9 +308,11 @@ func (client ServicePrincipalsClient) List(ctx context.Context, filter string) ( result.splr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request") + return } if result.splr.hasNextLink() && result.splr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -369,6 +374,238 @@ func (client ServicePrincipalsClient) ListComplete(ctx context.Context, filter s return } +// ListAppRoleAssignedTo sends the list app role assigned to request. +// Parameters: +// objectID - the object ID of the service principal for which to get owners. +func (client ServicePrincipalsClient) ListAppRoleAssignedTo(ctx context.Context, objectID string) (result AppRoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListAppRoleAssignedTo") + defer func() { + sc := -1 + if result.aralr.Response.Response != nil { + sc = result.aralr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAppRoleAssignedToNextResults + req, err := client.ListAppRoleAssignedToPreparer(ctx, objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignedTo", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppRoleAssignedToSender(req) + if err != nil { + result.aralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignedTo", resp, "Failure sending request") + return + } + + result.aralr, err = client.ListAppRoleAssignedToResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignedTo", resp, "Failure responding to request") + return + } + if result.aralr.hasNextLink() && result.aralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAppRoleAssignedToPreparer prepares the ListAppRoleAssignedTo request. +func (client ServicePrincipalsClient) ListAppRoleAssignedToPreparer(ctx context.Context, objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": autorest.Encode("path", objectID), + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/appRoleAssignedTo", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAppRoleAssignedToSender sends the ListAppRoleAssignedTo request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListAppRoleAssignedToSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAppRoleAssignedToResponder handles the response to the ListAppRoleAssignedTo request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListAppRoleAssignedToResponder(resp *http.Response) (result AppRoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAppRoleAssignedToNextResults retrieves the next set of results, if any. +func (client ServicePrincipalsClient) listAppRoleAssignedToNextResults(ctx context.Context, lastResults AppRoleAssignmentListResult) (result AppRoleAssignmentListResult, err error) { + req, err := lastResults.appRoleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignedToNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAppRoleAssignedToSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignedToNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAppRoleAssignedToResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignedToNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAppRoleAssignedToComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicePrincipalsClient) ListAppRoleAssignedToComplete(ctx context.Context, objectID string) (result AppRoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListAppRoleAssignedTo") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAppRoleAssignedTo(ctx, objectID) + return +} + +// ListAppRoleAssignments sends the list app role assignments request. +// Parameters: +// objectID - the object ID of the service principal for which to get owners. +func (client ServicePrincipalsClient) ListAppRoleAssignments(ctx context.Context, objectID string) (result AppRoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListAppRoleAssignments") + defer func() { + sc := -1 + if result.aralr.Response.Response != nil { + sc = result.aralr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAppRoleAssignmentsNextResults + req, err := client.ListAppRoleAssignmentsPreparer(ctx, objectID) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignments", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppRoleAssignmentsSender(req) + if err != nil { + result.aralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignments", resp, "Failure sending request") + return + } + + result.aralr, err = client.ListAppRoleAssignmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListAppRoleAssignments", resp, "Failure responding to request") + return + } + if result.aralr.hasNextLink() && result.aralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAppRoleAssignmentsPreparer prepares the ListAppRoleAssignments request. +func (client ServicePrincipalsClient) ListAppRoleAssignmentsPreparer(ctx context.Context, objectID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "objectId": autorest.Encode("path", objectID), + "tenantID": autorest.Encode("path", client.TenantID), + } + + const APIVersion = "1.6" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/appRoleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAppRoleAssignmentsSender sends the ListAppRoleAssignments request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListAppRoleAssignmentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAppRoleAssignmentsResponder handles the response to the ListAppRoleAssignments request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListAppRoleAssignmentsResponder(resp *http.Response) (result AppRoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAppRoleAssignmentsNextResults retrieves the next set of results, if any. +func (client ServicePrincipalsClient) listAppRoleAssignmentsNextResults(ctx context.Context, lastResults AppRoleAssignmentListResult) (result AppRoleAssignmentListResult, err error) { + req, err := lastResults.appRoleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignmentsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAppRoleAssignmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignmentsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAppRoleAssignmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "listAppRoleAssignmentsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAppRoleAssignmentsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicePrincipalsClient) ListAppRoleAssignmentsComplete(ctx context.Context, objectID string) (result AppRoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListAppRoleAssignments") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAppRoleAssignments(ctx, objectID) + return +} + // ListKeyCredentials get the keyCredentials associated with the specified service principal. // Parameters: // objectID - the object ID of the service principal for which to get keyCredentials. @@ -399,6 +636,7 @@ func (client ServicePrincipalsClient) ListKeyCredentials(ctx context.Context, ob result, err = client.ListKeyCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure responding to request") + return } return @@ -472,6 +710,7 @@ func (client ServicePrincipalsClient) ListNext(ctx context.Context, nextLink str result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure responding to request") + return } return @@ -546,9 +785,11 @@ func (client ServicePrincipalsClient) ListOwners(ctx context.Context, objectID s result.dolr, err = client.ListOwnersResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListOwners", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -659,6 +900,7 @@ func (client ServicePrincipalsClient) ListPasswordCredentials(ctx context.Contex result, err = client.ListPasswordCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure responding to request") + return } return @@ -733,6 +975,7 @@ func (client ServicePrincipalsClient) Update(ctx context.Context, objectID strin result, err = client.UpdateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Update", resp, "Failure responding to request") + return } return @@ -808,6 +1051,7 @@ func (client ServicePrincipalsClient) UpdateKeyCredentials(ctx context.Context, result, err = client.UpdateKeyCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure responding to request") + return } return @@ -883,6 +1127,7 @@ func (client ServicePrincipalsClient) UpdatePasswordCredentials(ctx context.Cont result, err = client.UpdatePasswordCredentialsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/signedinuser.go b/services/graphrbac/1.6/graphrbac/signedinuser.go index e6004b3e0990..0f805b5165f0 100644 --- a/services/graphrbac/1.6/graphrbac/signedinuser.go +++ b/services/graphrbac/1.6/graphrbac/signedinuser.go @@ -70,6 +70,7 @@ func (client SignedInUserClient) Get(ctx context.Context) (result User, err erro result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "Get", resp, "Failure responding to request") + return } return @@ -146,9 +147,11 @@ func (client SignedInUserClient) ListOwnedObjects(ctx context.Context) (result D result.dolr, err = client.ListOwnedObjectsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjects", resp, "Failure responding to request") + return } if result.dolr.hasNextLink() && result.dolr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -237,6 +240,7 @@ func (client SignedInUserClient) ListOwnedObjectsNext(ctx context.Context, nextL result, err = client.ListOwnedObjectsNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjectsNext", resp, "Failure responding to request") + return } return diff --git a/services/graphrbac/1.6/graphrbac/users.go b/services/graphrbac/1.6/graphrbac/users.go index 480295e248ac..b9a7a56c3e86 100644 --- a/services/graphrbac/1.6/graphrbac/users.go +++ b/services/graphrbac/1.6/graphrbac/users.go @@ -84,6 +84,7 @@ func (client UsersClient) Create(ctx context.Context, parameters UserCreateParam result, err = client.CreateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure responding to request") + return } return @@ -158,6 +159,7 @@ func (client UsersClient) Delete(ctx context.Context, upnOrObjectID string) (res result, err = client.DeleteResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure responding to request") + return } return @@ -230,6 +232,7 @@ func (client UsersClient) Get(ctx context.Context, upnOrObjectID string) (result result, err = client.GetResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure responding to request") + return } return @@ -310,6 +313,7 @@ func (client UsersClient) GetMemberGroups(ctx context.Context, objectID string, result, err = client.GetMemberGroupsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure responding to request") + return } return @@ -392,9 +396,11 @@ func (client UsersClient) List(ctx context.Context, filter string, expand string result.ulr, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request") + return } if result.ulr.hasNextLink() && result.ulr.IsEmpty() { err = result.NextWithContext(ctx) + return } return @@ -489,6 +495,7 @@ func (client UsersClient) ListNext(ctx context.Context, nextLink string) (result result, err = client.ListNextResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure responding to request") + return } return @@ -563,6 +570,7 @@ func (client UsersClient) Update(ctx context.Context, upnOrObjectID string, para result, err = client.UpdateResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure responding to request") + return } return