Apex OrgLimits クラスで組織制限を取得する


#1.OrgLimits クラスについて
SOAP API 要求、Bulk API 要求、ストリーミング API の制限など、Saleforce 組織のすべての OrgLimit インスタンスのリストまたは対応付けを提供するメソッドが含まれます。

詳細は **[Apex 開発者ガイドの OrgLimits / OrgLimit クラス](https://developer.salesforce.com/docs/atlas.ja-jp.apexcode.meta/apexcode/apex_class_System_OrgLimits.htm#apex_class_System_OrgLimits)**をご参照ください。
#2.実装例（OrgLimitMetaData）
```java

public class OrgLimitMetaData {
    public OrgLimitItem activeScratchOrgs 						{get; private set;}
    public OrgLimitItem concurrentAsyncGetReportInstances 		{get; private set;}
    public OrgLimitItem concurrentSyncReportRuns 				{get; private set;}
    public OrgLimitItem dailyAnalyticsDataflowJobExecutions 	{get; private set;}
    public OrgLimitItem dailyApiRequests 						{get; private set;}
    public OrgLimitItem dailyAsyncApexExecutions 				{get; private set;}
    public OrgLimitItem dailyBulkApiRequests 					{get; private set;}
    public OrgLimitItem dailyDurableGenericStreamingApiEvents 	{get; private set;}
    public OrgLimitItem dailyDurableStreamingApiEvents 			{get; private set;}
    public OrgLimitItem dailyGenericStreamingApiEvents 			{get; private set;}
    public OrgLimitItem dailyScratchOrgs 						{get; private set;}
    public OrgLimitItem dailyStandardVolumePlatformEvents 		{get; private set;}
    public OrgLimitItem dailyStreamingApiEvents 				{get; private set;}
    public OrgLimitItem dailyWorkflowEmails 					{get; private set;}
    public OrgLimitItem dataStorageMB 							{get; private set;}
    public OrgLimitItem durableStreamingApiConcurrentClients 	{get; private set;}
    public OrgLimitItem fileStorageMB 							{get; private set;}
    public OrgLimitItem hourlyAsyncReportRuns 					{get; private set;}
    public OrgLimitItem hourlyDashboardRefreshes 				{get; private set;}
    public OrgLimitItem hourlyDashboardResults 					{get; private set;}
    public OrgLimitItem hourlyDashboardStatuses 				{get; private set;}
    public OrgLimitItem hourlyLongTermIdMapping 				{get; private set;}
    public OrgLimitItem hourlyODataCallout 						{get; private set;}
    public OrgLimitItem hourlyShortTermIdMapping 				{get; private set;}
    public OrgLimitItem hourlySyncReportRuns 					{get; private set;}
    public OrgLimitItem hourlyTimeBasedWorkflow 				{get; private set;}
    public OrgLimitItem massEmail 								{get; private set;}
    public OrgLimitItem monthlyPlatformEvents 					{get; private set;}
    public OrgLimitItem package2VersionCreates 					{get; private set;}
    public OrgLimitItem permissionSets 							{get; private set;}
    public OrgLimitItem singleEmail 							{get; private set;}
    public OrgLimitItem streamingApiConcurrentClients 			{get; private set;}

    public OrgLimitMetaData() {
        Map<String, System.OrgLimit> orgLimitMap = OrgLimits.getMap();

        this.activeScratchOrgs                     = new OrgLimitItem(orgLimitMap.get('ActiveScratchOrgs'));
        this.concurrentAsyncGetReportInstances     = new OrgLimitItem(orgLimitMap.get('ConcurrentAsyncGetReportInstances'));
        this.concurrentSyncReportRuns              = new OrgLimitItem(orgLimitMap.get('ConcurrentSyncReportRuns'));
        this.dailyAnalyticsDataflowJobExecutions   = new OrgLimitItem(orgLimitMap.get('DailyAnalyticsDataflowJobExecutions'));
        this.dailyApiRequests                      = new OrgLimitItem(orgLimitMap.get('DailyApiRequests'));
        this.dailyAsyncApexExecutions              = new OrgLimitItem(orgLimitMap.get('DailyAsyncApexExecutions'));
        this.dailyBulkApiRequests                  = new OrgLimitItem(orgLimitMap.get('DailyBulkApiRequests'));
        this.dailyDurableGenericStreamingApiEvents = new OrgLimitItem(orgLimitMap.get('DailyDurableGenericStreamingApiEvents'));
        this.dailyDurableStreamingApiEvents        = new OrgLimitItem(orgLimitMap.get('DailyDurableStreamingApiEvents'));
        this.dailyGenericStreamingApiEvents        = new OrgLimitItem(orgLimitMap.get('DailyGenericStreamingApiEvents'));
        this.dailyScratchOrgs                      = new OrgLimitItem(orgLimitMap.get('DailyScratchOrgs'));
        this.dailyStandardVolumePlatformEvents     = new OrgLimitItem(orgLimitMap.get('DailyStandardVolumePlatformEvents'));
        this.dailyStreamingApiEvents               = new OrgLimitItem(orgLimitMap.get('DailyStreamingApiEvents'));
        this.dailyWorkflowEmails                   = new OrgLimitItem(orgLimitMap.get('DailyWorkflowEmails'));
        this.dataStorageMB                         = new OrgLimitItem(orgLimitMap.get('DataStorageMB'));
        this.durableStreamingApiConcurrentClients  = new OrgLimitItem(orgLimitMap.get('DurableStreamingApiConcurrentClients'));
        this.fileStorageMB                         = new OrgLimitItem(orgLimitMap.get('FileStorageMB'));
        this.hourlyAsyncReportRuns                 = new OrgLimitItem(orgLimitMap.get('HourlyAsyncReportRuns'));
        this.hourlyDashboardRefreshes              = new OrgLimitItem(orgLimitMap.get('HourlyDashboardRefreshes'));
        this.hourlyDashboardResults                = new OrgLimitItem(orgLimitMap.get('HourlyDashboardResults'));
        this.hourlyDashboardStatuses               = new OrgLimitItem(orgLimitMap.get('HourlyDashboardStatuses'));
        this.hourlyLongTermIdMapping               = new OrgLimitItem(orgLimitMap.get('HourlyLongTermIdMapping'));
        this.hourlyODataCallout                    = new OrgLimitItem(orgLimitMap.get('HourlyODataCallout'));
        this.hourlyShortTermIdMapping              = new OrgLimitItem(orgLimitMap.get('HourlyShortTermIdMapping'));
        this.hourlySyncReportRuns                  = new OrgLimitItem(orgLimitMap.get('HourlySyncReportRuns'));
        this.hourlyTimeBasedWorkflow               = new OrgLimitItem(orgLimitMap.get('HourlyTimeBasedWorkflow'));
        this.massEmail                             = new OrgLimitItem(orgLimitMap.get('MassEmail'));
        this.monthlyPlatformEvents                 = new OrgLimitItem(orgLimitMap.get('MonthlyPlatformEvents'));
        this.package2VersionCreates                = new OrgLimitItem(orgLimitMap.get('Package2VersionCreates'));
        this.permissionSets                        = new OrgLimitItem(orgLimitMap.get('PermissionSets'));
        this.singleEmail                           = new OrgLimitItem(orgLimitMap.get('SingleEmail'));
        this.streamingApiConcurrentClients         = new OrgLimitItem(orgLimitMap.get('StreamingApiConcurrentClients'));
    }

    public class OrgLimitItem {
        public String name 			{get; private set;}
        public Integer limitValue 	{get; private set;}
        public Integer usedValue 	{get; private set;}

        public OrgLimitItem(System.OrgLimit item){
            this.name 		= item.getName();
            this.limitValue = item.getLimit();
            this.usedValue 	= item.getValue();
        }
    }
}
```