diff --git a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md index f6c870ebef77..5f930edf7f94 100644 --- a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md +++ b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md @@ -1,5 +1,448 @@ # Release History +## 3.0.0-beta.2 (2023-11-09) +### Breaking Changes + +- Type alias `AccessRecommendationType` has been removed +- Type alias `AccessReviewActorIdentityType` has been removed +- Type alias `AccessReviewApplyResult` has been removed +- Type alias `AccessReviewDecisionInsightType` has been removed +- Type alias `AccessReviewDecisionPrincipalResourceMembershipType` has been removed +- Type alias `AccessReviewHistoryDefinitionStatus` has been removed +- Type alias `AccessReviewInstanceReviewersType` has been removed +- Type alias `AccessReviewInstanceStatus` has been removed +- Type alias `AccessReviewRecurrencePatternType` has been removed +- Type alias `AccessReviewRecurrenceRangeType` has been removed +- Type alias `AccessReviewResult` has been removed +- Type alias `AccessReviewReviewerType` has been removed +- Type alias `AccessReviewScheduleDefinitionReviewersType` has been removed +- Type alias `AccessReviewScheduleDefinitionStatus` has been removed +- Type alias `AccessReviewScopeAssignmentState` has been removed +- Type alias `AccessReviewScopePrincipalType` has been removed +- Type alias `ApprovalMode` has been removed +- Type alias `AssignmentType` has been removed +- Type alias `DecisionResourceType` has been removed +- Type alias `DecisionTargetType` has been removed +- Type alias `DefaultDecisionType` has been removed +- Type alias `EnablementRules` has been removed +- Type alias `MemberType` has been removed +- Type alias `NotificationDeliveryMechanism` has been removed +- Type alias `NotificationLevel` has been removed +- Type alias `RecipientType` has been removed +- Type alias `RecordAllDecisionsResult` has been removed +- Type alias `RoleManagementPolicyRuleType` has been removed +- Type alias `SeverityLevel` has been removed +- Type alias `UserType` has been removed +- Function `*AccessReviewDecisionIdentity.GetAccessReviewDecisionIdentity` has been removed +- Function `*AccessReviewDecisionInsightProperties.GetAccessReviewDecisionInsightProperties` has been removed +- Function `*AccessReviewDecisionServicePrincipalIdentity.GetAccessReviewDecisionIdentity` has been removed +- Function `*AccessReviewDecisionUserIdentity.GetAccessReviewDecisionIdentity` has been removed +- Function `*AccessReviewDecisionUserSignInInsightProperties.GetAccessReviewDecisionInsightProperties` has been removed +- Function `NewAccessReviewDefaultSettingsClient` has been removed +- Function `*AccessReviewDefaultSettingsClient.Get` has been removed +- Function `*AccessReviewDefaultSettingsClient.Put` has been removed +- Function `NewAccessReviewHistoryDefinitionClient` has been removed +- Function `*AccessReviewHistoryDefinitionClient.Create` has been removed +- Function `*AccessReviewHistoryDefinitionClient.DeleteByID` has been removed +- Function `NewAccessReviewHistoryDefinitionInstanceClient` has been removed +- Function `*AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI` has been removed +- Function `NewAccessReviewHistoryDefinitionInstancesClient` has been removed +- Function `*AccessReviewHistoryDefinitionInstancesClient.NewListPager` has been removed +- Function `NewAccessReviewHistoryDefinitionsClient` has been removed +- Function `*AccessReviewHistoryDefinitionsClient.GetByID` has been removed +- Function `*AccessReviewHistoryDefinitionsClient.NewListPager` has been removed +- Function `NewAccessReviewInstanceClient` has been removed +- Function `*AccessReviewInstanceClient.AcceptRecommendations` has been removed +- Function `*AccessReviewInstanceClient.ApplyDecisions` has been removed +- Function `*AccessReviewInstanceClient.ResetDecisions` has been removed +- Function `*AccessReviewInstanceClient.SendReminders` has been removed +- Function `*AccessReviewInstanceClient.Stop` has been removed +- Function `NewAccessReviewInstanceContactedReviewersClient` has been removed +- Function `*AccessReviewInstanceContactedReviewersClient.NewListPager` has been removed +- Function `NewAccessReviewInstanceDecisionsClient` has been removed +- Function `*AccessReviewInstanceDecisionsClient.NewListPager` has been removed +- Function `NewAccessReviewInstanceMyDecisionsClient` has been removed +- Function `*AccessReviewInstanceMyDecisionsClient.GetByID` has been removed +- Function `*AccessReviewInstanceMyDecisionsClient.NewListPager` has been removed +- Function `*AccessReviewInstanceMyDecisionsClient.Patch` has been removed +- Function `NewAccessReviewInstancesAssignedForMyApprovalClient` has been removed +- Function `*AccessReviewInstancesAssignedForMyApprovalClient.GetByID` has been removed +- Function `*AccessReviewInstancesAssignedForMyApprovalClient.NewListPager` has been removed +- Function `NewAccessReviewInstancesClient` has been removed +- Function `*AccessReviewInstancesClient.Create` has been removed +- Function `*AccessReviewInstancesClient.GetByID` has been removed +- Function `*AccessReviewInstancesClient.NewListPager` has been removed +- Function `NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient` has been removed +- Function `*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager` has been removed +- Function `NewAccessReviewScheduleDefinitionsClient` has been removed +- Function `*AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID` has been removed +- Function `*AccessReviewScheduleDefinitionsClient.DeleteByID` has been removed +- Function `*AccessReviewScheduleDefinitionsClient.GetByID` has been removed +- Function `*AccessReviewScheduleDefinitionsClient.NewListPager` has been removed +- Function `*AccessReviewScheduleDefinitionsClient.Stop` has been removed +- Function `*AlertConfigurationProperties.GetAlertConfigurationProperties` has been removed +- Function `NewAlertConfigurationsClient` has been removed +- Function `*AlertConfigurationsClient.Get` has been removed +- Function `*AlertConfigurationsClient.NewListForScopePager` has been removed +- Function `*AlertConfigurationsClient.Update` has been removed +- Function `NewAlertDefinitionsClient` has been removed +- Function `*AlertDefinitionsClient.Get` has been removed +- Function `*AlertDefinitionsClient.NewListForScopePager` has been removed +- Function `*AlertIncidentProperties.GetAlertIncidentProperties` has been removed +- Function `NewAlertIncidentsClient` has been removed +- Function `*AlertIncidentsClient.Get` has been removed +- Function `*AlertIncidentsClient.NewListForScopePager` has been removed +- Function `*AlertIncidentsClient.Remediate` has been removed +- Function `NewAlertOperationClient` has been removed +- Function `*AlertOperationClient.Get` has been removed +- Function `NewAlertsClient` has been removed +- Function `*AlertsClient.Get` has been removed +- Function `*AlertsClient.NewListForScopePager` has been removed +- Function `*AlertsClient.BeginRefresh` has been removed +- Function `*AlertsClient.BeginRefreshAll` has been removed +- Function `*AlertsClient.Update` has been removed +- Function `*AzureRolesAssignedOutsidePimAlertConfigurationProperties.GetAlertConfigurationProperties` has been removed +- Function `*AzureRolesAssignedOutsidePimAlertIncidentProperties.GetAlertIncidentProperties` has been removed +- Function `NewClassicAdministratorsClient` has been removed +- Function `*ClassicAdministratorsClient.NewListPager` has been removed +- Function `NewClientFactory` has been removed +- Function `*ClientFactory.NewAccessReviewDefaultSettingsClient` has been removed +- Function `*ClientFactory.NewAccessReviewHistoryDefinitionClient` has been removed +- Function `*ClientFactory.NewAccessReviewHistoryDefinitionInstanceClient` has been removed +- Function `*ClientFactory.NewAccessReviewHistoryDefinitionInstancesClient` has been removed +- Function `*ClientFactory.NewAccessReviewHistoryDefinitionsClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstanceClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstanceContactedReviewersClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstanceDecisionsClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstanceMyDecisionsClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient` has been removed +- Function `*ClientFactory.NewAccessReviewInstancesClient` has been removed +- Function `*ClientFactory.NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient` has been removed +- Function `*ClientFactory.NewAccessReviewScheduleDefinitionsClient` has been removed +- Function `*ClientFactory.NewAlertConfigurationsClient` has been removed +- Function `*ClientFactory.NewAlertDefinitionsClient` has been removed +- Function `*ClientFactory.NewAlertIncidentsClient` has been removed +- Function `*ClientFactory.NewAlertOperationClient` has been removed +- Function `*ClientFactory.NewAlertsClient` has been removed +- Function `*ClientFactory.NewClassicAdministratorsClient` has been removed +- Function `*ClientFactory.NewDenyAssignmentsClient` has been removed +- Function `*ClientFactory.NewEligibleChildResourcesClient` has been removed +- Function `*ClientFactory.NewGlobalAdministratorClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewPermissionsClient` has been removed +- Function `*ClientFactory.NewProviderOperationsMetadataClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentScheduleInstancesClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentScheduleRequestsClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentSchedulesClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentsClient` has been removed +- Function `*ClientFactory.NewRoleDefinitionsClient` has been removed +- Function `*ClientFactory.NewRoleEligibilityScheduleInstancesClient` has been removed +- Function `*ClientFactory.NewRoleEligibilityScheduleRequestsClient` has been removed +- Function `*ClientFactory.NewRoleEligibilitySchedulesClient` has been removed +- Function `*ClientFactory.NewRoleManagementPoliciesClient` has been removed +- Function `*ClientFactory.NewRoleManagementPolicyAssignmentsClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewDefaultSettingsClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstanceClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstancesClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionsClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewInstanceClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewInstanceContactedReviewersClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewInstanceDecisionsClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewInstancesClient` has been removed +- Function `*ClientFactory.NewScopeAccessReviewScheduleDefinitionsClient` has been removed +- Function `*ClientFactory.NewTenantLevelAccessReviewInstanceContactedReviewersClient` has been removed +- Function `NewDenyAssignmentsClient` has been removed +- Function `*DenyAssignmentsClient.Get` has been removed +- Function `*DenyAssignmentsClient.GetByID` has been removed +- Function `*DenyAssignmentsClient.NewListForResourceGroupPager` has been removed +- Function `*DenyAssignmentsClient.NewListForResourcePager` has been removed +- Function `*DenyAssignmentsClient.NewListForScopePager` has been removed +- Function `*DenyAssignmentsClient.NewListPager` has been removed +- Function `*DuplicateRoleCreatedAlertConfigurationProperties.GetAlertConfigurationProperties` has been removed +- Function `*DuplicateRoleCreatedAlertIncidentProperties.GetAlertIncidentProperties` has been removed +- Function `NewEligibleChildResourcesClient` has been removed +- Function `*EligibleChildResourcesClient.NewGetPager` has been removed +- Function `NewGlobalAdministratorClient` has been removed +- Function `*GlobalAdministratorClient.ElevateAccess` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.NewListPager` has been removed +- Function `NewPermissionsClient` has been removed +- Function `*PermissionsClient.NewListForResourceGroupPager` has been removed +- Function `*PermissionsClient.NewListForResourcePager` has been removed +- Function `NewProviderOperationsMetadataClient` has been removed +- Function `*ProviderOperationsMetadataClient.Get` has been removed +- Function `*ProviderOperationsMetadataClient.NewListPager` has been removed +- Function `NewRoleAssignmentScheduleInstancesClient` has been removed +- Function `*RoleAssignmentScheduleInstancesClient.Get` has been removed +- Function `*RoleAssignmentScheduleInstancesClient.NewListForScopePager` has been removed +- Function `NewRoleAssignmentSchedulesClient` has been removed +- Function `*RoleAssignmentSchedulesClient.Get` has been removed +- Function `*RoleAssignmentSchedulesClient.NewListForScopePager` has been removed +- Function `NewRoleAssignmentsClient` has been removed +- Function `*RoleAssignmentsClient.Create` has been removed +- Function `*RoleAssignmentsClient.CreateByID` has been removed +- Function `*RoleAssignmentsClient.Delete` has been removed +- Function `*RoleAssignmentsClient.DeleteByID` has been removed +- Function `*RoleAssignmentsClient.Get` has been removed +- Function `*RoleAssignmentsClient.GetByID` has been removed +- Function `*RoleAssignmentsClient.NewListForResourceGroupPager` has been removed +- Function `*RoleAssignmentsClient.NewListForResourcePager` has been removed +- Function `*RoleAssignmentsClient.NewListForScopePager` has been removed +- Function `*RoleAssignmentsClient.NewListForSubscriptionPager` has been removed +- Function `NewRoleDefinitionsClient` has been removed +- Function `*RoleDefinitionsClient.CreateOrUpdate` has been removed +- Function `*RoleDefinitionsClient.Delete` has been removed +- Function `*RoleDefinitionsClient.Get` has been removed +- Function `*RoleDefinitionsClient.GetByID` has been removed +- Function `*RoleDefinitionsClient.NewListPager` has been removed +- Function `NewRoleEligibilityScheduleInstancesClient` has been removed +- Function `*RoleEligibilityScheduleInstancesClient.Get` has been removed +- Function `*RoleEligibilityScheduleInstancesClient.NewListForScopePager` has been removed +- Function `NewRoleEligibilityScheduleRequestsClient` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Cancel` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Create` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Get` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.NewListForScopePager` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Validate` has been removed +- Function `NewRoleEligibilitySchedulesClient` has been removed +- Function `*RoleEligibilitySchedulesClient.Get` has been removed +- Function `*RoleEligibilitySchedulesClient.NewListForScopePager` has been removed +- Function `NewRoleManagementPoliciesClient` has been removed +- Function `*RoleManagementPoliciesClient.Delete` has been removed +- Function `*RoleManagementPoliciesClient.Get` has been removed +- Function `*RoleManagementPoliciesClient.NewListForScopePager` has been removed +- Function `*RoleManagementPoliciesClient.Update` has been removed +- Function `*RoleManagementPolicyApprovalRule.GetRoleManagementPolicyRule` has been removed +- Function `NewRoleManagementPolicyAssignmentsClient` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Create` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Delete` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Get` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.NewListForScopePager` has been removed +- Function `*RoleManagementPolicyAuthenticationContextRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyEnablementRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyExpirationRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyNotificationRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyRule.GetRoleManagementPolicyRule` has been removed +- Function `NewScopeAccessReviewDefaultSettingsClient` has been removed +- Function `*ScopeAccessReviewDefaultSettingsClient.Get` has been removed +- Function `*ScopeAccessReviewDefaultSettingsClient.Put` has been removed +- Function `NewScopeAccessReviewHistoryDefinitionClient` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionClient.Create` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionClient.DeleteByID` has been removed +- Function `NewScopeAccessReviewHistoryDefinitionInstanceClient` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI` has been removed +- Function `NewScopeAccessReviewHistoryDefinitionInstancesClient` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager` has been removed +- Function `NewScopeAccessReviewHistoryDefinitionsClient` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionsClient.GetByID` has been removed +- Function `*ScopeAccessReviewHistoryDefinitionsClient.NewListPager` has been removed +- Function `NewScopeAccessReviewInstanceClient` has been removed +- Function `*ScopeAccessReviewInstanceClient.ApplyDecisions` has been removed +- Function `*ScopeAccessReviewInstanceClient.RecordAllDecisions` has been removed +- Function `*ScopeAccessReviewInstanceClient.ResetDecisions` has been removed +- Function `*ScopeAccessReviewInstanceClient.SendReminders` has been removed +- Function `*ScopeAccessReviewInstanceClient.Stop` has been removed +- Function `NewScopeAccessReviewInstanceContactedReviewersClient` has been removed +- Function `*ScopeAccessReviewInstanceContactedReviewersClient.NewListPager` has been removed +- Function `NewScopeAccessReviewInstanceDecisionsClient` has been removed +- Function `*ScopeAccessReviewInstanceDecisionsClient.NewListPager` has been removed +- Function `NewScopeAccessReviewInstancesClient` has been removed +- Function `*ScopeAccessReviewInstancesClient.Create` has been removed +- Function `*ScopeAccessReviewInstancesClient.GetByID` has been removed +- Function `*ScopeAccessReviewInstancesClient.NewListPager` has been removed +- Function `NewScopeAccessReviewScheduleDefinitionsClient` has been removed +- Function `*ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID` has been removed +- Function `*ScopeAccessReviewScheduleDefinitionsClient.DeleteByID` has been removed +- Function `*ScopeAccessReviewScheduleDefinitionsClient.GetByID` has been removed +- Function `*ScopeAccessReviewScheduleDefinitionsClient.NewListPager` has been removed +- Function `*ScopeAccessReviewScheduleDefinitionsClient.Stop` has been removed +- Function `NewTenantLevelAccessReviewInstanceContactedReviewersClient` has been removed +- Function `*TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager` has been removed +- Function `*TooManyOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties` has been removed +- Function `*TooManyOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties` has been removed +- Function `*TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties` has been removed +- Function `*TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties` has been removed +- Struct `AccessReviewActorIdentity` has been removed +- Struct `AccessReviewContactedReviewer` has been removed +- Struct `AccessReviewContactedReviewerListResult` has been removed +- Struct `AccessReviewContactedReviewerProperties` has been removed +- Struct `AccessReviewDecision` has been removed +- Struct `AccessReviewDecisionInsight` has been removed +- Struct `AccessReviewDecisionListResult` has been removed +- Struct `AccessReviewDecisionPrincipalResourceMembership` has been removed +- Struct `AccessReviewDecisionProperties` has been removed +- Struct `AccessReviewDecisionResource` has been removed +- Struct `AccessReviewDecisionServicePrincipalIdentity` has been removed +- Struct `AccessReviewDecisionUserIdentity` has been removed +- Struct `AccessReviewDecisionUserSignInInsightProperties` has been removed +- Struct `AccessReviewDefaultSettings` has been removed +- Struct `AccessReviewHistoryDefinition` has been removed +- Struct `AccessReviewHistoryDefinitionInstanceListResult` has been removed +- Struct `AccessReviewHistoryDefinitionInstancesClientListResponse` has been removed +- Struct `AccessReviewHistoryDefinitionListResult` has been removed +- Struct `AccessReviewHistoryDefinitionProperties` has been removed +- Struct `AccessReviewHistoryDefinitionsClientListResponse` has been removed +- Struct `AccessReviewHistoryInstance` has been removed +- Struct `AccessReviewHistoryInstanceProperties` has been removed +- Struct `AccessReviewHistoryScheduleSettings` has been removed +- Struct `AccessReviewInstance` has been removed +- Struct `AccessReviewInstanceContactedReviewersClientListResponse` has been removed +- Struct `AccessReviewInstanceDecisionsClientListResponse` has been removed +- Struct `AccessReviewInstanceListResult` has been removed +- Struct `AccessReviewInstanceMyDecisionsClientListResponse` has been removed +- Struct `AccessReviewInstanceProperties` has been removed +- Struct `AccessReviewInstancesAssignedForMyApprovalClientListResponse` has been removed +- Struct `AccessReviewInstancesClientListResponse` has been removed +- Struct `AccessReviewRecurrencePattern` has been removed +- Struct `AccessReviewRecurrenceRange` has been removed +- Struct `AccessReviewRecurrenceSettings` has been removed +- Struct `AccessReviewReviewer` has been removed +- Struct `AccessReviewScheduleDefinition` has been removed +- Struct `AccessReviewScheduleDefinitionListResult` has been removed +- Struct `AccessReviewScheduleDefinitionProperties` has been removed +- Struct `AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse` has been removed +- Struct `AccessReviewScheduleDefinitionsClientListResponse` has been removed +- Struct `AccessReviewScheduleSettings` has been removed +- Struct `AccessReviewScope` has been removed +- Struct `Alert` has been removed +- Struct `AlertConfiguration` has been removed +- Struct `AlertConfigurationListResult` has been removed +- Struct `AlertConfigurationsClientListForScopeResponse` has been removed +- Struct `AlertDefinition` has been removed +- Struct `AlertDefinitionListResult` has been removed +- Struct `AlertDefinitionProperties` has been removed +- Struct `AlertDefinitionsClientListForScopeResponse` has been removed +- Struct `AlertIncident` has been removed +- Struct `AlertIncidentListResult` has been removed +- Struct `AlertIncidentsClientListForScopeResponse` has been removed +- Struct `AlertListResult` has been removed +- Struct `AlertOperationResult` has been removed +- Struct `AlertProperties` has been removed +- Struct `AlertsClientListForScopeResponse` has been removed +- Struct `AlertsClientRefreshAllResponse` has been removed +- Struct `AlertsClientRefreshResponse` has been removed +- Struct `ApprovalSettings` has been removed +- Struct `ApprovalStage` has been removed +- Struct `AzureRolesAssignedOutsidePimAlertConfigurationProperties` has been removed +- Struct `AzureRolesAssignedOutsidePimAlertIncidentProperties` has been removed +- Struct `ClassicAdministrator` has been removed +- Struct `ClassicAdministratorListResult` has been removed +- Struct `ClassicAdministratorProperties` has been removed +- Struct `ClassicAdministratorsClientListResponse` has been removed +- Struct `ClientFactory` has been removed +- Struct `DenyAssignment` has been removed +- Struct `DenyAssignmentFilter` has been removed +- Struct `DenyAssignmentListResult` has been removed +- Struct `DenyAssignmentPermission` has been removed +- Struct `DenyAssignmentProperties` has been removed +- Struct `DenyAssignmentsClientListForResourceGroupResponse` has been removed +- Struct `DenyAssignmentsClientListForResourceResponse` has been removed +- Struct `DenyAssignmentsClientListForScopeResponse` has been removed +- Struct `DenyAssignmentsClientListResponse` has been removed +- Struct `DuplicateRoleCreatedAlertConfigurationProperties` has been removed +- Struct `DuplicateRoleCreatedAlertIncidentProperties` has been removed +- Struct `EligibleChildResource` has been removed +- Struct `EligibleChildResourcesClientGetResponse` has been removed +- Struct `EligibleChildResourcesListResult` has been removed +- Struct `ErrorAdditionalInfo` has been removed +- Struct `ErrorDefinition` has been removed +- Struct `ErrorDefinitionProperties` has been removed +- Struct `ErrorDetail` has been removed +- Struct `ErrorResponse` has been removed +- Struct `Operation` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationListResult` has been removed +- Struct `OperationsClientListResponse` has been removed +- Struct `Permission` has been removed +- Struct `PermissionGetResult` has been removed +- Struct `PermissionsClientListForResourceGroupResponse` has been removed +- Struct `PermissionsClientListForResourceResponse` has been removed +- Struct `PolicyAssignmentProperties` has been removed +- Struct `PolicyAssignmentPropertiesPolicy` has been removed +- Struct `PolicyAssignmentPropertiesRoleDefinition` has been removed +- Struct `PolicyAssignmentPropertiesScope` has been removed +- Struct `PolicyProperties` has been removed +- Struct `PolicyPropertiesScope` has been removed +- Struct `Principal` has been removed +- Struct `ProviderOperation` has been removed +- Struct `ProviderOperationsMetadata` has been removed +- Struct `ProviderOperationsMetadataClientListResponse` has been removed +- Struct `ProviderOperationsMetadataListResult` has been removed +- Struct `RecordAllDecisionsProperties` has been removed +- Struct `ResourceType` has been removed +- Struct `RoleAssignment` has been removed +- Struct `RoleAssignmentCreateParameters` has been removed +- Struct `RoleAssignmentFilter` has been removed +- Struct `RoleAssignmentListResult` has been removed +- Struct `RoleAssignmentProperties` has been removed +- Struct `RoleAssignmentSchedule` has been removed +- Struct `RoleAssignmentScheduleFilter` has been removed +- Struct `RoleAssignmentScheduleInstance` has been removed +- Struct `RoleAssignmentScheduleInstanceFilter` has been removed +- Struct `RoleAssignmentScheduleInstanceListResult` has been removed +- Struct `RoleAssignmentScheduleInstanceProperties` has been removed +- Struct `RoleAssignmentScheduleInstancesClientListForScopeResponse` has been removed +- Struct `RoleAssignmentScheduleListResult` has been removed +- Struct `RoleAssignmentScheduleProperties` has been removed +- Struct `RoleAssignmentSchedulesClientListForScopeResponse` has been removed +- Struct `RoleAssignmentsClientListForResourceGroupResponse` has been removed +- Struct `RoleAssignmentsClientListForResourceResponse` has been removed +- Struct `RoleAssignmentsClientListForScopeResponse` has been removed +- Struct `RoleAssignmentsClientListForSubscriptionResponse` has been removed +- Struct `RoleDefinition` has been removed +- Struct `RoleDefinitionFilter` has been removed +- Struct `RoleDefinitionListResult` has been removed +- Struct `RoleDefinitionProperties` has been removed +- Struct `RoleDefinitionsClientListResponse` has been removed +- Struct `RoleEligibilitySchedule` has been removed +- Struct `RoleEligibilityScheduleFilter` has been removed +- Struct `RoleEligibilityScheduleInstance` has been removed +- Struct `RoleEligibilityScheduleInstanceFilter` has been removed +- Struct `RoleEligibilityScheduleInstanceListResult` has been removed +- Struct `RoleEligibilityScheduleInstanceProperties` has been removed +- Struct `RoleEligibilityScheduleInstancesClientListForScopeResponse` has been removed +- Struct `RoleEligibilityScheduleListResult` has been removed +- Struct `RoleEligibilityScheduleProperties` has been removed +- Struct `RoleEligibilityScheduleRequest` has been removed +- Struct `RoleEligibilityScheduleRequestFilter` has been removed +- Struct `RoleEligibilityScheduleRequestListResult` has been removed +- Struct `RoleEligibilityScheduleRequestProperties` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesScheduleInfo` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesTicketInfo` has been removed +- Struct `RoleEligibilityScheduleRequestsClientListForScopeResponse` has been removed +- Struct `RoleEligibilitySchedulesClientListForScopeResponse` has been removed +- Struct `RoleManagementPoliciesClientListForScopeResponse` has been removed +- Struct `RoleManagementPolicy` has been removed +- Struct `RoleManagementPolicyApprovalRule` has been removed +- Struct `RoleManagementPolicyAssignment` has been removed +- Struct `RoleManagementPolicyAssignmentListResult` has been removed +- Struct `RoleManagementPolicyAssignmentProperties` has been removed +- Struct `RoleManagementPolicyAssignmentsClientListForScopeResponse` has been removed +- Struct `RoleManagementPolicyAuthenticationContextRule` has been removed +- Struct `RoleManagementPolicyEnablementRule` has been removed +- Struct `RoleManagementPolicyExpirationRule` has been removed +- Struct `RoleManagementPolicyListResult` has been removed +- Struct `RoleManagementPolicyNotificationRule` has been removed +- Struct `RoleManagementPolicyProperties` has been removed +- Struct `RoleManagementPolicyRuleTarget` has been removed +- Struct `ScopeAccessReviewHistoryDefinitionInstancesClientListResponse` has been removed +- Struct `ScopeAccessReviewHistoryDefinitionsClientListResponse` has been removed +- Struct `ScopeAccessReviewInstanceContactedReviewersClientListResponse` has been removed +- Struct `ScopeAccessReviewInstanceDecisionsClientListResponse` has been removed +- Struct `ScopeAccessReviewInstancesClientListResponse` has been removed +- Struct `ScopeAccessReviewScheduleDefinitionsClientListResponse` has been removed +- Struct `TenantLevelAccessReviewInstanceContactedReviewersClientListResponse` has been removed +- Struct `TooManyOwnersAssignedToResourceAlertConfigurationProperties` has been removed +- Struct `TooManyOwnersAssignedToResourceAlertIncidentProperties` has been removed +- Struct `TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties` has been removed +- Struct `TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties` has been removed +- Struct `UserSet` has been removed +- Struct `ValidationResponse` has been removed +- Struct `ValidationResponseErrorInfo` has been removed + + ## 2.0.0 (2022-09-26) ### Breaking Changes diff --git a/sdk/resourcemanager/authorization/armauthorization/autorest.md b/sdk/resourcemanager/authorization/armauthorization/autorest.md index a7e5cb832c6f..298387fe2e9c 100644 --- a/sdk/resourcemanager/authorization/armauthorization/autorest.md +++ b/sdk/resourcemanager/authorization/armauthorization/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/authorization/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/authorization/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2022-04-01 +module-version: 3.0.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go deleted file mode 100644 index dfc92dd43fa5..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ClassicAdministratorsClient contains the methods for the ClassicAdministrators group. -// Don't use this type directly, use NewClassicAdministratorsClient() instead. -type ClassicAdministratorsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewClassicAdministratorsClient creates a new instance of ClassicAdministratorsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewClassicAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClassicAdministratorsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ClassicAdministratorsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// NewListPager - Gets service administrator, account administrator, and co-administrators for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-07-01 -// options - ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.List -// method. -func (client *ClassicAdministratorsClient) NewListPager(options *ClassicAdministratorsClientListOptions) *runtime.Pager[ClassicAdministratorsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ClassicAdministratorsClientListResponse]{ - More: func(page ClassicAdministratorsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClassicAdministratorsClientListResponse) (ClassicAdministratorsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClassicAdministratorsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ClassicAdministratorsClient) listCreateRequest(ctx context.Context, options *ClassicAdministratorsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-07-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ClassicAdministratorsClient) listHandleResponse(resp *http.Response) (ClassicAdministratorsClientListResponse, error) { - result := ClassicAdministratorsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClassicAdministratorListResult); err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go deleted file mode 100644 index c008a51a674a..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetClassicAdministrators.json -func ExampleClassicAdministratorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewClassicAdministratorsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/constants.go b/sdk/resourcemanager/authorization/armauthorization/constants.go index f28e67ac0c06..08b3949a0f73 100644 --- a/sdk/resourcemanager/authorization/armauthorization/constants.go +++ b/sdk/resourcemanager/authorization/armauthorization/constants.go @@ -11,113 +11,9 @@ package armauthorization const ( moduleName = "armauthorization" - moduleVersion = "v2.0.0" + moduleVersion = "v3.0.0-beta.2" ) -// ApprovalMode - The type of rule -type ApprovalMode string - -const ( - ApprovalModeNoApproval ApprovalMode = "NoApproval" - ApprovalModeParallel ApprovalMode = "Parallel" - ApprovalModeSerial ApprovalMode = "Serial" - ApprovalModeSingleStage ApprovalMode = "SingleStage" -) - -// PossibleApprovalModeValues returns the possible values for the ApprovalMode const type. -func PossibleApprovalModeValues() []ApprovalMode { - return []ApprovalMode{ - ApprovalModeNoApproval, - ApprovalModeParallel, - ApprovalModeSerial, - ApprovalModeSingleStage, - } -} - -// AssignmentType - Assignment type of the role assignment schedule -type AssignmentType string - -const ( - AssignmentTypeActivated AssignmentType = "Activated" - AssignmentTypeAssigned AssignmentType = "Assigned" -) - -// PossibleAssignmentTypeValues returns the possible values for the AssignmentType const type. -func PossibleAssignmentTypeValues() []AssignmentType { - return []AssignmentType{ - AssignmentTypeActivated, - AssignmentTypeAssigned, - } -} - -// EnablementRules - The type of enablement rule -type EnablementRules string - -const ( - EnablementRulesJustification EnablementRules = "Justification" - EnablementRulesMultiFactorAuthentication EnablementRules = "MultiFactorAuthentication" - EnablementRulesTicketing EnablementRules = "Ticketing" -) - -// PossibleEnablementRulesValues returns the possible values for the EnablementRules const type. -func PossibleEnablementRulesValues() []EnablementRules { - return []EnablementRules{ - EnablementRulesJustification, - EnablementRulesMultiFactorAuthentication, - EnablementRulesTicketing, - } -} - -// MemberType - Membership type of the role assignment schedule -type MemberType string - -const ( - MemberTypeDirect MemberType = "Direct" - MemberTypeGroup MemberType = "Group" - MemberTypeInherited MemberType = "Inherited" -) - -// PossibleMemberTypeValues returns the possible values for the MemberType const type. -func PossibleMemberTypeValues() []MemberType { - return []MemberType{ - MemberTypeDirect, - MemberTypeGroup, - MemberTypeInherited, - } -} - -// NotificationDeliveryMechanism - The type of notification. -type NotificationDeliveryMechanism string - -const ( - NotificationDeliveryMechanismEmail NotificationDeliveryMechanism = "Email" -) - -// PossibleNotificationDeliveryMechanismValues returns the possible values for the NotificationDeliveryMechanism const type. -func PossibleNotificationDeliveryMechanismValues() []NotificationDeliveryMechanism { - return []NotificationDeliveryMechanism{ - NotificationDeliveryMechanismEmail, - } -} - -// NotificationLevel - The notification level. -type NotificationLevel string - -const ( - NotificationLevelAll NotificationLevel = "All" - NotificationLevelCritical NotificationLevel = "Critical" - NotificationLevelNone NotificationLevel = "None" -) - -// PossibleNotificationLevelValues returns the possible values for the NotificationLevel const type. -func PossibleNotificationLevelValues() []NotificationLevel { - return []NotificationLevel{ - NotificationLevelAll, - NotificationLevelCritical, - NotificationLevelNone, - } -} - // PrincipalType - The principal type of the assigned principal ID. type PrincipalType string @@ -140,24 +36,6 @@ func PossiblePrincipalTypeValues() []PrincipalType { } } -// RecipientType - The recipient type. -type RecipientType string - -const ( - RecipientTypeAdmin RecipientType = "Admin" - RecipientTypeApprover RecipientType = "Approver" - RecipientTypeRequestor RecipientType = "Requestor" -) - -// PossibleRecipientTypeValues returns the possible values for the RecipientType const type. -func PossibleRecipientTypeValues() []RecipientType { - return []RecipientType{ - RecipientTypeAdmin, - RecipientTypeApprover, - RecipientTypeRequestor, - } -} - // RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc type RequestType string @@ -188,29 +66,7 @@ func PossibleRequestTypeValues() []RequestType { } } -// RoleManagementPolicyRuleType - The type of rule -type RoleManagementPolicyRuleType string - -const ( - RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule RoleManagementPolicyRuleType = "RoleManagementPolicyApprovalRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule RoleManagementPolicyRuleType = "RoleManagementPolicyAuthenticationContextRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule RoleManagementPolicyRuleType = "RoleManagementPolicyEnablementRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule RoleManagementPolicyRuleType = "RoleManagementPolicyExpirationRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule RoleManagementPolicyRuleType = "RoleManagementPolicyNotificationRule" -) - -// PossibleRoleManagementPolicyRuleTypeValues returns the possible values for the RoleManagementPolicyRuleType const type. -func PossibleRoleManagementPolicyRuleTypeValues() []RoleManagementPolicyRuleType { - return []RoleManagementPolicyRuleType{ - RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule, - } -} - -// Status - The status of the role assignment schedule. +// Status - The status of the role assignment schedule request. type Status string const ( @@ -283,19 +139,3 @@ func PossibleTypeValues() []Type { TypeNoExpiration, } } - -// UserType - The type of user. -type UserType string - -const ( - UserTypeGroup UserType = "Group" - UserTypeUser UserType = "User" -) - -// PossibleUserTypeValues returns the possible values for the UserType const type. -func PossibleUserTypeValues() []UserType { - return []UserType{ - UserTypeGroup, - UserTypeUser, - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go deleted file mode 100644 index 66127128cd4f..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go +++ /dev/null @@ -1,421 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DenyAssignmentsClient contains the methods for the DenyAssignments group. -// Don't use this type directly, use NewDenyAssignmentsClient() instead. -type DenyAssignmentsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewDenyAssignmentsClient creates a new instance of DenyAssignmentsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewDenyAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DenyAssignmentsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &DenyAssignmentsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the specified deny assignment. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the deny assignment. -// denyAssignmentID - The ID of the deny assignment to get. -// options - DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. -func (client *DenyAssignmentsClient) Get(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (DenyAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, denyAssignmentID, options) - if err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *DenyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if denyAssignmentID == "" { - return nil, errors.New("parameter denyAssignmentID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", url.PathEscape(denyAssignmentID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DenyAssignmentsClient) getHandleResponse(resp *http.Response) (DenyAssignmentsClientGetResponse, error) { - result := DenyAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Gets a deny assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// denyAssignmentID - The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} -// for subscription level deny assignments, -// or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. -// options - DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. -func (client *DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (DenyAssignmentsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, denyAssignmentID, options) - if err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *DenyAssignmentsClient) getByIDCreateRequest(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{denyAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", denyAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *DenyAssignmentsClient) getByIDHandleResponse(resp *http.Response) (DenyAssignmentsClientGetByIDResponse, error) { - result := DenyAssignmentsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListPager - Gets all deny assignments for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.List method. -func (client *DenyAssignmentsClient) NewListPager(options *DenyAssignmentsClientListOptions) *runtime.Pager[DenyAssignmentsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListResponse]{ - More: func(page DenyAssignmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListResponse) (DenyAssignmentsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *DenyAssignmentsClient) listCreateRequest(ctx context.Context, options *DenyAssignmentsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DenyAssignmentsClient) listHandleResponse(resp *http.Response) (DenyAssignmentsClientListResponse, error) { - result := DenyAssignmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListResponse{}, err - } - return result, nil -} - -// NewListForResourcePager - Gets deny assignments for a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// resourceProviderNamespace - The namespace of the resource provider. -// parentResourcePath - The parent resource identity. -// resourceType - The resource type of the resource. -// resourceName - The name of the resource to get deny assignments for. -// options - DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.ListForResource -// method. -func (client *DenyAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) *runtime.Pager[DenyAssignmentsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceResponse]{ - More: func(page DenyAssignmentsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceResponse) (DenyAssignmentsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *DenyAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *DenyAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceResponse, error) { - result := DenyAssignmentsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - Gets deny assignments for a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.ListForResourceGroup -// method. -func (client *DenyAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) *runtime.Pager[DenyAssignmentsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceGroupResponse]{ - More: func(page DenyAssignmentsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceGroupResponse) (DenyAssignmentsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *DenyAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *DenyAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceGroupResponse, error) { - result := DenyAssignmentsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets deny assignments for a scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the deny assignments. -// options - DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.ListForScope -// method. -func (client *DenyAssignmentsClient) NewListForScopePager(scope string, options *DenyAssignmentsClientListForScopeOptions) *runtime.Pager[DenyAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForScopeResponse]{ - More: func(page DenyAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForScopeResponse) (DenyAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *DenyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *DenyAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *DenyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (DenyAssignmentsClientListForScopeResponse, error) { - result := DenyAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go deleted file mode 100644 index 9d3ef8a61444..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResource.json -func ExampleDenyAssignmentsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("rgname", "resourceProviderNamespace", "parentResourcePath", "resourceType", "resourceName", &armauthorization.DenyAssignmentsClientListForResourceOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResourceGroup.json -func ExampleDenyAssignmentsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("rgname", &armauthorization.DenyAssignmentsClientListForResourceGroupOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllDenyAssignments.json -func ExampleDenyAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armauthorization.DenyAssignmentsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json -func ExampleDenyAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "subscriptions/subId/resourcegroups/rgname", "denyAssignmentId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentById.json -func ExampleDenyAssignmentsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByID(ctx, "subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/daId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByScope.json -func ExampleDenyAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("subscriptions/subId", &armauthorization.DenyAssignmentsClientListForScopeOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go deleted file mode 100644 index 00f478ac0592..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// EligibleChildResourcesClient contains the methods for the EligibleChildResources group. -// Don't use this type directly, use NewEligibleChildResourcesClient() instead. -type EligibleChildResourcesClient struct { - host string - pl runtime.Pipeline -} - -// NewEligibleChildResourcesClient creates a new instance of EligibleChildResourcesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewEligibleChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EligibleChildResourcesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &EligibleChildResourcesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// NewGetPager - Get the child resources of a resource on which user has eligible access -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy. -// options - EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.Get -// method. -func (client *EligibleChildResourcesClient) NewGetPager(scope string, options *EligibleChildResourcesClientGetOptions) *runtime.Pager[EligibleChildResourcesClientGetResponse] { - return runtime.NewPager(runtime.PagingHandler[EligibleChildResourcesClientGetResponse]{ - More: func(page EligibleChildResourcesClientGetResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *EligibleChildResourcesClientGetResponse) (EligibleChildResourcesClientGetResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.getCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EligibleChildResourcesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) - }, - }) -} - -// getCreateRequest creates the Get request. -func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context, scope string, options *EligibleChildResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/eligibleChildResources" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EligibleChildResourcesClient) getHandleResponse(resp *http.Response) (EligibleChildResourcesClientGetResponse, error) { - result := EligibleChildResourcesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EligibleChildResourcesListResult); err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go deleted file mode 100644 index d28ff6bc3fb1..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json -func ExampleEligibleChildResourcesClient_NewGetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewEligibleChildResourcesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetPager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.EligibleChildResourcesClientGetOptions{Filter: to.Ptr("resourceType+eq+'resourcegroup'")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go deleted file mode 100644 index 0f47371780fe..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// GlobalAdministratorClient contains the methods for the GlobalAdministrator group. -// Don't use this type directly, use NewGlobalAdministratorClient() instead. -type GlobalAdministratorClient struct { - host string - pl runtime.Pipeline -} - -// NewGlobalAdministratorClient creates a new instance of GlobalAdministratorClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewGlobalAdministratorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GlobalAdministratorClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GlobalAdministratorClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// ElevateAccess - Elevates access for a Global Administrator. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-07-01 -// options - GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess -// method. -func (client *GlobalAdministratorClient) ElevateAccess(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (GlobalAdministratorClientElevateAccessResponse, error) { - req, err := client.elevateAccessCreateRequest(ctx, options) - if err != nil { - return GlobalAdministratorClientElevateAccessResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GlobalAdministratorClientElevateAccessResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GlobalAdministratorClientElevateAccessResponse{}, runtime.NewResponseError(resp) - } - return GlobalAdministratorClientElevateAccessResponse{}, nil -} - -// elevateAccessCreateRequest creates the ElevateAccess request. -func (client *GlobalAdministratorClient) elevateAccessCreateRequest(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/elevateAccess" - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-07-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go deleted file mode 100644 index 4718333191da..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go +++ /dev/null @@ -1,34 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json -func ExampleGlobalAdministratorClient_ElevateAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewGlobalAdministratorClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.ElevateAccess(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/go.mod b/sdk/resourcemanager/authorization/armauthorization/go.mod index 51545c66c9f6..a36dfaa9f4e2 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.mod +++ b/sdk/resourcemanager/authorization/armauthorization/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/authorization/armauthorization/go.sum b/sdk/resourcemanager/authorization/armauthorization/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.sum +++ b/sdk/resourcemanager/authorization/armauthorization/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/authorization/armauthorization/models.go b/sdk/resourcemanager/authorization/armauthorization/models.go index 4a5cc29a13c1..e6cf148a8292 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models.go +++ b/sdk/resourcemanager/authorization/armauthorization/models.go @@ -11,1405 +11,98 @@ package armauthorization import "time" -// ApprovalSettings - The approval settings. -type ApprovalSettings struct { - // The type of rule - ApprovalMode *ApprovalMode `json:"approvalMode,omitempty"` - - // The approval stages of the request. - ApprovalStages []*ApprovalStage `json:"approvalStages,omitempty"` - - // Determines whether approval is required or not. - IsApprovalRequired *bool `json:"isApprovalRequired,omitempty"` - - // Determines whether approval is required for assignment extension. - IsApprovalRequiredForExtension *bool `json:"isApprovalRequiredForExtension,omitempty"` - - // Determine whether requestor justification is required. - IsRequestorJustificationRequired *bool `json:"isRequestorJustificationRequired,omitempty"` -} - -// ApprovalStage - The approval stage. -type ApprovalStage struct { - // The time in days when approval request would be timed out - ApprovalStageTimeOutInDays *int32 `json:"approvalStageTimeOutInDays,omitempty"` - - // The escalation approver of the request. - EscalationApprovers []*UserSet `json:"escalationApprovers,omitempty"` - - // The time in minutes when the approval request would be escalated if the primary approver does not approve - EscalationTimeInMinutes *int32 `json:"escalationTimeInMinutes,omitempty"` - - // Determines whether approver need to provide justification for his decision. - IsApproverJustificationRequired *bool `json:"isApproverJustificationRequired,omitempty"` - - // The value determine whether escalation feature is enabled. - IsEscalationEnabled *bool `json:"isEscalationEnabled,omitempty"` - - // The primary approver of the request. - PrimaryApprovers []*UserSet `json:"primaryApprovers,omitempty"` -} - -// ClassicAdministrator - Classic Administrators -type ClassicAdministrator struct { - // The ID of the administrator. - ID *string `json:"id,omitempty"` - - // The name of the administrator. - Name *string `json:"name,omitempty"` - - // Properties for the classic administrator. - Properties *ClassicAdministratorProperties `json:"properties,omitempty"` - - // The type of the administrator. - Type *string `json:"type,omitempty"` -} - -// ClassicAdministratorListResult - ClassicAdministrator list result information. -type ClassicAdministratorListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // An array of administrators. - Value []*ClassicAdministrator `json:"value,omitempty"` -} - -// ClassicAdministratorProperties - Classic Administrator properties. -type ClassicAdministratorProperties struct { - // The email address of the administrator. - EmailAddress *string `json:"emailAddress,omitempty"` - - // The role of the administrator. - Role *string `json:"role,omitempty"` -} - -// ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.List method. -type ClassicAdministratorsClientListOptions struct { - // placeholder for future optional parameters -} - -// CloudError - An error response from the service. -type CloudError struct { - // An error response from the service. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` -} - -// DenyAssignment - Deny Assignment -type DenyAssignment struct { - // Deny assignment properties. - Properties *DenyAssignmentProperties `json:"properties,omitempty"` - - // READ-ONLY; The deny assignment ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The deny assignment name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The deny assignment type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// DenyAssignmentFilter - Deny Assignments filter -type DenyAssignmentFilter struct { - // Return deny assignment with specified name. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` - - // Return all deny assignments where the specified principal is listed either in the principals list or exclude principals - // list of deny assignments. - GdprExportPrincipalID *string `json:"gdprExportPrincipalId,omitempty"` - - // Return all deny assignments where the specified principal is listed in the principals list of deny assignments. - PrincipalID *string `json:"principalId,omitempty"` -} - -// DenyAssignmentListResult - Deny assignment list operation result. -type DenyAssignmentListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Deny assignment list. - Value []*DenyAssignment `json:"value,omitempty"` -} - -// DenyAssignmentPermission - Deny assignment permissions. -type DenyAssignmentPermission struct { - // Actions to which the deny assignment does not grant access. - Actions []*string `json:"actions,omitempty"` - - // The conditions on the Deny assignment permission. This limits the resources it applies to. - Condition *string `json:"condition,omitempty"` - - // Version of the condition. - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // Data actions to which the deny assignment does not grant access. - DataActions []*string `json:"dataActions,omitempty"` - - // Actions to exclude from that the deny assignment does not grant access. - NotActions []*string `json:"notActions,omitempty"` - - // Data actions to exclude from that the deny assignment does not grant access. - NotDataActions []*string `json:"notDataActions,omitempty"` -} - -// DenyAssignmentProperties - Deny assignment properties. -type DenyAssignmentProperties struct { - // The display name of the deny assignment. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` - - // The description of the deny assignment. - Description *string `json:"description,omitempty"` - - // Determines if the deny assignment applies to child scopes. Default value is false. - DoNotApplyToChildScopes *bool `json:"doNotApplyToChildScopes,omitempty"` - - // Array of principals to which the deny assignment does not apply. - ExcludePrincipals []*Principal `json:"excludePrincipals,omitempty"` - - // Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. - IsSystemProtected *bool `json:"isSystemProtected,omitempty"` - - // An array of permissions that are denied by the deny assignment. - Permissions []*DenyAssignmentPermission `json:"permissions,omitempty"` - - // Array of principals to which the deny assignment applies. - Principals []*Principal `json:"principals,omitempty"` - - // The deny assignment scope. - Scope *string `json:"scope,omitempty"` -} - -// DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. -type DenyAssignmentsClientGetByIDOptions struct { - // placeholder for future optional parameters -} - -// DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. -type DenyAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.ListForResourceGroup -// method. -type DenyAssignmentsClientListForResourceGroupOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} - -// DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.ListForResource -// method. -type DenyAssignmentsClientListForResourceOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} - -// DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.ListForScope method. -type DenyAssignmentsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} - -// DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.List method. -type DenyAssignmentsClientListOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} - -// EligibleChildResource - Eligible child resource -type EligibleChildResource struct { - // READ-ONLY; The resource scope Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The resource type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.Get method. -type EligibleChildResourcesClientGetOptions struct { - // The filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only resource of type = 'Subscription'. - // Use - // $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = 'Subscription' - // or 'ResourceGroup' - Filter *string -} - -// EligibleChildResourcesListResult - Eligible child resources list operation result. -type EligibleChildResourcesListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Eligible child resource list. - Value []*EligibleChildResource `json:"value,omitempty"` -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` - - // READ-ONLY; The additional info type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error details. - Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The error target. - Target *string `json:"target,omitempty" azure:"ro"` -} - -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - +// ExpandedProperties - Expanded info of resource, role and principal type ExpandedProperties struct { // Details of the principal Principal *ExpandedPropertiesPrincipal `json:"principal,omitempty"` - // Details of role definition - RoleDefinition *ExpandedPropertiesRoleDefinition `json:"roleDefinition,omitempty"` - - // Details of the resource scope - Scope *ExpandedPropertiesScope `json:"scope,omitempty"` -} - -// ExpandedPropertiesPrincipal - Details of the principal -type ExpandedPropertiesPrincipal struct { - // Display name of the principal - DisplayName *string `json:"displayName,omitempty"` - - // Email id of the principal - Email *string `json:"email,omitempty"` - - // Id of the principal - ID *string `json:"id,omitempty"` - - // Type of the principal - Type *string `json:"type,omitempty"` -} - -// ExpandedPropertiesRoleDefinition - Details of role definition -type ExpandedPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string `json:"displayName,omitempty"` - - // Id of the role definition - ID *string `json:"id,omitempty"` - - // Type of the role definition - Type *string `json:"type,omitempty"` -} - -// ExpandedPropertiesScope - Details of the resource scope -type ExpandedPropertiesScope struct { - // Display name of the resource - DisplayName *string `json:"displayName,omitempty"` - - // Scope id of the resource - ID *string `json:"id,omitempty"` - - // Type of the resource - Type *string `json:"type,omitempty"` -} - -// GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess -// method. -type GlobalAdministratorClientElevateAccessOptions struct { - // placeholder for future optional parameters -} - -// Permission - Role definition permissions. -type Permission struct { - // Allowed actions. - Actions []*string `json:"actions,omitempty"` - - // Allowed Data actions. - DataActions []*string `json:"dataActions,omitempty"` - - // Denied actions. - NotActions []*string `json:"notActions,omitempty"` - - // Denied Data actions. - NotDataActions []*string `json:"notDataActions,omitempty"` -} - -// PermissionGetResult - Permissions information. -type PermissionGetResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // An array of permissions. - Value []*Permission `json:"value,omitempty"` -} - -// PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.ListForResourceGroup -// method. -type PermissionsClientListForResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.ListForResource method. -type PermissionsClientListForResourceOptions struct { - // placeholder for future optional parameters -} - -// PolicyAssignmentProperties - Expanded info of resource scope, role definition and policy -type PolicyAssignmentProperties struct { - // Details of the policy - Policy *PolicyAssignmentPropertiesPolicy `json:"policy,omitempty"` - - // Details of role definition - RoleDefinition *PolicyAssignmentPropertiesRoleDefinition `json:"roleDefinition,omitempty"` - - // Details of the resource scope - Scope *PolicyAssignmentPropertiesScope `json:"scope,omitempty"` -} - -// PolicyAssignmentPropertiesPolicy - Details of the policy -type PolicyAssignmentPropertiesPolicy struct { - // Id of the policy - ID *string `json:"id,omitempty"` - - // The last modified date time. - LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty"` - - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal `json:"lastModifiedBy,omitempty" azure:"ro"` -} - -// PolicyAssignmentPropertiesRoleDefinition - Details of role definition -type PolicyAssignmentPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string `json:"displayName,omitempty"` - - // Id of the role definition - ID *string `json:"id,omitempty"` - - // Type of the role definition - Type *string `json:"type,omitempty"` -} - -// PolicyAssignmentPropertiesScope - Details of the resource scope -type PolicyAssignmentPropertiesScope struct { - // Display name of the resource - DisplayName *string `json:"displayName,omitempty"` - - // Scope id of the resource - ID *string `json:"id,omitempty"` - - // Type of the resource - Type *string `json:"type,omitempty"` -} - -// PolicyProperties - Expanded info of resource scope -type PolicyProperties struct { - // READ-ONLY; Details of the resource scope - Scope *PolicyPropertiesScope `json:"scope,omitempty" azure:"ro"` -} - -// PolicyPropertiesScope - Details of the resource scope -type PolicyPropertiesScope struct { - // Display name of the resource - DisplayName *string `json:"displayName,omitempty"` - - // Scope id of the resource - ID *string `json:"id,omitempty"` - - // Type of the resource - Type *string `json:"type,omitempty"` -} - -// Principal - The name of the entity last modified it -type Principal struct { - // The name of the principal made changes - DisplayName *string `json:"displayName,omitempty"` - - // Email of principal - Email *string `json:"email,omitempty"` - - // The id of the principal made changes - ID *string `json:"id,omitempty"` - - // Type of principal such as user , group etc - Type *string `json:"type,omitempty"` -} - -// ProviderOperation - Operation -type ProviderOperation struct { - // The operation description. - Description *string `json:"description,omitempty"` - - // The operation display name. - DisplayName *string `json:"displayName,omitempty"` - - // The dataAction flag to specify the operation type. - IsDataAction *bool `json:"isDataAction,omitempty"` - - // The operation name. - Name *string `json:"name,omitempty"` - - // The operation origin. - Origin *string `json:"origin,omitempty"` - - // The operation properties. - Properties interface{} `json:"properties,omitempty"` -} - -// ProviderOperationsMetadata - Provider Operations metadata -type ProviderOperationsMetadata struct { - // The provider display name. - DisplayName *string `json:"displayName,omitempty"` - - // The provider id. - ID *string `json:"id,omitempty"` - - // The provider name. - Name *string `json:"name,omitempty"` - - // The provider operations. - Operations []*ProviderOperation `json:"operations,omitempty"` - - // The provider resource types - ResourceTypes []*ResourceType `json:"resourceTypes,omitempty"` - - // The provider type. - Type *string `json:"type,omitempty"` -} - -// ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get -// method. -type ProviderOperationsMetadataClientGetOptions struct { - // Specifies whether to expand the values. - Expand *string -} - -// ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.List -// method. -type ProviderOperationsMetadataClientListOptions struct { - // Specifies whether to expand the values. - Expand *string -} - -// ProviderOperationsMetadataListResult - Provider operations metadata list -type ProviderOperationsMetadataListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // The list of providers. - Value []*ProviderOperationsMetadata `json:"value,omitempty"` -} - -// ResourceType - Resource Type -type ResourceType struct { - // The resource type display name. - DisplayName *string `json:"displayName,omitempty"` - - // The resource type name. - Name *string `json:"name,omitempty"` - - // The resource type operations. - Operations []*ProviderOperation `json:"operations,omitempty"` -} - -// RoleAssignment - Role Assignments -type RoleAssignment struct { - // Role assignment properties. - Properties *RoleAssignmentProperties `json:"properties,omitempty"` - - // READ-ONLY; The role assignment ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleAssignmentCreateParameters - Role assignment create parameters. -type RoleAssignmentCreateParameters struct { - // REQUIRED; Role assignment properties. - Properties *RoleAssignmentProperties `json:"properties,omitempty"` -} - -// RoleAssignmentFilter - Role Assignments filter -type RoleAssignmentFilter struct { - // Returns role assignment of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` -} - -// RoleAssignmentListResult - Role assignment list operation result. -type RoleAssignmentListResult struct { - // Role assignment list. - Value []*RoleAssignment `json:"value,omitempty"` - - // READ-ONLY; The skipToken to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` -} - -// RoleAssignmentProperties - Role assignment properties. -type RoleAssignmentProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // REQUIRED; The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently the only accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // Id of the delegated managed identity resource - DelegatedManagedIdentityResourceID *string `json:"delegatedManagedIdentityResourceId,omitempty"` - - // Description of role assignment - Description *string `json:"description,omitempty"` - - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` - - // READ-ONLY; Id of the user who created the assignment - CreatedBy *string `json:"createdBy,omitempty" azure:"ro"` - - // READ-ONLY; Time it was created - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment scope. - Scope *string `json:"scope,omitempty" azure:"ro"` - - // READ-ONLY; Id of the user who updated the assignment - UpdatedBy *string `json:"updatedBy,omitempty" azure:"ro"` - - // READ-ONLY; Time it was updated - UpdatedOn *time.Time `json:"updatedOn,omitempty" azure:"ro"` -} - -// RoleAssignmentSchedule - Role Assignment schedule -type RoleAssignmentSchedule struct { - // Role assignment schedule properties. - Properties *RoleAssignmentScheduleProperties `json:"properties,omitempty"` - - // READ-ONLY; The role assignment schedule Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleAssignmentScheduleFilter - Role assignment schedule filter -type RoleAssignmentScheduleFilter struct { - // Returns role assignment schedule of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role assignment schedule of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role assignment schedule instances of the specific status. - Status *string `json:"status,omitempty"` -} - -// RoleAssignmentScheduleInstance - Information about current or upcoming role assignment schedule instance -type RoleAssignmentScheduleInstance struct { - // Role assignment schedule instance properties. - Properties *RoleAssignmentScheduleInstanceProperties `json:"properties,omitempty"` - - // READ-ONLY; The role assignment schedule instance ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule instance name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule instance type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleAssignmentScheduleInstanceFilter - Role assignment schedule instance filter -type RoleAssignmentScheduleInstanceFilter struct { - // Returns role assignment schedule instances of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role assignment schedule instances belonging to a specific role assignment schedule. - RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` - - // Returns role assignment schedule instances of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role assignment schedule instances of the specific status. - Status *string `json:"status,omitempty"` -} - -// RoleAssignmentScheduleInstanceListResult - Role assignment schedule instance list operation result. -type RoleAssignmentScheduleInstanceListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role assignment schedule instance list. - Value []*RoleAssignmentScheduleInstance `json:"value,omitempty"` -} - -// RoleAssignmentScheduleInstanceProperties - Role assignment schedule properties with scope. -type RoleAssignmentScheduleInstanceProperties struct { - // Assignment type of the role assignment schedule - AssignmentType *AssignmentType `json:"assignmentType,omitempty"` - - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // DateTime when role assignment schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` - - // The endDateTime of the role assignment schedule instance - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` - - // roleEligibilityScheduleId used to activate - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` - - // roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance - LinkedRoleEligibilityScheduleInstanceID *string `json:"linkedRoleEligibilityScheduleInstanceId,omitempty"` - - // Membership type of the role assignment schedule - MemberType *MemberType `json:"memberType,omitempty"` - - // Role Assignment Id in external system - OriginRoleAssignmentID *string `json:"originRoleAssignmentId,omitempty"` - - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` - - // Id of the master role assignment schedule - RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` - - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The role assignment schedule scope. - Scope *string `json:"scope,omitempty"` - - // The startDateTime of the role assignment schedule instance - StartDateTime *time.Time `json:"startDateTime,omitempty"` - - // The status of the role assignment schedule instance. - Status *Status `json:"status,omitempty"` -} - -// RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get -// method. -type RoleAssignmentScheduleInstancesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.ListForScope -// method. -type RoleAssignmentScheduleInstancesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment - // schedule instances for the user. Use $filter=asTarget() to return all role - // assignment schedule instances created for the current user. - Filter *string -} - -// RoleAssignmentScheduleListResult - Role assignment schedule list operation result. -type RoleAssignmentScheduleListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role assignment schedule list. - Value []*RoleAssignmentSchedule `json:"value,omitempty"` -} - -// RoleAssignmentScheduleProperties - Role assignment schedule properties with scope. -type RoleAssignmentScheduleProperties struct { - // Assignment type of the role assignment schedule - AssignmentType *AssignmentType `json:"assignmentType,omitempty"` - - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // DateTime when role assignment schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` - - // End DateTime when role assignment schedule - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` - - // The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` - - // Membership type of the role assignment schedule - MemberType *MemberType `json:"memberType,omitempty"` - - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` - - // The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule - RoleAssignmentScheduleRequestID *string `json:"roleAssignmentScheduleRequestId,omitempty"` - - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The role assignment schedule scope. - Scope *string `json:"scope,omitempty"` - - // Start DateTime when role assignment schedule - StartDateTime *time.Time `json:"startDateTime,omitempty"` - - // The status of the role assignment schedule. - Status *Status `json:"status,omitempty"` - - // DateTime when role assignment schedule was modified - UpdatedOn *time.Time `json:"updatedOn,omitempty"` -} - -// RoleAssignmentScheduleRequest - Role Assignment schedule request -type RoleAssignmentScheduleRequest struct { - // Role assignment schedule request properties. - Properties *RoleAssignmentScheduleRequestProperties `json:"properties,omitempty"` - - // READ-ONLY; The role assignment schedule request ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule request name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule request type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleAssignmentScheduleRequestFilter - Role assignment schedule request filter -type RoleAssignmentScheduleRequestFilter struct { - // Returns role assignment requests of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role assignment requests created by specific principal. - RequestorID *string `json:"requestorId,omitempty"` - - // Returns role assignment requests of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role assignment requests of specific status. - Status *string `json:"status,omitempty"` -} - -// RoleAssignmentScheduleRequestListResult - Role assignment schedule request list operation result. -type RoleAssignmentScheduleRequestListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role assignment schedule request list. - Value []*RoleAssignmentScheduleRequest `json:"value,omitempty"` -} - -// RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties with scope. -type RoleAssignmentScheduleRequestProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc - RequestType *RequestType `json:"requestType,omitempty"` - - // REQUIRED; The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // Justification for the role assignment - Justification *string `json:"justification,omitempty"` - - // The linked role eligibility schedule id - to activate an eligibility. - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` - - // Schedule info of the role assignment schedule - ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` - - // The resultant role assignment schedule id or the role assignment schedule id being updated - TargetRoleAssignmentScheduleID *string `json:"targetRoleAssignmentScheduleId,omitempty"` - - // The role assignment schedule instance id being updated - TargetRoleAssignmentScheduleInstanceID *string `json:"targetRoleAssignmentScheduleInstanceId,omitempty"` - - // Ticket Info of the role assignment - TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` - - // READ-ONLY; The approvalId of the role assignment schedule request. - ApprovalID *string `json:"approvalId,omitempty" azure:"ro"` - - // READ-ONLY; DateTime when role assignment schedule request was created - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` - - // READ-ONLY; Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty" azure:"ro"` - - // READ-ONLY; The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty" azure:"ro"` - - // READ-ONLY; Id of the user who created this request - RequestorID *string `json:"requestorId,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule request scope. - Scope *string `json:"scope,omitempty" azure:"ro"` - - // READ-ONLY; The status of the role assignment schedule request. - Status *Status `json:"status,omitempty" azure:"ro"` -} - -// RoleAssignmentScheduleRequestPropertiesScheduleInfo - Schedule info of the role assignment schedule -type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { - // Expiration of the role assignment schedule - Expiration *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` - - // Start DateTime of the role assignment schedule. - StartDateTime *time.Time `json:"startDateTime,omitempty"` -} - -// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role assignment schedule -type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role assignment schedule in TimeSpan. - Duration *string `json:"duration,omitempty"` - - // End DateTime of the role assignment schedule. - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Type of the role assignment schedule expiration - Type *Type `json:"type,omitempty"` -} - -// RoleAssignmentScheduleRequestPropertiesTicketInfo - Ticket Info of the role assignment -type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role assignment - TicketNumber *string `json:"ticketNumber,omitempty"` - - // Ticket system name for the role assignment - TicketSystem *string `json:"ticketSystem,omitempty"` -} - -// RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel -// method. -type RoleAssignmentScheduleRequestsClientCancelOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create -// method. -type RoleAssignmentScheduleRequestsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get -// method. -type RoleAssignmentScheduleRequestsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.ListForScope -// method. -type RoleAssignmentScheduleRequestsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule requests at or above - // the scope. Use $filter=principalId eq {id} to return all role assignment - // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role - // assignment schedule requests requested by the current user. Use - // $filter=asTarget() to return all role assignment schedule requests created for the current user. Use $filter=asApprover() - // to return all role assignment schedule requests where the current user is an - // approver. - Filter *string -} - -// RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate -// method. -type RoleAssignmentScheduleRequestsClientValidateOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get method. -type RoleAssignmentSchedulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.ListForScope -// method. -type RoleAssignmentSchedulesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment - // schedules for the current user. Use $filter=asTarget() to return all role - // assignment schedules created for the current user. - Filter *string -} - -// RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID method. -type RoleAssignmentsClientCreateByIDOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. -type RoleAssignmentsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID method. -type RoleAssignmentsClientDeleteByIDOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. -type RoleAssignmentsClientDeleteOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. -type RoleAssignmentsClientGetByIDOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. -type RoleAssignmentsClientGetOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.ListForResourceGroup -// method. -type RoleAssignmentsClientListForResourceGroupOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.ListForResource -// method. -type RoleAssignmentsClientListForResourceOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.ListForScope method. -type RoleAssignmentsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // The skipToken to apply on the operation. Use $skipToken={skiptoken} to return paged role assignments following the skipToken - // passed. Only supported on provider level calls. - SkipToken *string - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.ListForSubscription -// method. -type RoleAssignmentsClientListForSubscriptionOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string -} - -// RoleDefinition - Role definition. -type RoleDefinition struct { - // Role definition properties. - Properties *RoleDefinitionProperties `json:"properties,omitempty"` - - // READ-ONLY; The role definition ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role definition name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role definition type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleDefinitionFilter - Role Definitions filter -type RoleDefinitionFilter struct { - // Returns role definition with the specific name. - RoleName *string `json:"roleName,omitempty"` - - // Returns role definition with the specific type. - Type *string `json:"type,omitempty"` -} - -// RoleDefinitionListResult - Role definition list operation result. -type RoleDefinitionListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role definition list. - Value []*RoleDefinition `json:"value,omitempty"` -} - -// RoleDefinitionProperties - Role definition properties. -type RoleDefinitionProperties struct { - // Role definition assignable scopes. - AssignableScopes []*string `json:"assignableScopes,omitempty"` - - // The role definition description. - Description *string `json:"description,omitempty"` - - // Role definition permissions. - Permissions []*Permission `json:"permissions,omitempty"` - - // The role name. - RoleName *string `json:"roleName,omitempty"` - - // The role type. - RoleType *string `json:"type,omitempty"` -} - -// RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate -// method. -type RoleDefinitionsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. -type RoleDefinitionsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. -type RoleDefinitionsClientGetByIDOptions struct { - // placeholder for future optional parameters -} - -// RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. -type RoleDefinitionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.List method. -type RoleDefinitionsClientListOptions struct { - // The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. - Filter *string -} - -// RoleEligibilitySchedule - Role eligibility schedule -type RoleEligibilitySchedule struct { - // role eligibility schedule properties. - Properties *RoleEligibilityScheduleProperties `json:"properties,omitempty"` - - // READ-ONLY; The role eligibility schedule Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role eligibility schedule name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role eligibility schedule type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleEligibilityScheduleFilter - Role eligibility schedule filter -type RoleEligibilityScheduleFilter struct { - // Returns role eligibility schedule of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role eligibility schedule of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role eligibility schedule of the specific status. - Status *string `json:"status,omitempty"` -} - -// RoleEligibilityScheduleInstance - Information about current or upcoming role eligibility schedule instance -type RoleEligibilityScheduleInstance struct { - // Role eligibility schedule instance properties. - Properties *RoleEligibilityScheduleInstanceProperties `json:"properties,omitempty"` - - // READ-ONLY; The role eligibility schedule instance ID. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role eligibility schedule instance name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role eligibility schedule instance type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleEligibilityScheduleInstanceFilter - Role eligibility schedule instance filter -type RoleEligibilityScheduleInstanceFilter struct { - // Returns role eligibility schedule instances of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role eligibility schedule instances of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role eligibility schedule instances belonging to a specific role eligibility schedule. - RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` - - // Returns role eligibility schedule instances of the specific status. - Status *string `json:"status,omitempty"` -} - -// RoleEligibilityScheduleInstanceListResult - Role eligibility schedule instance list operation result. -type RoleEligibilityScheduleInstanceListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role eligibility schedule instance list. - Value []*RoleEligibilityScheduleInstance `json:"value,omitempty"` -} - -// RoleEligibilityScheduleInstanceProperties - Role eligibility schedule properties with scope. -type RoleEligibilityScheduleInstanceProperties struct { - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // DateTime when role eligibility schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` - - // The endDateTime of the role eligibility schedule instance - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` - - // Membership type of the role eligibility schedule - MemberType *MemberType `json:"memberType,omitempty"` - - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` - - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Id of the master role eligibility schedule - RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` - - // The role eligibility schedule scope. - Scope *string `json:"scope,omitempty"` - - // The startDateTime of the role eligibility schedule instance - StartDateTime *time.Time `json:"startDateTime,omitempty"` - - // The status of the role eligibility schedule instance - Status *Status `json:"status,omitempty"` -} - -// RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get -// method. -type RoleEligibilityScheduleInstancesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.ListForScope -// method. -type RoleEligibilityScheduleInstancesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility - // schedules for the user. Use $filter=asTarget() to return all role eligibility - // schedules created for the current user. - Filter *string -} - -// RoleEligibilityScheduleListResult - role eligibility schedule list operation result. -type RoleEligibilityScheduleListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // role eligibility schedule list. - Value []*RoleEligibilitySchedule `json:"value,omitempty"` -} - -// RoleEligibilityScheduleProperties - Role eligibility schedule properties with scope. -type RoleEligibilityScheduleProperties struct { - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // DateTime when role eligibility schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` + // Details of role definition + RoleDefinition *ExpandedPropertiesRoleDefinition `json:"roleDefinition,omitempty"` - // End DateTime when role eligibility schedule - EndDateTime *time.Time `json:"endDateTime,omitempty"` + // Details of the resource scope + Scope *ExpandedPropertiesScope `json:"scope,omitempty"` +} - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +// ExpandedPropertiesPrincipal - Details of the principal +type ExpandedPropertiesPrincipal struct { + // Display name of the principal + DisplayName *string `json:"displayName,omitempty"` - // Membership type of the role eligibility schedule - MemberType *MemberType `json:"memberType,omitempty"` + // Email id of the principal + Email *string `json:"email,omitempty"` - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` + // Id of the principal + ID *string `json:"id,omitempty"` - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` + // Type of the principal + Type *string `json:"type,omitempty"` +} - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` +// ExpandedPropertiesRoleDefinition - Details of role definition +type ExpandedPropertiesRoleDefinition struct { + // Display name of the role definition + DisplayName *string `json:"displayName,omitempty"` - // The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule - RoleEligibilityScheduleRequestID *string `json:"roleEligibilityScheduleRequestId,omitempty"` + // Id of the role definition + ID *string `json:"id,omitempty"` - // The role eligibility schedule scope. - Scope *string `json:"scope,omitempty"` + // Type of the role definition + Type *string `json:"type,omitempty"` +} - // Start DateTime when role eligibility schedule - StartDateTime *time.Time `json:"startDateTime,omitempty"` +// ExpandedPropertiesScope - Details of the resource scope +type ExpandedPropertiesScope struct { + // Display name of the resource + DisplayName *string `json:"displayName,omitempty"` - // The status of the role eligibility schedule. - Status *Status `json:"status,omitempty"` + // Scope id of the resource + ID *string `json:"id,omitempty"` - // DateTime when role eligibility schedule was modified - UpdatedOn *time.Time `json:"updatedOn,omitempty"` + // Type of the resource + Type *string `json:"type,omitempty"` } -// RoleEligibilityScheduleRequest - Role Eligibility schedule request -type RoleEligibilityScheduleRequest struct { - // Role eligibility schedule request properties. - Properties *RoleEligibilityScheduleRequestProperties `json:"properties,omitempty"` +// RoleAssignmentScheduleRequest - Role Assignment schedule request +type RoleAssignmentScheduleRequest struct { + // Role assignment schedule request properties. + Properties *RoleAssignmentScheduleRequestProperties `json:"properties,omitempty"` - // READ-ONLY; The role eligibility schedule request ID. + // READ-ONLY; The role assignment schedule request ID. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request name. + // READ-ONLY; The role assignment schedule request name. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request type. + // READ-ONLY; The role assignment schedule request type. Type *string `json:"type,omitempty" azure:"ro"` } -// RoleEligibilityScheduleRequestFilter - Role eligibility schedule request filter -type RoleEligibilityScheduleRequestFilter struct { - // Returns role eligibility requests of the specific principal. +// RoleAssignmentScheduleRequestFilter - Role assignment schedule request filter +type RoleAssignmentScheduleRequestFilter struct { + // Returns role assignment requests of the specific principal. PrincipalID *string `json:"principalId,omitempty"` - // Returns role eligibility requests created by specific principal. + // Returns role assignment requests created by specific principal. RequestorID *string `json:"requestorId,omitempty"` - // Returns role eligibility requests of the specific role definition. + // Returns role assignment requests of the specific role definition. RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // Returns role eligibility requests of specific status. + // Returns role assignment requests of specific status. Status *string `json:"status,omitempty"` } -// RoleEligibilityScheduleRequestListResult - Role eligibility schedule request list operation result. -type RoleEligibilityScheduleRequestListResult struct { +// RoleAssignmentScheduleRequestListResult - Role assignment schedule request list operation result. +type RoleAssignmentScheduleRequestListResult struct { // The URL to use for getting the next set of results. NextLink *string `json:"nextLink,omitempty"` - // Role eligibility schedule request list. - Value []*RoleEligibilityScheduleRequest `json:"value,omitempty"` + // Role assignment schedule request list. + Value []*RoleAssignmentScheduleRequest `json:"value,omitempty"` } -// RoleEligibilityScheduleRequestProperties - Role eligibility schedule request properties with scope. -type RoleEligibilityScheduleRequestProperties struct { +// RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties with scope. +type RoleAssignmentScheduleRequestProperties struct { // REQUIRED; The principal ID. PrincipalID *string `json:"principalId,omitempty"` @@ -1427,25 +120,28 @@ type RoleEligibilityScheduleRequestProperties struct { // Version of the condition. Currently accepted value is '2.0' ConditionVersion *string `json:"conditionVersion,omitempty"` - // Justification for the role eligibility + // Justification for the role assignment Justification *string `json:"justification,omitempty"` - // Schedule info of the role eligibility schedule - ScheduleInfo *RoleEligibilityScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` + // The linked role eligibility schedule id - to activate an eligibility. + LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + + // Schedule info of the role assignment schedule + ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` - // The resultant role eligibility schedule id or the role eligibility schedule id being updated - TargetRoleEligibilityScheduleID *string `json:"targetRoleEligibilityScheduleId,omitempty"` + // The resultant role assignment schedule id or the role assignment schedule id being updated + TargetRoleAssignmentScheduleID *string `json:"targetRoleAssignmentScheduleId,omitempty"` - // The role eligibility schedule instance id being updated - TargetRoleEligibilityScheduleInstanceID *string `json:"targetRoleEligibilityScheduleInstanceId,omitempty"` + // The role assignment schedule instance id being updated + TargetRoleAssignmentScheduleInstanceID *string `json:"targetRoleAssignmentScheduleInstanceId,omitempty"` - // Ticket Info of the role eligibility - TicketInfo *RoleEligibilityScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` + // Ticket Info of the role assignment + TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` - // READ-ONLY; The approvalId of the role eligibility schedule request. + // READ-ONLY; The approvalId of the role assignment schedule request. ApprovalID *string `json:"approvalId,omitempty" azure:"ro"` - // READ-ONLY; DateTime when role eligibility schedule request was created + // READ-ONLY; DateTime when role assignment schedule request was created CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` // READ-ONLY; Additional properties of principal, scope and role definition @@ -1457,452 +153,76 @@ type RoleEligibilityScheduleRequestProperties struct { // READ-ONLY; Id of the user who created this request RequestorID *string `json:"requestorId,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request scope. + // READ-ONLY; The role assignment schedule request scope. Scope *string `json:"scope,omitempty" azure:"ro"` - // READ-ONLY; The status of the role eligibility schedule request. + // READ-ONLY; The status of the role assignment schedule request. Status *Status `json:"status,omitempty" azure:"ro"` } -// RoleEligibilityScheduleRequestPropertiesScheduleInfo - Schedule info of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { - // Expiration of the role eligibility schedule - Expiration *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` +// RoleAssignmentScheduleRequestPropertiesScheduleInfo - Schedule info of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { + // Expiration of the role assignment schedule + Expiration *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` - // Start DateTime of the role eligibility schedule. + // Start DateTime of the role assignment schedule. StartDateTime *time.Time `json:"startDateTime,omitempty"` } -// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role eligibility schedule in TimeSpan. +// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { + // Duration of the role assignment schedule in TimeSpan. Duration *string `json:"duration,omitempty"` - // End DateTime of the role eligibility schedule. + // End DateTime of the role assignment schedule. EndDateTime *time.Time `json:"endDateTime,omitempty"` - // Type of the role eligibility schedule expiration + // Type of the role assignment schedule expiration Type *Type `json:"type,omitempty"` } -// RoleEligibilityScheduleRequestPropertiesTicketInfo - Ticket Info of the role eligibility -type RoleEligibilityScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role eligibility +// RoleAssignmentScheduleRequestPropertiesTicketInfo - Ticket Info of the role assignment +type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { + // Ticket number for the role assignment TicketNumber *string `json:"ticketNumber,omitempty"` - // Ticket system name for the role eligibility + // Ticket system name for the role assignment TicketSystem *string `json:"ticketSystem,omitempty"` } -// RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel +// RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel // method. -type RoleEligibilityScheduleRequestsClientCancelOptions struct { +type RoleAssignmentScheduleRequestsClientCancelOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create +// RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create // method. -type RoleEligibilityScheduleRequestsClientCreateOptions struct { +type RoleAssignmentScheduleRequestsClientCreateOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get +// RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get // method. -type RoleEligibilityScheduleRequestsClientGetOptions struct { +type RoleAssignmentScheduleRequestsClientGetOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.ListForScope +// RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.ListForScope // method. -type RoleEligibilityScheduleRequestsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedule requests at or above - // the scope. Use $filter=principalId eq {id} to return all role eligibility +type RoleAssignmentScheduleRequestsClientListForScopeOptions struct { + // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule requests at or above + // the scope. Use $filter=principalId eq {id} to return all role assignment // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role - // eligibility schedule requests requested by the current user. Use - // $filter=asTarget() to return all role eligibility schedule requests created for the current user. Use $filter=asApprover() - // to return all role eligibility schedule requests where the current user is an + // assignment schedule requests requested by the current user. Use + // $filter=asTarget() to return all role assignment schedule requests created for the current user. Use $filter=asApprover() + // to return all role assignment schedule requests where the current user is an // approver. Filter *string } -// RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate -// method. -type RoleEligibilityScheduleRequestsClientValidateOptions struct { - // placeholder for future optional parameters -} - -// RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get method. -type RoleEligibilitySchedulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.ListForScope -// method. -type RoleEligibilitySchedulesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role eligibility schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility - // schedules for the user. Use $filter=asTarget() to return all role eligibility - // schedules created for the current user. - Filter *string -} - -// RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete -// method. -type RoleManagementPoliciesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get method. -type RoleManagementPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.ListForScope -// method. -type RoleManagementPoliciesClientListForScopeOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update -// method. -type RoleManagementPoliciesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPolicy - Role management policy -type RoleManagementPolicy struct { - // Role management policy properties. - Properties *RoleManagementPolicyProperties `json:"properties,omitempty"` - - // READ-ONLY; The role management policy Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleManagementPolicyApprovalRule - The role management policy approval rule. -type RoleManagementPolicyApprovalRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The approval setting - Setting *ApprovalSettings `json:"setting,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyApprovalRule. -func (r *RoleManagementPolicyApprovalRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} - -// RoleManagementPolicyAssignment - Role management policy -type RoleManagementPolicyAssignment struct { - // Role management policy properties. - Properties *RoleManagementPolicyAssignmentProperties `json:"properties,omitempty"` - - // READ-ONLY; The role management policy Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleManagementPolicyAssignmentListResult - Role management policy assignment list operation result. -type RoleManagementPolicyAssignmentListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role management policy assignment list. - Value []*RoleManagementPolicyAssignment `json:"value,omitempty"` -} - -// RoleManagementPolicyAssignmentProperties - Role management policy assignment properties with scope. -type RoleManagementPolicyAssignmentProperties struct { - // The policy id role management policy assignment. - PolicyID *string `json:"policyId,omitempty"` - - // The role definition of management policy assignment. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The role management policy scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification `json:"effectiveRules,omitempty" azure:"ro"` - - // READ-ONLY; Additional properties of scope, role definition and policy - PolicyAssignmentProperties *PolicyAssignmentProperties `json:"policyAssignmentProperties,omitempty" azure:"ro"` -} - -// RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create -// method. -type RoleManagementPolicyAssignmentsClientCreateOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete -// method. -type RoleManagementPolicyAssignmentsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get -// method. -type RoleManagementPolicyAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.ListForScope +// RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate // method. -type RoleManagementPolicyAssignmentsClientListForScopeOptions struct { +type RoleAssignmentScheduleRequestsClientValidateOptions struct { // placeholder for future optional parameters } - -// RoleManagementPolicyAuthenticationContextRule - The role management policy authentication context rule. -type RoleManagementPolicyAuthenticationContextRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The claim value. - ClaimValue *string `json:"claimValue,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The value indicating if rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyAuthenticationContextRule. -func (r *RoleManagementPolicyAuthenticationContextRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} - -// RoleManagementPolicyEnablementRule - The role management policy enablement rule. -type RoleManagementPolicyEnablementRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The list of enabled rules. - EnabledRules []*EnablementRules `json:"enabledRules,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyEnablementRule. -func (r *RoleManagementPolicyEnablementRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} - -// RoleManagementPolicyExpirationRule - The role management policy expiration rule. -type RoleManagementPolicyExpirationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The value indicating whether expiration is required. - IsExpirationRequired *bool `json:"isExpirationRequired,omitempty"` - - // The maximum duration of expiration in timespan. - MaximumDuration *string `json:"maximumDuration,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyExpirationRule. -func (r *RoleManagementPolicyExpirationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} - -// RoleManagementPolicyListResult - Role management policy list operation result. -type RoleManagementPolicyListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role management policy list. - Value []*RoleManagementPolicy `json:"value,omitempty"` -} - -// RoleManagementPolicyNotificationRule - The role management policy notification rule. -type RoleManagementPolicyNotificationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // Determines if the notification will be sent to the recipient type specified in the policy rule. - IsDefaultRecipientsEnabled *bool `json:"isDefaultRecipientsEnabled,omitempty"` - - // The notification level. - NotificationLevel *NotificationLevel `json:"notificationLevel,omitempty"` - - // The list of notification recipients. - NotificationRecipients []*string `json:"notificationRecipients,omitempty"` - - // The type of notification. - NotificationType *NotificationDeliveryMechanism `json:"notificationType,omitempty"` - - // The recipient type. - RecipientType *RecipientType `json:"recipientType,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyNotificationRule. -func (r *RoleManagementPolicyNotificationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} - -// RoleManagementPolicyProperties - Role management policy properties with scope. -type RoleManagementPolicyProperties struct { - // The role management policy description. - Description *string `json:"description,omitempty"` - - // The role management policy display name. - DisplayName *string `json:"displayName,omitempty"` - - // The role management policy is default policy. - IsOrganizationDefault *bool `json:"isOrganizationDefault,omitempty"` - - // The rule applied to the policy. - Rules []RoleManagementPolicyRuleClassification `json:"rules,omitempty"` - - // The role management policy scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification `json:"effectiveRules,omitempty" azure:"ro"` - - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal `json:"lastModifiedBy,omitempty" azure:"ro"` - - // READ-ONLY; The last modified date time. - LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` - - // READ-ONLY; Additional properties of scope - PolicyProperties *PolicyProperties `json:"policyProperties,omitempty" azure:"ro"` -} - -// RoleManagementPolicyRuleClassification provides polymorphic access to related types. -// Call the interface's GetRoleManagementPolicyRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RoleManagementPolicyApprovalRule, *RoleManagementPolicyAuthenticationContextRule, *RoleManagementPolicyEnablementRule, -// - *RoleManagementPolicyExpirationRule, *RoleManagementPolicyNotificationRule, *RoleManagementPolicyRule -type RoleManagementPolicyRuleClassification interface { - // GetRoleManagementPolicyRule returns the RoleManagementPolicyRule content of the underlying type. - GetRoleManagementPolicyRule() *RoleManagementPolicyRule -} - -// RoleManagementPolicyRule - The role management policy rule. -type RoleManagementPolicyRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} - -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyRule. -func (r *RoleManagementPolicyRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { return r } - -// RoleManagementPolicyRuleTarget - The role management policy rule target. -type RoleManagementPolicyRuleTarget struct { - // The caller of the setting. - Caller *string `json:"caller,omitempty"` - - // The list of enforced settings. - EnforcedSettings []*string `json:"enforcedSettings,omitempty"` - - // The list of inheritable settings. - InheritableSettings []*string `json:"inheritableSettings,omitempty"` - - // The assignment level to which rule is applied. - Level *string `json:"level,omitempty"` - - // The type of operation. - Operations []*string `json:"operations,omitempty"` - - // The list of target objects. - TargetObjects []*string `json:"targetObjects,omitempty"` -} - -// UserSet - The detail of a user. -type UserSet struct { - // The description of the user. - Description *string `json:"description,omitempty"` - - // The object id of the user. - ID *string `json:"id,omitempty"` - - // The value indicating whether the user is a backup fallback approver - IsBackup *bool `json:"isBackup,omitempty"` - - // The type of user. - UserType *UserType `json:"userType,omitempty"` -} - -// ValidationResponse - Validation response -type ValidationResponse struct { - // Failed validation result details - ErrorInfo *ValidationResponseErrorInfo `json:"errorInfo,omitempty"` - - // READ-ONLY; Whether or not validation succeeded - IsValid *bool `json:"isValid,omitempty" azure:"ro"` -} - -// ValidationResponseErrorInfo - Failed validation result details -type ValidationResponseErrorInfo struct { - // READ-ONLY; Error code indicating why validation failed - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Message indicating why validation failed - Message *string `json:"message,omitempty" azure:"ro"` -} diff --git a/sdk/resourcemanager/authorization/armauthorization/models_serde.go b/sdk/resourcemanager/authorization/armauthorization/models_serde.go index 43a3bf4d23c5..4904a7bc253f 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models_serde.go +++ b/sdk/resourcemanager/authorization/armauthorization/models_serde.go @@ -16,3304 +16,162 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ApprovalSettings. -func (a ApprovalSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalMode", a.ApprovalMode) - populate(objectMap, "approvalStages", a.ApprovalStages) - populate(objectMap, "isApprovalRequired", a.IsApprovalRequired) - populate(objectMap, "isApprovalRequiredForExtension", a.IsApprovalRequiredForExtension) - populate(objectMap, "isRequestorJustificationRequired", a.IsRequestorJustificationRequired) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalSettings. -func (a *ApprovalSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "approvalMode": - err = unpopulate(val, "ApprovalMode", &a.ApprovalMode) - delete(rawMsg, key) - case "approvalStages": - err = unpopulate(val, "ApprovalStages", &a.ApprovalStages) - delete(rawMsg, key) - case "isApprovalRequired": - err = unpopulate(val, "IsApprovalRequired", &a.IsApprovalRequired) - delete(rawMsg, key) - case "isApprovalRequiredForExtension": - err = unpopulate(val, "IsApprovalRequiredForExtension", &a.IsApprovalRequiredForExtension) - delete(rawMsg, key) - case "isRequestorJustificationRequired": - err = unpopulate(val, "IsRequestorJustificationRequired", &a.IsRequestorJustificationRequired) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ApprovalStage. -func (a ApprovalStage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalStageTimeOutInDays", a.ApprovalStageTimeOutInDays) - populate(objectMap, "escalationApprovers", a.EscalationApprovers) - populate(objectMap, "escalationTimeInMinutes", a.EscalationTimeInMinutes) - populate(objectMap, "isApproverJustificationRequired", a.IsApproverJustificationRequired) - populate(objectMap, "isEscalationEnabled", a.IsEscalationEnabled) - populate(objectMap, "primaryApprovers", a.PrimaryApprovers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalStage. -func (a *ApprovalStage) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "approvalStageTimeOutInDays": - err = unpopulate(val, "ApprovalStageTimeOutInDays", &a.ApprovalStageTimeOutInDays) - delete(rawMsg, key) - case "escalationApprovers": - err = unpopulate(val, "EscalationApprovers", &a.EscalationApprovers) - delete(rawMsg, key) - case "escalationTimeInMinutes": - err = unpopulate(val, "EscalationTimeInMinutes", &a.EscalationTimeInMinutes) - delete(rawMsg, key) - case "isApproverJustificationRequired": - err = unpopulate(val, "IsApproverJustificationRequired", &a.IsApproverJustificationRequired) - delete(rawMsg, key) - case "isEscalationEnabled": - err = unpopulate(val, "IsEscalationEnabled", &a.IsEscalationEnabled) - delete(rawMsg, key) - case "primaryApprovers": - err = unpopulate(val, "PrimaryApprovers", &a.PrimaryApprovers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministrator. -func (c ClassicAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministrator. -func (c *ClassicAdministrator) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorListResult. -func (c ClassicAdministratorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorListResult. -func (c *ClassicAdministratorListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorProperties. -func (c ClassicAdministratorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "emailAddress", c.EmailAddress) - populate(objectMap, "role", c.Role) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorProperties. -func (c *ClassicAdministratorProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &c.EmailAddress) - delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &c.Role) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. -func (c *CloudError) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &c.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "message", c.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. -func (c *CloudErrorBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &c.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenyAssignment. -func (d DenyAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignment. -func (d *DenyAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentFilter. -func (d DenyAssignmentFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) - populate(objectMap, "gdprExportPrincipalId", d.GdprExportPrincipalID) - populate(objectMap, "principalId", d.PrincipalID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentFilter. -func (d *DenyAssignmentFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "denyAssignmentName": - err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) - delete(rawMsg, key) - case "gdprExportPrincipalId": - err = unpopulate(val, "GdprExportPrincipalID", &d.GdprExportPrincipalID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentListResult. -func (d DenyAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentListResult. -func (d *DenyAssignmentListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentPermission. -func (d DenyAssignmentPermission) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", d.Actions) - populate(objectMap, "condition", d.Condition) - populate(objectMap, "conditionVersion", d.ConditionVersion) - populate(objectMap, "dataActions", d.DataActions) - populate(objectMap, "notActions", d.NotActions) - populate(objectMap, "notDataActions", d.NotDataActions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentPermission. -func (d *DenyAssignmentPermission) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &d.Actions) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &d.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &d.ConditionVersion) - delete(rawMsg, key) - case "dataActions": - err = unpopulate(val, "DataActions", &d.DataActions) - delete(rawMsg, key) - case "notActions": - err = unpopulate(val, "NotActions", &d.NotActions) - delete(rawMsg, key) - case "notDataActions": - err = unpopulate(val, "NotDataActions", &d.NotDataActions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentProperties. -func (d DenyAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) - populate(objectMap, "description", d.Description) - populate(objectMap, "doNotApplyToChildScopes", d.DoNotApplyToChildScopes) - populate(objectMap, "excludePrincipals", d.ExcludePrincipals) - populate(objectMap, "isSystemProtected", d.IsSystemProtected) - populate(objectMap, "permissions", d.Permissions) - populate(objectMap, "principals", d.Principals) - populate(objectMap, "scope", d.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentProperties. -func (d *DenyAssignmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "denyAssignmentName": - err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "doNotApplyToChildScopes": - err = unpopulate(val, "DoNotApplyToChildScopes", &d.DoNotApplyToChildScopes) - delete(rawMsg, key) - case "excludePrincipals": - err = unpopulate(val, "ExcludePrincipals", &d.ExcludePrincipals) - delete(rawMsg, key) - case "isSystemProtected": - err = unpopulate(val, "IsSystemProtected", &d.IsSystemProtected) - delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &d.Permissions) - delete(rawMsg, key) - case "principals": - err = unpopulate(val, "Principals", &d.Principals) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &d.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EligibleChildResource. -func (e EligibleChildResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResource. -func (e *EligibleChildResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EligibleChildResourcesListResult. -func (e EligibleChildResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResourcesListResult. -func (e *EligibleChildResourcesListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "info", &e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExpandedProperties. -func (e ExpandedProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principal", e.Principal) - populate(objectMap, "roleDefinition", e.RoleDefinition) - populate(objectMap, "scope", e.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedProperties. -func (e *ExpandedProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principal": - err = unpopulate(val, "Principal", &e.Principal) - delete(rawMsg, key) - case "roleDefinition": - err = unpopulate(val, "RoleDefinition", &e.RoleDefinition) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &e.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesPrincipal. -func (e ExpandedPropertiesPrincipal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "email", e.Email) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesPrincipal. -func (e *ExpandedPropertiesPrincipal) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "email": - err = unpopulate(val, "Email", &e.Email) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesRoleDefinition. -func (e ExpandedPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesRoleDefinition. -func (e *ExpandedPropertiesRoleDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesScope. -func (e ExpandedPropertiesScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesScope. -func (e *ExpandedPropertiesScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Permission. -func (p Permission) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", p.Actions) - populate(objectMap, "dataActions", p.DataActions) - populate(objectMap, "notActions", p.NotActions) - populate(objectMap, "notDataActions", p.NotDataActions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. -func (p *Permission) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &p.Actions) - delete(rawMsg, key) - case "dataActions": - err = unpopulate(val, "DataActions", &p.DataActions) - delete(rawMsg, key) - case "notActions": - err = unpopulate(val, "NotActions", &p.NotActions) - delete(rawMsg, key) - case "notDataActions": - err = unpopulate(val, "NotDataActions", &p.NotDataActions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PermissionGetResult. -func (p PermissionGetResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionGetResult. -func (p *PermissionGetResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentProperties. -func (p PolicyAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "policy", p.Policy) - populate(objectMap, "roleDefinition", p.RoleDefinition) - populate(objectMap, "scope", p.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentProperties. -func (p *PolicyAssignmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "policy": - err = unpopulate(val, "Policy", &p.Policy) - delete(rawMsg, key) - case "roleDefinition": - err = unpopulate(val, "RoleDefinition", &p.RoleDefinition) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &p.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesPolicy. -func (p PolicyAssignmentPropertiesPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", p.LastModifiedDateTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesPolicy. -func (p *PolicyAssignmentPropertiesPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &p.LastModifiedDateTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesRoleDefinition. -func (p PolicyAssignmentPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesRoleDefinition. -func (p *PolicyAssignmentPropertiesRoleDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesScope. -func (p PolicyAssignmentPropertiesScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesScope. -func (p *PolicyAssignmentPropertiesScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyProperties. -func (p PolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "scope", p.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyProperties. -func (p *PolicyProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "scope": - err = unpopulate(val, "Scope", &p.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyPropertiesScope. -func (p PolicyPropertiesScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyPropertiesScope. -func (p *PolicyPropertiesScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Principal. -func (p Principal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "email", p.Email) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Principal. -func (p *Principal) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "email": - err = unpopulate(val, "Email", &p.Email) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProviderOperation. -func (p ProviderOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "isDataAction", p.IsDataAction) - populate(objectMap, "name", p.Name) - populate(objectMap, "origin", p.Origin) - populate(objectMap, "properties", &p.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperation. -func (p *ProviderOperation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &p.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &p.Origin) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadata. -func (p ProviderOperationsMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "operations", p.Operations) - populate(objectMap, "resourceTypes", p.ResourceTypes) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadata. -func (p *ProviderOperationsMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &p.Operations) - delete(rawMsg, key) - case "resourceTypes": - err = unpopulate(val, "ResourceTypes", &p.ResourceTypes) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadataListResult. -func (p ProviderOperationsMetadataListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadataListResult. -func (p *ProviderOperationsMetadataListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceType. -func (r ResourceType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "name", r.Name) - populate(objectMap, "operations", r.Operations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceType. -func (r *ResourceType) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &r.DisplayName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &r.Operations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignment. -func (r RoleAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignment. -func (r *RoleAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentCreateParameters. -func (r RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", r.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentCreateParameters. -func (r *RoleAssignmentCreateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentFilter. -func (r RoleAssignmentFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentFilter. -func (r *RoleAssignmentFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentListResult. -func (r RoleAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentListResult. -func (r *RoleAssignmentListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentProperties. -func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdBy", r.CreatedBy) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "delegatedManagedIdentityResourceId", r.DelegatedManagedIdentityResourceID) - populate(objectMap, "description", r.Description) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "updatedBy", r.UpdatedBy) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentProperties. -func (r *RoleAssignmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "delegatedManagedIdentityResourceId": - err = unpopulate(val, "DelegatedManagedIdentityResourceID", &r.DelegatedManagedIdentityResourceID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &r.UpdatedBy) - delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentSchedule. -func (r RoleAssignmentSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentSchedule. -func (r *RoleAssignmentSchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleFilter. -func (r RoleAssignmentScheduleFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleFilter. -func (r *RoleAssignmentScheduleFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstance. -func (r RoleAssignmentScheduleInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstance. -func (r *RoleAssignmentScheduleInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceFilter. -func (r RoleAssignmentScheduleInstanceFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceFilter. -func (r *RoleAssignmentScheduleInstanceFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleAssignmentScheduleId": - err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceListResult. -func (r RoleAssignmentScheduleInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceListResult. -func (r *RoleAssignmentScheduleInstanceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceProperties. -func (r RoleAssignmentScheduleInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignmentType", r.AssignmentType) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "linkedRoleEligibilityScheduleInstanceId", r.LinkedRoleEligibilityScheduleInstanceID) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "originRoleAssignmentId", r.OriginRoleAssignmentID) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceProperties. -func (r *RoleAssignmentScheduleInstanceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignmentType": - err = unpopulate(val, "AssignmentType", &r.AssignmentType) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleInstanceId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleInstanceID", &r.LinkedRoleEligibilityScheduleInstanceID) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "originRoleAssignmentId": - err = unpopulate(val, "OriginRoleAssignmentID", &r.OriginRoleAssignmentID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleAssignmentScheduleId": - err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleListResult. -func (r RoleAssignmentScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleListResult. -func (r *RoleAssignmentScheduleListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleProperties. -func (r RoleAssignmentScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignmentType", r.AssignmentType) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleAssignmentScheduleRequestId", r.RoleAssignmentScheduleRequestID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleProperties. -func (r *RoleAssignmentScheduleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignmentType": - err = unpopulate(val, "AssignmentType", &r.AssignmentType) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleAssignmentScheduleRequestId": - err = unpopulate(val, "RoleAssignmentScheduleRequestID", &r.RoleAssignmentScheduleRequestID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequest. -func (r RoleAssignmentScheduleRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequest. -func (r *RoleAssignmentScheduleRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestFilter. -func (r RoleAssignmentScheduleRequestFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestFilter. -func (r *RoleAssignmentScheduleRequestFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestListResult. -func (r RoleAssignmentScheduleRequestListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestListResult. -func (r *RoleAssignmentScheduleRequestListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestProperties. -func (r RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalId", r.ApprovalID) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "justification", r.Justification) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "requestType", r.RequestType) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scheduleInfo", r.ScheduleInfo) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "status", r.Status) - populate(objectMap, "targetRoleAssignmentScheduleId", r.TargetRoleAssignmentScheduleID) - populate(objectMap, "targetRoleAssignmentScheduleInstanceId", r.TargetRoleAssignmentScheduleInstanceID) - populate(objectMap, "ticketInfo", r.TicketInfo) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestProperties. -func (r *RoleAssignmentScheduleRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "approvalId": - err = unpopulate(val, "ApprovalID", &r.ApprovalID) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "justification": - err = unpopulate(val, "Justification", &r.Justification) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "requestType": - err = unpopulate(val, "RequestType", &r.RequestType) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scheduleInfo": - err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "targetRoleAssignmentScheduleId": - err = unpopulate(val, "TargetRoleAssignmentScheduleID", &r.TargetRoleAssignmentScheduleID) - delete(rawMsg, key) - case "targetRoleAssignmentScheduleInstanceId": - err = unpopulate(val, "TargetRoleAssignmentScheduleInstanceID", &r.TargetRoleAssignmentScheduleInstanceID) - delete(rawMsg, key) - case "ticketInfo": - err = unpopulate(val, "TicketInfo", &r.TicketInfo) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. -func (r RoleAssignmentScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "expiration", r.Expiration) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. -func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiration": - err = unpopulate(val, "Expiration", &r.Expiration) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. -func (r RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", r.Duration) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. -func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &r.Duration) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. -func (r RoleAssignmentScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ticketNumber", r.TicketNumber) - populate(objectMap, "ticketSystem", r.TicketSystem) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. -func (r *RoleAssignmentScheduleRequestPropertiesTicketInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ticketNumber": - err = unpopulate(val, "TicketNumber", &r.TicketNumber) - delete(rawMsg, key) - case "ticketSystem": - err = unpopulate(val, "TicketSystem", &r.TicketSystem) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinition. -func (r RoleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinition. -func (r *RoleDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionFilter. -func (r RoleDefinitionFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "roleName", r.RoleName) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionFilter. -func (r *RoleDefinitionFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "roleName": - err = unpopulate(val, "RoleName", &r.RoleName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionListResult. -func (r RoleDefinitionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionListResult. -func (r *RoleDefinitionListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionProperties. -func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assignableScopes", r.AssignableScopes) - populate(objectMap, "description", r.Description) - populate(objectMap, "permissions", r.Permissions) - populate(objectMap, "roleName", r.RoleName) - populate(objectMap, "type", r.RoleType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionProperties. -func (r *RoleDefinitionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignableScopes": - err = unpopulate(val, "AssignableScopes", &r.AssignableScopes) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &r.Permissions) - delete(rawMsg, key) - case "roleName": - err = unpopulate(val, "RoleName", &r.RoleName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "RoleType", &r.RoleType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilitySchedule. -func (r RoleEligibilitySchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilitySchedule. -func (r *RoleEligibilitySchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleFilter. -func (r RoleEligibilityScheduleFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleFilter. -func (r *RoleEligibilityScheduleFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstance. -func (r RoleEligibilityScheduleInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstance. -func (r *RoleEligibilityScheduleInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceFilter. -func (r RoleEligibilityScheduleInstanceFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceFilter. -func (r *RoleEligibilityScheduleInstanceFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleId": - err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceListResult. -func (r RoleEligibilityScheduleInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceListResult. -func (r *RoleEligibilityScheduleInstanceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceProperties. -func (r RoleEligibilityScheduleInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceProperties. -func (r *RoleEligibilityScheduleInstanceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleId": - err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleListResult. -func (r RoleEligibilityScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleListResult. -func (r *RoleEligibilityScheduleListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleProperties. -func (r RoleEligibilityScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleRequestId", r.RoleEligibilityScheduleRequestID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleProperties. -func (r *RoleEligibilityScheduleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleRequestId": - err = unpopulate(val, "RoleEligibilityScheduleRequestID", &r.RoleEligibilityScheduleRequestID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequest. -func (r RoleEligibilityScheduleRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequest. -func (r *RoleEligibilityScheduleRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestFilter. -func (r RoleEligibilityScheduleRequestFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestFilter. -func (r *RoleEligibilityScheduleRequestFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestListResult. -func (r RoleEligibilityScheduleRequestListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestListResult. -func (r *RoleEligibilityScheduleRequestListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestProperties. -func (r RoleEligibilityScheduleRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "approvalId", r.ApprovalID) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "justification", r.Justification) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "requestType", r.RequestType) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scheduleInfo", r.ScheduleInfo) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "status", r.Status) - populate(objectMap, "targetRoleEligibilityScheduleId", r.TargetRoleEligibilityScheduleID) - populate(objectMap, "targetRoleEligibilityScheduleInstanceId", r.TargetRoleEligibilityScheduleInstanceID) - populate(objectMap, "ticketInfo", r.TicketInfo) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestProperties. -func (r *RoleEligibilityScheduleRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "approvalId": - err = unpopulate(val, "ApprovalID", &r.ApprovalID) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "justification": - err = unpopulate(val, "Justification", &r.Justification) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "requestType": - err = unpopulate(val, "RequestType", &r.RequestType) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scheduleInfo": - err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "targetRoleEligibilityScheduleId": - err = unpopulate(val, "TargetRoleEligibilityScheduleID", &r.TargetRoleEligibilityScheduleID) - delete(rawMsg, key) - case "targetRoleEligibilityScheduleInstanceId": - err = unpopulate(val, "TargetRoleEligibilityScheduleInstanceID", &r.TargetRoleEligibilityScheduleInstanceID) - delete(rawMsg, key) - case "ticketInfo": - err = unpopulate(val, "TicketInfo", &r.TicketInfo) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. -func (r RoleEligibilityScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "expiration", r.Expiration) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. -func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiration": - err = unpopulate(val, "Expiration", &r.Expiration) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. -func (r RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", r.Duration) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. -func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &r.Duration) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. -func (r RoleEligibilityScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ticketNumber", r.TicketNumber) - populate(objectMap, "ticketSystem", r.TicketSystem) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. -func (r *RoleEligibilityScheduleRequestPropertiesTicketInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ticketNumber": - err = unpopulate(val, "TicketNumber", &r.TicketNumber) - delete(rawMsg, key) - case "ticketSystem": - err = unpopulate(val, "TicketSystem", &r.TicketSystem) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicy. -func (r RoleManagementPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicy. -func (r *RoleManagementPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyApprovalRule. -func (r RoleManagementPolicyApprovalRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule - populate(objectMap, "setting", r.Setting) - populate(objectMap, "target", r.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyApprovalRule. -func (r *RoleManagementPolicyApprovalRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) - delete(rawMsg, key) - case "setting": - err = unpopulate(val, "Setting", &r.Setting) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignment. -func (r RoleManagementPolicyAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignment. -func (r *RoleManagementPolicyAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentListResult. -func (r RoleManagementPolicyAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentListResult. -func (r *RoleManagementPolicyAssignmentListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentProperties. -func (r RoleManagementPolicyAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "effectiveRules", r.EffectiveRules) - populate(objectMap, "policyAssignmentProperties", r.PolicyAssignmentProperties) - populate(objectMap, "policyId", r.PolicyID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentProperties. -func (r *RoleManagementPolicyAssignmentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "effectiveRules": - r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) - delete(rawMsg, key) - case "policyAssignmentProperties": - err = unpopulate(val, "PolicyAssignmentProperties", &r.PolicyAssignmentProperties) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &r.PolicyID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAuthenticationContextRule. -func (r RoleManagementPolicyAuthenticationContextRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExpandedProperties. +func (e ExpandedProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "claimValue", r.ClaimValue) - populate(objectMap, "id", r.ID) - populate(objectMap, "isEnabled", r.IsEnabled) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule - populate(objectMap, "target", r.Target) + populate(objectMap, "principal", e.Principal) + populate(objectMap, "roleDefinition", e.RoleDefinition) + populate(objectMap, "scope", e.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAuthenticationContextRule. -func (r *RoleManagementPolicyAuthenticationContextRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedProperties. +func (e *ExpandedProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "claimValue": - err = unpopulate(val, "ClaimValue", &r.ClaimValue) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &r.IsEnabled) + case "principal": + err = unpopulate(val, "Principal", &e.Principal) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "roleDefinition": + err = unpopulate(val, "RoleDefinition", &e.RoleDefinition) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "scope": + err = unpopulate(val, "Scope", &e.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyEnablementRule. -func (r RoleManagementPolicyEnablementRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesPrincipal. +func (e ExpandedPropertiesPrincipal) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "enabledRules", r.EnabledRules) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule - populate(objectMap, "target", r.Target) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "email", e.Email) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyEnablementRule. -func (r *RoleManagementPolicyEnablementRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesPrincipal. +func (e *ExpandedPropertiesPrincipal) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "enabledRules": - err = unpopulate(val, "EnabledRules", &r.EnabledRules) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "email": + err = unpopulate(val, "Email", &e.Email) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyExpirationRule. -func (r RoleManagementPolicyExpirationRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesRoleDefinition. +func (e ExpandedPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "isExpirationRequired", r.IsExpirationRequired) - populate(objectMap, "maximumDuration", r.MaximumDuration) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule - populate(objectMap, "target", r.Target) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyExpirationRule. -func (r *RoleManagementPolicyExpirationRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesRoleDefinition. +func (e *ExpandedPropertiesRoleDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "isExpirationRequired": - err = unpopulate(val, "IsExpirationRequired", &r.IsExpirationRequired) - delete(rawMsg, key) - case "maximumDuration": - err = unpopulate(val, "MaximumDuration", &r.MaximumDuration) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyListResult. -func (r RoleManagementPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesScope. +func (e ExpandedPropertiesScope) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "id", e.ID) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyListResult. -func (r *RoleManagementPolicyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesScope. +func (e *ExpandedPropertiesScope) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyNotificationRule. -func (r RoleManagementPolicyNotificationRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequest. +func (r RoleAssignmentScheduleRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", r.ID) - populate(objectMap, "isDefaultRecipientsEnabled", r.IsDefaultRecipientsEnabled) - populate(objectMap, "notificationLevel", r.NotificationLevel) - populate(objectMap, "notificationRecipients", r.NotificationRecipients) - populate(objectMap, "notificationType", r.NotificationType) - populate(objectMap, "recipientType", r.RecipientType) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule - populate(objectMap, "target", r.Target) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyNotificationRule. -func (r *RoleManagementPolicyNotificationRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequest. +func (r *RoleAssignmentScheduleRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3324,26 +182,14 @@ func (r *RoleManagementPolicyNotificationRule) UnmarshalJSON(data []byte) error case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "isDefaultRecipientsEnabled": - err = unpopulate(val, "IsDefaultRecipientsEnabled", &r.IsDefaultRecipientsEnabled) - delete(rawMsg, key) - case "notificationLevel": - err = unpopulate(val, "NotificationLevel", &r.NotificationLevel) - delete(rawMsg, key) - case "notificationRecipients": - err = unpopulate(val, "NotificationRecipients", &r.NotificationRecipients) - delete(rawMsg, key) - case "notificationType": - err = unpopulate(val, "NotificationType", &r.NotificationType) - delete(rawMsg, key) - case "recipientType": - err = unpopulate(val, "RecipientType", &r.RecipientType) + case "name": + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -3353,23 +199,18 @@ func (r *RoleManagementPolicyNotificationRule) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyProperties. -func (r RoleManagementPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestFilter. +func (r RoleAssignmentScheduleRequestFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "description", r.Description) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "effectiveRules", r.EffectiveRules) - populate(objectMap, "isOrganizationDefault", r.IsOrganizationDefault) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", r.LastModifiedDateTime) - populate(objectMap, "policyProperties", r.PolicyProperties) - populate(objectMap, "rules", r.Rules) - populate(objectMap, "scope", r.Scope) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyProperties. -func (r *RoleManagementPolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestFilter. +func (r *RoleAssignmentScheduleRequestFilter) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3377,32 +218,17 @@ func (r *RoleManagementPolicyProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &r.DisplayName) - delete(rawMsg, key) - case "effectiveRules": - r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) - delete(rawMsg, key) - case "isOrganizationDefault": - err = unpopulate(val, "IsOrganizationDefault", &r.IsOrganizationDefault) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &r.LastModifiedDateTime) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) delete(rawMsg, key) - case "policyProperties": - err = unpopulate(val, "PolicyProperties", &r.PolicyProperties) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) delete(rawMsg, key) - case "rules": - r.Rules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) + case "status": + err = unpopulate(val, "Status", &r.Status) delete(rawMsg, key) } if err != nil { @@ -3412,17 +238,16 @@ func (r *RoleManagementPolicyProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRule. -func (r RoleManagementPolicyRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestListResult. +func (r RoleAssignmentScheduleRequestListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = r.RuleType - populate(objectMap, "target", r.Target) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRule. -func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestListResult. +func (r *RoleAssignmentScheduleRequestListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3430,14 +255,11 @@ func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3447,20 +269,32 @@ func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRuleTarget. -func (r RoleManagementPolicyRuleTarget) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestProperties. +func (r RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "caller", r.Caller) - populate(objectMap, "enforcedSettings", r.EnforcedSettings) - populate(objectMap, "inheritableSettings", r.InheritableSettings) - populate(objectMap, "level", r.Level) - populate(objectMap, "operations", r.Operations) - populate(objectMap, "targetObjects", r.TargetObjects) + populate(objectMap, "approvalId", r.ApprovalID) + populate(objectMap, "condition", r.Condition) + populate(objectMap, "conditionVersion", r.ConditionVersion) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populate(objectMap, "expandedProperties", r.ExpandedProperties) + populate(objectMap, "justification", r.Justification) + populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "principalType", r.PrincipalType) + populate(objectMap, "requestType", r.RequestType) + populate(objectMap, "requestorId", r.RequestorID) + populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) + populate(objectMap, "scheduleInfo", r.ScheduleInfo) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "status", r.Status) + populate(objectMap, "targetRoleAssignmentScheduleId", r.TargetRoleAssignmentScheduleID) + populate(objectMap, "targetRoleAssignmentScheduleInstanceId", r.TargetRoleAssignmentScheduleInstanceID) + populate(objectMap, "ticketInfo", r.TicketInfo) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRuleTarget. -func (r *RoleManagementPolicyRuleTarget) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestProperties. +func (r *RoleAssignmentScheduleRequestProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3468,23 +302,59 @@ func (r *RoleManagementPolicyRuleTarget) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "caller": - err = unpopulate(val, "Caller", &r.Caller) + case "approvalId": + err = unpopulate(val, "ApprovalID", &r.ApprovalID) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &r.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) + case "expandedProperties": + err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) + delete(rawMsg, key) + case "linkedRoleEligibilityScheduleId": + err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &r.PrincipalType) + delete(rawMsg, key) + case "requestType": + err = unpopulate(val, "RequestType", &r.RequestType) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &r.RequestorID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) delete(rawMsg, key) - case "enforcedSettings": - err = unpopulate(val, "EnforcedSettings", &r.EnforcedSettings) + case "scheduleInfo": + err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) delete(rawMsg, key) - case "inheritableSettings": - err = unpopulate(val, "InheritableSettings", &r.InheritableSettings) + case "status": + err = unpopulate(val, "Status", &r.Status) delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &r.Level) + case "targetRoleAssignmentScheduleId": + err = unpopulate(val, "TargetRoleAssignmentScheduleID", &r.TargetRoleAssignmentScheduleID) delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &r.Operations) + case "targetRoleAssignmentScheduleInstanceId": + err = unpopulate(val, "TargetRoleAssignmentScheduleInstanceID", &r.TargetRoleAssignmentScheduleInstanceID) delete(rawMsg, key) - case "targetObjects": - err = unpopulate(val, "TargetObjects", &r.TargetObjects) + case "ticketInfo": + err = unpopulate(val, "TicketInfo", &r.TicketInfo) delete(rawMsg, key) } if err != nil { @@ -3494,102 +364,98 @@ func (r *RoleManagementPolicyRuleTarget) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UserSet. -func (u UserSet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. +func (r RoleAssignmentScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "description", u.Description) - populate(objectMap, "id", u.ID) - populate(objectMap, "isBackup", u.IsBackup) - populate(objectMap, "userType", u.UserType) + populate(objectMap, "expiration", r.Expiration) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserSet. -func (u *UserSet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. +func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &u.Description) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "isBackup": - err = unpopulate(val, "IsBackup", &u.IsBackup) + case "expiration": + err = unpopulate(val, "Expiration", &r.Expiration) delete(rawMsg, key) - case "userType": - err = unpopulate(val, "UserType", &u.UserType) + case "startDateTime": + err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidationResponse. -func (v ValidationResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. +func (r RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "errorInfo", v.ErrorInfo) - populate(objectMap, "isValid", v.IsValid) + populate(objectMap, "duration", r.Duration) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponse. -func (v *ValidationResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. +func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "errorInfo": - err = unpopulate(val, "ErrorInfo", &v.ErrorInfo) + case "duration": + err = unpopulate(val, "Duration", &r.Duration) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) delete(rawMsg, key) - case "isValid": - err = unpopulate(val, "IsValid", &v.IsValid) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidationResponseErrorInfo. -func (v ValidationResponseErrorInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. +func (r RoleAssignmentScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "code", v.Code) - populate(objectMap, "message", v.Message) + populate(objectMap, "ticketNumber", r.TicketNumber) + populate(objectMap, "ticketSystem", r.TicketSystem) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponseErrorInfo. -func (v *ValidationResponseErrorInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. +func (r *RoleAssignmentScheduleRequestPropertiesTicketInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &v.Code) + case "ticketNumber": + err = unpopulate(val, "TicketNumber", &r.TicketNumber) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &v.Message) + case "ticketSystem": + err = unpopulate(val, "TicketSystem", &r.TicketSystem) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil diff --git a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client.go deleted file mode 100644 index 2bde172b043d..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go +++ /dev/null @@ -1,197 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PermissionsClient contains the methods for the Permissions group. -// Don't use this type directly, use NewPermissionsClient() instead. -type PermissionsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewPermissionsClient creates a new instance of PermissionsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewPermissionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PermissionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &PermissionsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// NewListForResourcePager - Gets all permissions the caller has for a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// resourceProviderNamespace - The namespace of the resource provider. -// parentResourcePath - The parent resource identity. -// resourceType - The resource type of the resource. -// resourceName - The name of the resource to get the permissions for. -// options - PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.ListForResource -// method. -func (client *PermissionsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) *runtime.Pager[PermissionsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceResponse]{ - More: func(page PermissionsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceResponse) (PermissionsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PermissionsClientListForResourceResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PermissionsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *PermissionsClient) listForResourceHandleResponse(resp *http.Response) (PermissionsClientListForResourceResponse, error) { - result := PermissionsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - Gets all permissions the caller has for a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.ListForResourceGroup -// method. -func (client *PermissionsClient) NewListForResourceGroupPager(resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) *runtime.Pager[PermissionsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceGroupResponse]{ - More: func(page PermissionsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceGroupResponse) (PermissionsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *PermissionsClient) listForResourceGroupHandleResponse(resp *http.Response) (PermissionsClientListForResourceGroupResponse, error) { - result := PermissionsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go deleted file mode 100644 index 2a44d8b05e08..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetPermissions.json -func ExamplePermissionsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewPermissionsClient("subID", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("rgname", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetResourcePermissions.json -func ExamplePermissionsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewPermissionsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("rgname", "rpnamespace", "parentResourcePath", "resourceType", "resourceName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go deleted file mode 100644 index f0d982480959..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import "encoding/json" - -func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (RoleManagementPolicyRuleClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]interface{} - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RoleManagementPolicyRuleClassification - switch m["ruleType"] { - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule): - b = &RoleManagementPolicyApprovalRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule): - b = &RoleManagementPolicyAuthenticationContextRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule): - b = &RoleManagementPolicyEnablementRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule): - b = &RoleManagementPolicyExpirationRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule): - b = &RoleManagementPolicyNotificationRule{} - default: - b = &RoleManagementPolicyRule{} - } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalRoleManagementPolicyRuleClassificationArray(rawMsg json.RawMessage) ([]RoleManagementPolicyRuleClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]RoleManagementPolicyRuleClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalRoleManagementPolicyRuleClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go deleted file mode 100644 index 5d8c1d1ad635..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go +++ /dev/null @@ -1,158 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// ProviderOperationsMetadataClient contains the methods for the ProviderOperationsMetadata group. -// Don't use this type directly, use NewProviderOperationsMetadataClient() instead. -type ProviderOperationsMetadataClient struct { - host string - pl runtime.Pipeline -} - -// NewProviderOperationsMetadataClient creates a new instance of ProviderOperationsMetadataClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewProviderOperationsMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderOperationsMetadataClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ProviderOperationsMetadataClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Gets provider operations metadata for the specified resource provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceProviderNamespace - The namespace of the resource provider. -// options - ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get -// method. -func (client *ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (ProviderOperationsMetadataClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceProviderNamespace, options) - if err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProviderOperationsMetadataClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ProviderOperationsMetadataClient) getCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}" - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProviderOperationsMetadataClient) getHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientGetResponse, error) { - result := ProviderOperationsMetadataClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadata); err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets provider operations metadata for all resource providers. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.List -// method. -func (client *ProviderOperationsMetadataClient) NewListPager(options *ProviderOperationsMetadataClientListOptions) *runtime.Pager[ProviderOperationsMetadataClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProviderOperationsMetadataClientListResponse]{ - More: func(page ProviderOperationsMetadataClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProviderOperationsMetadataClientListResponse) (ProviderOperationsMetadataClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProviderOperationsMetadataClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ProviderOperationsMetadataClient) listCreateRequest(ctx context.Context, options *ProviderOperationsMetadataClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/providerOperations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ProviderOperationsMetadataClient) listHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientListResponse, error) { - result := ProviderOperationsMetadataClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadataListResult); err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go deleted file mode 100644 index 58d63502f8e3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json -func ExampleProviderOperationsMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewProviderOperationsMetadataClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "resourceProviderNamespace", &armauthorization.ProviderOperationsMetadataClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllProviderOperations.json -func ExampleProviderOperationsMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewProviderOperationsMetadataClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armauthorization.ProviderOperationsMetadataClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/response_types.go b/sdk/resourcemanager/authorization/armauthorization/response_types.go index 86054a1afb9b..7515365a2340 100644 --- a/sdk/resourcemanager/authorization/armauthorization/response_types.go +++ b/sdk/resourcemanager/authorization/armauthorization/response_types.go @@ -9,81 +9,6 @@ package armauthorization -// ClassicAdministratorsClientListResponse contains the response from method ClassicAdministratorsClient.List. -type ClassicAdministratorsClientListResponse struct { - ClassicAdministratorListResult -} - -// DenyAssignmentsClientGetByIDResponse contains the response from method DenyAssignmentsClient.GetByID. -type DenyAssignmentsClientGetByIDResponse struct { - DenyAssignment -} - -// DenyAssignmentsClientGetResponse contains the response from method DenyAssignmentsClient.Get. -type DenyAssignmentsClientGetResponse struct { - DenyAssignment -} - -// DenyAssignmentsClientListForResourceGroupResponse contains the response from method DenyAssignmentsClient.ListForResourceGroup. -type DenyAssignmentsClientListForResourceGroupResponse struct { - DenyAssignmentListResult -} - -// DenyAssignmentsClientListForResourceResponse contains the response from method DenyAssignmentsClient.ListForResource. -type DenyAssignmentsClientListForResourceResponse struct { - DenyAssignmentListResult -} - -// DenyAssignmentsClientListForScopeResponse contains the response from method DenyAssignmentsClient.ListForScope. -type DenyAssignmentsClientListForScopeResponse struct { - DenyAssignmentListResult -} - -// DenyAssignmentsClientListResponse contains the response from method DenyAssignmentsClient.List. -type DenyAssignmentsClientListResponse struct { - DenyAssignmentListResult -} - -// EligibleChildResourcesClientGetResponse contains the response from method EligibleChildResourcesClient.Get. -type EligibleChildResourcesClientGetResponse struct { - EligibleChildResourcesListResult -} - -// GlobalAdministratorClientElevateAccessResponse contains the response from method GlobalAdministratorClient.ElevateAccess. -type GlobalAdministratorClientElevateAccessResponse struct { - // placeholder for future response values -} - -// PermissionsClientListForResourceGroupResponse contains the response from method PermissionsClient.ListForResourceGroup. -type PermissionsClientListForResourceGroupResponse struct { - PermissionGetResult -} - -// PermissionsClientListForResourceResponse contains the response from method PermissionsClient.ListForResource. -type PermissionsClientListForResourceResponse struct { - PermissionGetResult -} - -// ProviderOperationsMetadataClientGetResponse contains the response from method ProviderOperationsMetadataClient.Get. -type ProviderOperationsMetadataClientGetResponse struct { - ProviderOperationsMetadata -} - -// ProviderOperationsMetadataClientListResponse contains the response from method ProviderOperationsMetadataClient.List. -type ProviderOperationsMetadataClientListResponse struct { - ProviderOperationsMetadataListResult -} - -// RoleAssignmentScheduleInstancesClientGetResponse contains the response from method RoleAssignmentScheduleInstancesClient.Get. -type RoleAssignmentScheduleInstancesClientGetResponse struct { - RoleAssignmentScheduleInstance -} - -// RoleAssignmentScheduleInstancesClientListForScopeResponse contains the response from method RoleAssignmentScheduleInstancesClient.ListForScope. -type RoleAssignmentScheduleInstancesClientListForScopeResponse struct { - RoleAssignmentScheduleInstanceListResult -} - // RoleAssignmentScheduleRequestsClientCancelResponse contains the response from method RoleAssignmentScheduleRequestsClient.Cancel. type RoleAssignmentScheduleRequestsClientCancelResponse struct { // placeholder for future response values @@ -108,173 +33,3 @@ type RoleAssignmentScheduleRequestsClientListForScopeResponse struct { type RoleAssignmentScheduleRequestsClientValidateResponse struct { RoleAssignmentScheduleRequest } - -// RoleAssignmentSchedulesClientGetResponse contains the response from method RoleAssignmentSchedulesClient.Get. -type RoleAssignmentSchedulesClientGetResponse struct { - RoleAssignmentSchedule -} - -// RoleAssignmentSchedulesClientListForScopeResponse contains the response from method RoleAssignmentSchedulesClient.ListForScope. -type RoleAssignmentSchedulesClientListForScopeResponse struct { - RoleAssignmentScheduleListResult -} - -// RoleAssignmentsClientCreateByIDResponse contains the response from method RoleAssignmentsClient.CreateByID. -type RoleAssignmentsClientCreateByIDResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientCreateResponse contains the response from method RoleAssignmentsClient.Create. -type RoleAssignmentsClientCreateResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientDeleteByIDResponse contains the response from method RoleAssignmentsClient.DeleteByID. -type RoleAssignmentsClientDeleteByIDResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientDeleteResponse contains the response from method RoleAssignmentsClient.Delete. -type RoleAssignmentsClientDeleteResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientGetByIDResponse contains the response from method RoleAssignmentsClient.GetByID. -type RoleAssignmentsClientGetByIDResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientGetResponse contains the response from method RoleAssignmentsClient.Get. -type RoleAssignmentsClientGetResponse struct { - RoleAssignment -} - -// RoleAssignmentsClientListForResourceGroupResponse contains the response from method RoleAssignmentsClient.ListForResourceGroup. -type RoleAssignmentsClientListForResourceGroupResponse struct { - RoleAssignmentListResult -} - -// RoleAssignmentsClientListForResourceResponse contains the response from method RoleAssignmentsClient.ListForResource. -type RoleAssignmentsClientListForResourceResponse struct { - RoleAssignmentListResult -} - -// RoleAssignmentsClientListForScopeResponse contains the response from method RoleAssignmentsClient.ListForScope. -type RoleAssignmentsClientListForScopeResponse struct { - RoleAssignmentListResult -} - -// RoleAssignmentsClientListForSubscriptionResponse contains the response from method RoleAssignmentsClient.ListForSubscription. -type RoleAssignmentsClientListForSubscriptionResponse struct { - RoleAssignmentListResult -} - -// RoleDefinitionsClientCreateOrUpdateResponse contains the response from method RoleDefinitionsClient.CreateOrUpdate. -type RoleDefinitionsClientCreateOrUpdateResponse struct { - RoleDefinition -} - -// RoleDefinitionsClientDeleteResponse contains the response from method RoleDefinitionsClient.Delete. -type RoleDefinitionsClientDeleteResponse struct { - RoleDefinition -} - -// RoleDefinitionsClientGetByIDResponse contains the response from method RoleDefinitionsClient.GetByID. -type RoleDefinitionsClientGetByIDResponse struct { - RoleDefinition -} - -// RoleDefinitionsClientGetResponse contains the response from method RoleDefinitionsClient.Get. -type RoleDefinitionsClientGetResponse struct { - RoleDefinition -} - -// RoleDefinitionsClientListResponse contains the response from method RoleDefinitionsClient.List. -type RoleDefinitionsClientListResponse struct { - RoleDefinitionListResult -} - -// RoleEligibilityScheduleInstancesClientGetResponse contains the response from method RoleEligibilityScheduleInstancesClient.Get. -type RoleEligibilityScheduleInstancesClientGetResponse struct { - RoleEligibilityScheduleInstance -} - -// RoleEligibilityScheduleInstancesClientListForScopeResponse contains the response from method RoleEligibilityScheduleInstancesClient.ListForScope. -type RoleEligibilityScheduleInstancesClientListForScopeResponse struct { - RoleEligibilityScheduleInstanceListResult -} - -// RoleEligibilityScheduleRequestsClientCancelResponse contains the response from method RoleEligibilityScheduleRequestsClient.Cancel. -type RoleEligibilityScheduleRequestsClientCancelResponse struct { - // placeholder for future response values -} - -// RoleEligibilityScheduleRequestsClientCreateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Create. -type RoleEligibilityScheduleRequestsClientCreateResponse struct { - RoleEligibilityScheduleRequest -} - -// RoleEligibilityScheduleRequestsClientGetResponse contains the response from method RoleEligibilityScheduleRequestsClient.Get. -type RoleEligibilityScheduleRequestsClientGetResponse struct { - RoleEligibilityScheduleRequest -} - -// RoleEligibilityScheduleRequestsClientListForScopeResponse contains the response from method RoleEligibilityScheduleRequestsClient.ListForScope. -type RoleEligibilityScheduleRequestsClientListForScopeResponse struct { - RoleEligibilityScheduleRequestListResult -} - -// RoleEligibilityScheduleRequestsClientValidateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Validate. -type RoleEligibilityScheduleRequestsClientValidateResponse struct { - RoleEligibilityScheduleRequest -} - -// RoleEligibilitySchedulesClientGetResponse contains the response from method RoleEligibilitySchedulesClient.Get. -type RoleEligibilitySchedulesClientGetResponse struct { - RoleEligibilitySchedule -} - -// RoleEligibilitySchedulesClientListForScopeResponse contains the response from method RoleEligibilitySchedulesClient.ListForScope. -type RoleEligibilitySchedulesClientListForScopeResponse struct { - RoleEligibilityScheduleListResult -} - -// RoleManagementPoliciesClientDeleteResponse contains the response from method RoleManagementPoliciesClient.Delete. -type RoleManagementPoliciesClientDeleteResponse struct { - // placeholder for future response values -} - -// RoleManagementPoliciesClientGetResponse contains the response from method RoleManagementPoliciesClient.Get. -type RoleManagementPoliciesClientGetResponse struct { - RoleManagementPolicy -} - -// RoleManagementPoliciesClientListForScopeResponse contains the response from method RoleManagementPoliciesClient.ListForScope. -type RoleManagementPoliciesClientListForScopeResponse struct { - RoleManagementPolicyListResult -} - -// RoleManagementPoliciesClientUpdateResponse contains the response from method RoleManagementPoliciesClient.Update. -type RoleManagementPoliciesClientUpdateResponse struct { - RoleManagementPolicy -} - -// RoleManagementPolicyAssignmentsClientCreateResponse contains the response from method RoleManagementPolicyAssignmentsClient.Create. -type RoleManagementPolicyAssignmentsClientCreateResponse struct { - RoleManagementPolicyAssignment -} - -// RoleManagementPolicyAssignmentsClientDeleteResponse contains the response from method RoleManagementPolicyAssignmentsClient.Delete. -type RoleManagementPolicyAssignmentsClientDeleteResponse struct { - // placeholder for future response values -} - -// RoleManagementPolicyAssignmentsClientGetResponse contains the response from method RoleManagementPolicyAssignmentsClient.Get. -type RoleManagementPolicyAssignmentsClientGetResponse struct { - RoleManagementPolicyAssignment -} - -// RoleManagementPolicyAssignmentsClientListForScopeResponse contains the response from method RoleManagementPolicyAssignmentsClient.ListForScope. -type RoleManagementPolicyAssignmentsClientListForScopeResponse struct { - RoleManagementPolicyAssignmentListResult -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go deleted file mode 100644 index db553da2df14..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go +++ /dev/null @@ -1,649 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentsClient contains the methods for the RoleAssignments group. -// Don't use this type directly, use NewRoleAssignmentsClient() instead. -type RoleAssignmentsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewRoleAssignmentsClient creates a new instance of RoleAssignmentsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// Create - Create or update a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// parameters - Parameters for the role assignment. -// options - RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. -func (client *RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (RoleAssignmentsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleAssignmentName, parameters, options) - if err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return RoleAssignmentsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleAssignmentsClient) createHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateResponse, error) { - result := RoleAssignmentsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - return result, nil -} - -// CreateByID - Create or update a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// parameters - Parameters for the role assignment. -// options - RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID -// method. -func (client *RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (RoleAssignmentsClientCreateByIDResponse, error) { - req, err := client.createByIDCreateRequest(ctx, roleAssignmentID, parameters, options) - if err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return RoleAssignmentsClientCreateByIDResponse{}, runtime.NewResponseError(resp) - } - return client.createByIDHandleResponse(resp) -} - -// createByIDCreateRequest creates the CreateByID request. -func (client *RoleAssignmentsClient) createByIDCreateRequest(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createByIDHandleResponse handles the CreateByID response. -func (client *RoleAssignmentsClient) createByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateByIDResponse, error) { - result := RoleAssignmentsClientCreateByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - return result, nil -} - -// Delete - Delete a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// options - RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. -func (client *RoleAssignmentsClient) Delete(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (RoleAssignmentsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleAssignmentName, options) - if err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return client.deleteHandleResponse(resp) -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *RoleAssignmentsClient) deleteHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteResponse, error) { - result := RoleAssignmentsClientDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - return result, nil -} - -// DeleteByID - Delete a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// options - RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID -// method. -func (client *RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (RoleAssignmentsClientDeleteByIDResponse, error) { - req, err := client.deleteByIDCreateRequest(ctx, roleAssignmentID, options) - if err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleAssignmentsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) - } - return client.deleteByIDHandleResponse(resp) -} - -// deleteByIDCreateRequest creates the DeleteByID request. -func (client *RoleAssignmentsClient) deleteByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteByIDHandleResponse handles the DeleteByID response. -func (client *RoleAssignmentsClient) deleteByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteByIDResponse, error) { - result := RoleAssignmentsClientDeleteByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - return result, nil -} - -// Get - Get a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// options - RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. -func (client *RoleAssignmentsClient) Get(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (RoleAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentName, options) - if err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentsClient) getHandleResponse(resp *http.Response) (RoleAssignmentsClientGetResponse, error) { - result := RoleAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Get a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// options - RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. -func (client *RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (RoleAssignmentsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, roleAssignmentID, options) - if err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *RoleAssignmentsClient) getByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *RoleAssignmentsClient) getByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientGetByIDResponse, error) { - result := RoleAssignmentsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListForResourcePager - List all role assignments that apply to a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// resourceProviderNamespace - The namespace of the resource provider. -// resourceType - The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). -// resourceName - The resource name. -// options - RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.ListForResource -// method. -func (client *RoleAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) *runtime.Pager[RoleAssignmentsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceResponse]{ - More: func(page RoleAssignmentsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceResponse) (RoleAssignmentsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *RoleAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", resourceName) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *RoleAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceResponse, error) { - result := RoleAssignmentsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - List all role assignments that apply to a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.ListForResourceGroup -// method. -func (client *RoleAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) *runtime.Pager[RoleAssignmentsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceGroupResponse]{ - More: func(page RoleAssignmentsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceGroupResponse) (RoleAssignmentsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *RoleAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *RoleAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceGroupResponse, error) { - result := RoleAssignmentsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - return result, nil -} - -// NewListForScopePager - List all role assignments that apply to a scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// options - RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.ListForScope -// method. -func (client *RoleAssignmentsClient) NewListForScopePager(scope string, options *RoleAssignmentsClientListForScopeOptions) *runtime.Pager[RoleAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForScopeResponse]{ - More: func(page RoleAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForScopeResponse) (RoleAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - if options != nil && options.SkipToken != nil { - unencodedParams = append(unencodedParams, "$skipToken="+*options.SkipToken) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentsClientListForScopeResponse, error) { - result := RoleAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} - -// NewListForSubscriptionPager - List all role assignments that apply to a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.ListForSubscription -// method. -func (client *RoleAssignmentsClient) NewListForSubscriptionPager(options *RoleAssignmentsClientListForSubscriptionOptions) *runtime.Pager[RoleAssignmentsClientListForSubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForSubscriptionResponse]{ - More: func(page RoleAssignmentsClientListForSubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForSubscriptionResponse) (RoleAssignmentsClientListForSubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForSubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForSubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listForSubscriptionHandleResponse(resp) - }, - }) -} - -// listForSubscriptionCreateRequest creates the ListForSubscription request. -func (client *RoleAssignmentsClient) listForSubscriptionCreateRequest(ctx context.Context, options *RoleAssignmentsClientListForSubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForSubscriptionHandleResponse handles the ListForSubscription response. -func (client *RoleAssignmentsClient) listForSubscriptionHandleResponse(resp *http.Response) (RoleAssignmentsClientListForSubscriptionResponse, error) { - result := RoleAssignmentsClientListForSubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go deleted file mode 100644 index 6f9e6bd553b6..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go +++ /dev/null @@ -1,299 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForSubscription.json -func ExampleRoleAssignmentsClient_NewListForSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForSubscriptionPager(&armauthorization.RoleAssignmentsClientListForSubscriptionOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResourceGroup.json -func ExampleRoleAssignmentsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("testrg", &armauthorization.RoleAssignmentsClientListForResourceGroupOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResource.json -func ExampleRoleAssignmentsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("testrg", "Microsoft.DocumentDb", "databaseAccounts", "test-db-account", &armauthorization.RoleAssignmentsClientListForResourceOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Get.json -func ExampleRoleAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientGetOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Delete.json -func ExampleRoleAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientDeleteOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForScope.json -func ExampleRoleAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", &armauthorization.RoleAssignmentsClientListForScopeOptions{Filter: nil, - TenantID: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json -func ExampleRoleAssignmentsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientGetByIDOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateById.json -func ExampleRoleAssignmentsClient_CreateByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_DeleteById.json -func ExampleRoleAssignmentsClient_DeleteByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DeleteByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientDeleteByIDOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go deleted file mode 100644 index fe20774aa42e..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentScheduleInstancesClient contains the methods for the RoleAssignmentScheduleInstances group. -// Don't use this type directly, use NewRoleAssignmentScheduleInstancesClient() instead. -type RoleAssignmentScheduleInstancesClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleAssignmentScheduleInstancesClient creates a new instance of RoleAssignmentScheduleInstancesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleAssignmentScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentScheduleInstancesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentScheduleInstancesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Gets the specified role assignment schedule instance. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role assignments schedules. -// roleAssignmentScheduleInstanceName - The name (hash of schedule name + time) of the role assignment schedule to get. -// options - RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get -// method. -func (client *RoleAssignmentScheduleInstancesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (RoleAssignmentScheduleInstancesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleInstanceName, options) - if err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleInstancesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleInstanceName == "" { - return nil, errors.New("parameter roleAssignmentScheduleInstanceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleInstanceName}", url.PathEscape(roleAssignmentScheduleInstanceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientGetResponse, error) { - result := RoleAssignmentScheduleInstancesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstance); err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role assignment schedule instances of a role assignment schedule. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role assignment schedule. -// options - RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.ListForScope -// method. -func (client *RoleAssignmentScheduleInstancesClient) NewListForScopePager(scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleAssignmentScheduleInstancesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentScheduleInstancesClientListForScopeResponse]{ - More: func(page RoleAssignmentScheduleInstancesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentScheduleInstancesClientListForScopeResponse) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { - result := RoleAssignmentScheduleInstancesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstanceListResult); err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go deleted file mode 100644 index 8cd418654dfe..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstancesByScope.json -func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstanceByName.json -func ExampleRoleAssignmentScheduleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "ed9b8180-cef7-4c77-a63c-b8566ecfc412", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go index 389750dd681a..047f4cf0478b 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go @@ -54,7 +54,7 @@ func NewRoleAssignmentScheduleRequestsClient(credential azcore.TokenCredential, // Cancel - Cancels a pending role assignment schedule request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 +// Generated from API version 2023-04-01-preview // scope - The scope of the role assignment request to cancel. // roleAssignmentScheduleRequestName - The name of the role assignment request to cancel. // options - RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel @@ -87,7 +87,7 @@ func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -95,11 +95,12 @@ func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx cont // Create - Creates a role assignment schedule request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 +// Generated from API version 2023-04-01-preview // scope - The scope of the role assignment schedule request to create. The scope can be any REST resource instance. For example, -// use '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a +// subscription, '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' +// for a resource group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. // roleAssignmentScheduleRequestName - A GUID for the role assignment to create. The name must be unique and different for // each role assignment. @@ -134,7 +135,7 @@ func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -151,7 +152,7 @@ func (client *RoleAssignmentScheduleRequestsClient) createHandleResponse(resp *h // Get - Get the specified role assignment schedule request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 +// Generated from API version 2023-04-01-preview // scope - The scope of the role assignment schedule request. // roleAssignmentScheduleRequestName - The name (guid) of the role assignment schedule request to get. // options - RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get @@ -184,7 +185,7 @@ func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -200,8 +201,7 @@ func (client *RoleAssignmentScheduleRequestsClient) getHandleResponse(resp *http } // NewListForScopePager - Gets role assignment schedule requests for a scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 +// Generated from API version 2023-04-01-preview // scope - The scope of the role assignments schedule requests. // options - RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.ListForScope // method. @@ -245,7 +245,7 @@ func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ct if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *RoleAssignmentScheduleRequestsClient) listForScopeHandleResponse(r // Validate - Validates a new role assignment schedule request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 +// Generated from API version 2023-04-01-preview // scope - The scope of the role assignment request to validate. // roleAssignmentScheduleRequestName - The name of the role assignment request to validate. // parameters - Parameters for the role assignment schedule request. @@ -296,7 +296,7 @@ func (client *RoleAssignmentScheduleRequestsClient) validateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2023-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go deleted file mode 100644 index ae5ed4e932ab..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleAssignmentScheduleRequest.json -func ExampleRoleAssignmentScheduleRequestsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", armauthorization.RoleAssignmentScheduleRequest{ - Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("PT8H"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByScope.json -func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Cancel(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Validate(ctx, "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", armauthorization.RoleAssignmentScheduleRequest{ - Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("PT8H"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go deleted file mode 100644 index fc1b71a44a83..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentSchedulesClient contains the methods for the RoleAssignmentSchedules group. -// Don't use this type directly, use NewRoleAssignmentSchedulesClient() instead. -type RoleAssignmentSchedulesClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleAssignmentSchedulesClient creates a new instance of RoleAssignmentSchedulesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleAssignmentSchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentSchedulesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentSchedulesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the specified role assignment schedule for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role assignment schedule. -// roleAssignmentScheduleName - The name (guid) of the role assignment schedule to get. -// options - RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get -// method. -func (client *RoleAssignmentSchedulesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (RoleAssignmentSchedulesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleName, options) - if err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentSchedulesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleName == "" { - return nil, errors.New("parameter roleAssignmentScheduleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleName}", url.PathEscape(roleAssignmentScheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentSchedulesClient) getHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientGetResponse, error) { - result := RoleAssignmentSchedulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentSchedule); err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role assignment schedules for a resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role assignments schedules. -// options - RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.ListForScope -// method. -func (client *RoleAssignmentSchedulesClient) NewListForScopePager(scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) *runtime.Pager[RoleAssignmentSchedulesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentSchedulesClientListForScopeResponse]{ - More: func(page RoleAssignmentSchedulesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentSchedulesClientListForScopeResponse) (RoleAssignmentSchedulesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentSchedulesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentSchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientListForScopeResponse, error) { - result := RoleAssignmentSchedulesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleListResult); err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go deleted file mode 100644 index afe2a2995be7..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleByName.json -func ExampleRoleAssignmentSchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentSchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "c9e264ff-3133-4776-a81a-ebc7c33c8ec6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentSchedulesByScope.json -func ExampleRoleAssignmentSchedulesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentSchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentSchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go deleted file mode 100644 index 2d567783e662..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go +++ /dev/null @@ -1,308 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleDefinitionsClient contains the methods for the RoleDefinitions group. -// Don't use this type directly, use NewRoleDefinitionsClient() instead. -type RoleDefinitionsClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleDefinitionsClient creates a new instance of RoleDefinitionsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleDefinitionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleDefinitionsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a role definition. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the role definition. -// roleDefinitionID - The ID of the role definition. -// roleDefinition - The values for the role definition. -// options - RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate -// method. -func (client *RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (RoleDefinitionsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, scope, roleDefinitionID, roleDefinition, options) - if err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleDefinitionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, roleDefinition) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *RoleDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (RoleDefinitionsClientCreateOrUpdateResponse, error) { - result := RoleDefinitionsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a role definition. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the role definition. -// roleDefinitionID - The ID of the role definition to delete. -// options - RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. -func (client *RoleDefinitionsClient) Delete(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (RoleDefinitionsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleDefinitionID, options) - if err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleDefinitionsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return client.deleteHandleResponse(resp) -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *RoleDefinitionsClient) deleteHandleResponse(resp *http.Response) (RoleDefinitionsClientDeleteResponse, error) { - result := RoleDefinitionsClientDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - return result, nil -} - -// Get - Get role definition by name (GUID). -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the role definition. -// roleDefinitionID - The ID of the role definition. -// options - RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. -func (client *RoleDefinitionsClient) Get(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (RoleDefinitionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleDefinitionID, options) - if err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleDefinitionsClient) getHandleResponse(resp *http.Response) (RoleDefinitionsClientGetResponse, error) { - result := RoleDefinitionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Gets a role definition by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// roleID - The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} -// for subscription level role definitions, or -// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. -// options - RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. -func (client *RoleDefinitionsClient) GetByID(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (RoleDefinitionsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, roleID, options) - if err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{roleId}" - urlPath = strings.ReplaceAll(urlPath, "{roleId}", roleID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *RoleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (RoleDefinitionsClientGetByIDResponse, error) { - result := RoleDefinitionsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListPager - Get all role definitions that are applicable at scope and above. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the role definition. -// options - RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.List method. -func (client *RoleDefinitionsClient) NewListPager(scope string, options *RoleDefinitionsClientListOptions) *runtime.Pager[RoleDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleDefinitionsClientListResponse]{ - More: func(page RoleDefinitionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleDefinitionsClientListResponse) (RoleDefinitionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleDefinitionsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleDefinitionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RoleDefinitionsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *RoleDefinitionsClient) listHandleResponse(resp *http.Response) (RoleDefinitionsClientListResponse, error) { - result := RoleDefinitionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinitionListResult); err != nil { - return RoleDefinitionsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go deleted file mode 100644 index 9a1e6ed8269c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/DeleteRoleDefinition.json -func ExampleRoleDefinitionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionByName.json -func ExampleRoleDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/PutRoleDefinition.json -func ExampleRoleDefinitionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CreateOrUpdate(ctx, "scope", "roleDefinitionId", armauthorization.RoleDefinition{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionAtScope.json -func ExampleRoleDefinitionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("scope", &armauthorization.RoleDefinitionsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json -func ExampleRoleDefinitionsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByID(ctx, "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go deleted file mode 100644 index b4b96e8380cd..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilityScheduleInstancesClient contains the methods for the RoleEligibilityScheduleInstances group. -// Don't use this type directly, use NewRoleEligibilityScheduleInstancesClient() instead. -type RoleEligibilityScheduleInstancesClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleEligibilityScheduleInstancesClient creates a new instance of RoleEligibilityScheduleInstancesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleEligibilityScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleInstancesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleInstancesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Gets the specified role eligibility schedule instance. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedules. -// roleEligibilityScheduleInstanceName - The name (hash of schedule name + time) of the role eligibility schedule to get. -// options - RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get -// method. -func (client *RoleEligibilityScheduleInstancesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (RoleEligibilityScheduleInstancesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleInstanceName, options) - if err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleInstancesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleInstanceName == "" { - return nil, errors.New("parameter roleEligibilityScheduleInstanceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleInstanceName}", url.PathEscape(roleEligibilityScheduleInstanceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilityScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientGetResponse, error) { - result := RoleEligibilityScheduleInstancesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstance); err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedule instances of a role eligibility schedule. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedule. -// options - RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.ListForScope -// method. -func (client *RoleEligibilityScheduleInstancesClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleInstancesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleInstancesClientListForScopeResponse]{ - More: func(page RoleEligibilityScheduleInstancesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleInstancesClientListForScopeResponse) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilityScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { - result := RoleEligibilityScheduleInstancesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstanceListResult); err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go deleted file mode 100644 index 0828dedd328d..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstancesByScope.json -func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstanceByName.json -func ExampleRoleEligibilityScheduleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "21e4b59a-0499-4fe0-a3c3-43a3055b773a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go deleted file mode 100644 index 1c5613028c3a..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go +++ /dev/null @@ -1,311 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilityScheduleRequestsClient contains the methods for the RoleEligibilityScheduleRequests group. -// Don't use this type directly, use NewRoleEligibilityScheduleRequestsClient() instead. -type RoleEligibilityScheduleRequestsClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleEligibilityScheduleRequestsClient creates a new instance of RoleEligibilityScheduleRequestsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleEligibilityScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleRequestsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleRequestsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Cancel - Cancels a pending role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility request to cancel. -// roleEligibilityScheduleRequestName - The name of the role eligibility request to cancel. -// options - RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel -// method. -func (client *RoleEligibilityScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (RoleEligibilityScheduleRequestsClientCancelResponse, error) { - req, err := client.cancelCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, runtime.NewResponseError(resp) - } - return RoleEligibilityScheduleRequestsClientCancelResponse{}, nil -} - -// cancelCreateRequest creates the Cancel request. -func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Create - Creates a role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedule request to create. The scope can be any REST resource instance. For -// example, use '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' -// for a resource. -// roleEligibilityScheduleRequestName - The name of the role eligibility to create. It can be any valid GUID. -// parameters - Parameters for the role eligibility schedule request. -// options - RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create -// method. -func (client *RoleEligibilityScheduleRequestsClient) Create(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleEligibilityScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { - result := RoleEligibilityScheduleRequestsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - return result, nil -} - -// Get - Get the specified role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedule request. -// roleEligibilityScheduleRequestName - The name (guid) of the role eligibility schedule request to get. -// options - RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get -// method. -func (client *RoleEligibilityScheduleRequestsClient) Get(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (RoleEligibilityScheduleRequestsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilityScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientGetResponse, error) { - result := RoleEligibilityScheduleRequestsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedule requests for a scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedule requests. -// options - RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.ListForScope -// method. -func (client *RoleEligibilityScheduleRequestsClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleRequestsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleRequestsClientListForScopeResponse]{ - More: func(page RoleEligibilityScheduleRequestsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleRequestsClientListForScopeResponse) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilityScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { - result := RoleEligibilityScheduleRequestsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequestListResult); err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - return result, nil -} - -// Validate - Validates a new role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility request to validate. -// roleEligibilityScheduleRequestName - The name of the role eligibility request to validate. -// parameters - Parameters for the role eligibility schedule request. -// options - RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate -// method. -func (client *RoleEligibilityScheduleRequestsClient) Validate(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { - req, err := client.validateCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, runtime.NewResponseError(resp) - } - return client.validateHandleResponse(resp) -} - -// validateCreateRequest creates the Validate request. -func (client *RoleEligibilityScheduleRequestsClient) validateCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// validateHandleResponse handles the Validate response. -func (client *RoleEligibilityScheduleRequestsClient) validateHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { - result := RoleEligibilityScheduleRequestsClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go deleted file mode 100644 index dbc75b6798c3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go +++ /dev/null @@ -1,146 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleEligibilityScheduleRequest.json -func ExampleRoleEligibilityScheduleRequestsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", armauthorization.RoleEligibilityScheduleRequest{ - Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("P365D"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByScope.json -func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Cancel(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Validate(ctx, "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", armauthorization.RoleEligibilityScheduleRequest{ - Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("P365D"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go deleted file mode 100644 index 814f6090a0ea..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go +++ /dev/null @@ -1,164 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilitySchedulesClient contains the methods for the RoleEligibilitySchedules group. -// Don't use this type directly, use NewRoleEligibilitySchedulesClient() instead. -type RoleEligibilitySchedulesClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleEligibilitySchedulesClient creates a new instance of RoleEligibilitySchedulesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleEligibilitySchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilitySchedulesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilitySchedulesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get the specified role eligibility schedule for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedule. -// roleEligibilityScheduleName - The name (guid) of the role eligibility schedule to get. -// options - RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get -// method. -func (client *RoleEligibilitySchedulesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (RoleEligibilitySchedulesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleName, options) - if err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilitySchedulesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleName == "" { - return nil, errors.New("parameter roleEligibilityScheduleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleName}", url.PathEscape(roleEligibilityScheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilitySchedulesClient) getHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientGetResponse, error) { - result := RoleEligibilitySchedulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilitySchedule); err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedules for a resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role eligibility schedules. -// options - RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.ListForScope -// method. -func (client *RoleEligibilitySchedulesClient) NewListForScopePager(scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) *runtime.Pager[RoleEligibilitySchedulesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilitySchedulesClientListForScopeResponse]{ - More: func(page RoleEligibilitySchedulesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilitySchedulesClientListForScopeResponse) (RoleEligibilitySchedulesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilitySchedulesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilitySchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientListForScopeResponse, error) { - result := RoleEligibilitySchedulesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleListResult); err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go deleted file mode 100644 index 5be7e12a0e12..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleByName.json -func ExampleRoleEligibilitySchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilitySchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "b1477448-2cc6-4ceb-93b4-54a202a89413", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilitySchedulesByScope.json -func ExampleRoleEligibilitySchedulesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleEligibilitySchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilitySchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go deleted file mode 100644 index 4d29abb5bec0..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleManagementPoliciesClient contains the methods for the RoleManagementPolicies group. -// Don't use this type directly, use NewRoleManagementPoliciesClient() instead. -type RoleManagementPoliciesClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleManagementPoliciesClient creates a new instance of RoleManagementPoliciesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleManagementPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPoliciesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleManagementPoliciesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Delete - Delete a role management policy -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy to upsert. -// roleManagementPolicyName - The name (guid) of the role management policy to upsert. -// options - RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete -// method. -func (client *RoleManagementPoliciesClient) Delete(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (RoleManagementPoliciesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyName, options) - if err != nil { - return RoleManagementPoliciesClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPoliciesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleManagementPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return RoleManagementPoliciesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get the specified role management policy for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy. -// roleManagementPolicyName - The name (guid) of the role management policy to get. -// options - RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get -// method. -func (client *RoleManagementPoliciesClient) Get(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (RoleManagementPoliciesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyName, options) - if err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleManagementPoliciesClient) getHandleResponse(resp *http.Response) (RoleManagementPoliciesClientGetResponse, error) { - result := RoleManagementPoliciesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role management policies for a resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy. -// options - RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.ListForScope -// method. -func (client *RoleManagementPoliciesClient) NewListForScopePager(scope string, options *RoleManagementPoliciesClientListForScopeOptions) *runtime.Pager[RoleManagementPoliciesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleManagementPoliciesClientListForScopeResponse]{ - More: func(page RoleManagementPoliciesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleManagementPoliciesClientListForScopeResponse) (RoleManagementPoliciesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPoliciesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleManagementPoliciesClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPoliciesClientListForScopeResponse, error) { - result := RoleManagementPoliciesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyListResult); err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - return result, nil -} - -// Update - Update a role management policy -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy to upsert. -// roleManagementPolicyName - The name (guid) of the role management policy to upsert. -// parameters - Parameters for the role management policy. -// options - RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update -// method. -func (client *RoleManagementPoliciesClient) Update(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (RoleManagementPoliciesClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, scope, roleManagementPolicyName, parameters, options) - if err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// updateHandleResponse handles the Update response. -func (client *RoleManagementPoliciesClient) updateHandleResponse(resp *http.Response) (RoleManagementPoliciesClientUpdateResponse, error) { - result := RoleManagementPoliciesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go deleted file mode 100644 index 3903e3f9f7f1..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go +++ /dev/null @@ -1,416 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByName.json -func ExampleRoleManagementPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchPartialRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Update_patchPartialRoleManagementPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", armauthorization.RoleManagementPolicy{ - Properties: &armauthorization.RoleManagementPolicyProperties{ - Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P180D"), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Update_patchRoleManagementPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", armauthorization.RoleManagementPolicy{ - Properties: &armauthorization.RoleManagementPolicyProperties{ - Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P180D"), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("approver_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{}, - }, - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P90D"), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{ - to.Ptr(armauthorization.EnablementRulesJustification), - to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("approver_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }, - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(true), - MaximumDuration: to.Ptr("PT7H"), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{ - to.Ptr(armauthorization.EnablementRulesJustification), - to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - to.Ptr(armauthorization.EnablementRulesTicketing)}, - }, - &armauthorization.RoleManagementPolicyApprovalRule{ - ID: to.Ptr("Approval_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - Setting: &armauthorization.ApprovalSettings{ - ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - ApprovalStages: []*armauthorization.ApprovalStage{ - { - ApprovalStageTimeOutInDays: to.Ptr[int32](1), - EscalationTimeInMinutes: to.Ptr[int32](0), - IsApproverJustificationRequired: to.Ptr(true), - IsEscalationEnabled: to.Ptr(false), - PrimaryApprovers: []*armauthorization.UserSet{ - { - Description: to.Ptr("amansw_new_group"), - ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - IsBackup: to.Ptr(false), - UserType: to.Ptr(armauthorization.UserTypeGroup), - }, - { - Description: to.Ptr("amansw_group"), - ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - IsBackup: to.Ptr(false), - UserType: to.Ptr(armauthorization.UserTypeGroup), - }}, - }}, - IsApprovalRequired: to.Ptr(true), - IsApprovalRequiredForExtension: to.Ptr(false), - IsRequestorJustificationRequired: to.Ptr(true), - }, - }, - &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - ClaimValue: to.Ptr(""), - IsEnabled: to.Ptr(false), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_enduser_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_enduser_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(true), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByScope.json -func ExampleRoleManagementPoliciesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go deleted file mode 100644 index fcf1b0369e2b..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go +++ /dev/null @@ -1,253 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleManagementPolicyAssignmentsClient contains the methods for the RoleManagementPolicyAssignments group. -// Don't use this type directly, use NewRoleManagementPolicyAssignmentsClient() instead. -type RoleManagementPolicyAssignmentsClient struct { - host string - pl runtime.Pipeline -} - -// NewRoleManagementPolicyAssignmentsClient creates a new instance of RoleManagementPolicyAssignmentsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewRoleManagementPolicyAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPolicyAssignmentsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleManagementPolicyAssignmentsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Create - Create a role management policy assignment -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy assignment to upsert. -// roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to upsert. -// parameters - Parameters for the role management policy assignment. -// options - RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create -// method. -func (client *RoleManagementPolicyAssignmentsClient) Create(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, parameters, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleManagementPolicyAssignmentsClient) createHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { - result := RoleManagementPolicyAssignmentsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a role management policy assignment -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy assignment to delete. -// roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to delete. -// options - RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete -// method. -func (client *RoleManagementPolicyAssignmentsClient) Delete(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (RoleManagementPolicyAssignmentsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get the specified role management policy assignment for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy. -// roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to get. -// options - RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get -// method. -func (client *RoleManagementPolicyAssignmentsClient) Get(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (RoleManagementPolicyAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPolicyAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleManagementPolicyAssignmentsClient) getHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientGetResponse, error) { - result := RoleManagementPolicyAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role management assignment policies for a resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-01 -// scope - The scope of the role management policy. -// options - RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.ListForScope -// method. -func (client *RoleManagementPolicyAssignmentsClient) NewListForScopePager(scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) *runtime.Pager[RoleManagementPolicyAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleManagementPolicyAssignmentsClientListForScopeResponse]{ - More: func(page RoleManagementPolicyAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleManagementPolicyAssignmentsClientListForScopeResponse) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleManagementPolicyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { - result := RoleManagementPolicyAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignmentListResult); err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go deleted file mode 100644 index 39b91d4c9a58..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByName.json -func ExampleRoleManagementPolicyAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleManagementPolicyAssignment.json -func ExampleRoleManagementPolicyAssignmentsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", armauthorization.RoleManagementPolicyAssignment{ - Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicyAssignment.json -func ExampleRoleManagementPolicyAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByScope.json -func ExampleRoleManagementPolicyAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -}