day2 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. {day2-0.3.0 → day2-0.3.2}/PKG-INFO +1 -1
  2. {day2-0.3.0 → day2-0.3.2}/day2/__init__.py +11 -0
  3. {day2-0.3.0 → day2-0.3.2}/day2/models/__init__.py +25 -0
  4. {day2-0.3.0 → day2-0.3.2}/day2/models/account.py +48 -1
  5. {day2-0.3.0 → day2-0.3.2}/day2/models/assessment.py +52 -0
  6. day2-0.3.2/day2/models/project.py +156 -0
  7. day2-0.3.2/day2/models/role.py +43 -0
  8. {day2-0.3.0 → day2-0.3.2}/day2/resources/__init__.py +4 -0
  9. {day2-0.3.0 → day2-0.3.2}/day2/resources/account.py +32 -0
  10. {day2-0.3.0 → day2-0.3.2}/day2/resources/assessment.py +68 -0
  11. day2-0.3.2/day2/resources/project.py +89 -0
  12. day2-0.3.2/day2/resources/role.py +41 -0
  13. {day2-0.3.0 → day2-0.3.2}/day2/session.py +24 -0
  14. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/PKG-INFO +1 -1
  15. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/SOURCES.txt +6 -0
  16. {day2-0.3.0 → day2-0.3.2}/day2_cli/cli.py +4 -0
  17. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/account.py +100 -0
  18. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/assessment.py +132 -0
  19. day2-0.3.2/day2_cli/commands/project.py +319 -0
  20. day2-0.3.2/day2_cli/commands/role.py +81 -0
  21. {day2-0.3.0 → day2-0.3.2}/pyproject.toml +1 -1
  22. {day2-0.3.0 → day2-0.3.2}/LICENSE +0 -0
  23. {day2-0.3.0 → day2-0.3.2}/README.md +0 -0
  24. {day2-0.3.0 → day2-0.3.2}/day2/_version.py +0 -0
  25. {day2-0.3.0 → day2-0.3.2}/day2/auth/__init__.py +0 -0
  26. {day2-0.3.0 → day2-0.3.2}/day2/auth/credentials.py +0 -0
  27. {day2-0.3.0 → day2-0.3.2}/day2/client/__init__.py +0 -0
  28. {day2-0.3.0 → day2-0.3.2}/day2/client/base.py +0 -0
  29. {day2-0.3.0 → day2-0.3.2}/day2/client/config.py +0 -0
  30. {day2-0.3.0 → day2-0.3.2}/day2/client/constants.py +0 -0
  31. {day2-0.3.0 → day2-0.3.2}/day2/client/profile.py +0 -0
  32. {day2-0.3.0 → day2-0.3.2}/day2/client/user_context.py +0 -0
  33. {day2-0.3.0 → day2-0.3.2}/day2/exceptions.py +0 -0
  34. {day2-0.3.0 → day2-0.3.2}/day2/models/azure_account.py +0 -0
  35. {day2-0.3.0 → day2-0.3.2}/day2/models/azure_assessment.py +0 -0
  36. {day2-0.3.0 → day2-0.3.2}/day2/models/bot.py +0 -0
  37. {day2-0.3.0 → day2-0.3.2}/day2/models/cost.py +0 -0
  38. {day2-0.3.0 → day2-0.3.2}/day2/models/report.py +0 -0
  39. {day2-0.3.0 → day2-0.3.2}/day2/models/resource.py +0 -0
  40. {day2-0.3.0 → day2-0.3.2}/day2/models/tenant.py +0 -0
  41. {day2-0.3.0 → day2-0.3.2}/day2/models/user.py +0 -0
  42. {day2-0.3.0 → day2-0.3.2}/day2/resources/azure_account.py +0 -0
  43. {day2-0.3.0 → day2-0.3.2}/day2/resources/azure_assessment.py +0 -0
  44. {day2-0.3.0 → day2-0.3.2}/day2/resources/bot.py +0 -0
  45. {day2-0.3.0 → day2-0.3.2}/day2/resources/cost.py +0 -0
  46. {day2-0.3.0 → day2-0.3.2}/day2/resources/report.py +0 -0
  47. {day2-0.3.0 → day2-0.3.2}/day2/resources/resource.py +0 -0
  48. {day2-0.3.0 → day2-0.3.2}/day2/resources/tenant.py +0 -0
  49. {day2-0.3.0 → day2-0.3.2}/day2/resources/user.py +0 -0
  50. {day2-0.3.0 → day2-0.3.2}/day2/utils/__init__.py +0 -0
  51. {day2-0.3.0 → day2-0.3.2}/day2/utils/helpers.py +0 -0
  52. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/dependency_links.txt +0 -0
  53. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/entry_points.txt +0 -0
  54. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/requires.txt +0 -0
  55. {day2-0.3.0 → day2-0.3.2}/day2.egg-info/top_level.txt +0 -0
  56. {day2-0.3.0 → day2-0.3.2}/day2_cli/__init__.py +0 -0
  57. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/__init__.py +0 -0
  58. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/auth.py +0 -0
  59. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/azure_account.py +0 -0
  60. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/azure_assessment.py +0 -0
  61. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/bot.py +0 -0
  62. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/cost.py +0 -0
  63. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/profile.py +0 -0
  64. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/report.py +0 -0
  65. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/resource.py +0 -0
  66. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/tenant.py +0 -0
  67. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/tenant_docs_cli.py +0 -0
  68. {day2-0.3.0 → day2-0.3.2}/day2_cli/commands/user.py +0 -0
  69. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/__init__.py +0 -0
  70. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/context.py +0 -0
  71. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/exit_codes.py +0 -0
  72. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/formatters.py +0 -0
  73. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/helpers.py +0 -0
  74. {day2-0.3.0 → day2-0.3.2}/day2_cli/utils/output_formatter.py +0 -0
  75. {day2-0.3.0 → day2-0.3.2}/setup.cfg +0 -0
  76. {day2-0.3.0 → day2-0.3.2}/tests/test_exceptions.py +0 -0
  77. {day2-0.3.0 → day2-0.3.2}/tests/test_rate_limiting.py +0 -0
  78. {day2-0.3.0 → day2-0.3.2}/tests/test_rate_limiting_retry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: day2
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: MontyCloud DAY2 SDK for Python
5
5
  Author-email: MontyCloud <info@montycloud.com>
6
6
  Requires-Python: >=3.11
@@ -13,6 +13,7 @@ from day2.session import Session
13
13
  if TYPE_CHECKING:
14
14
  from day2.resources.assessment import AssessmentClient
15
15
  from day2.resources.cost import CostClient
16
+ from day2.resources.project import ProjectClient
16
17
  from day2.resources.tenant import TenantClient
17
18
 
18
19
 
@@ -64,11 +65,21 @@ def cost() -> "CostClient":
64
65
  return get_default_session().cost
65
66
 
66
67
 
68
+ def project() -> "ProjectClient":
69
+ """Get a project client using the default session.
70
+
71
+ Returns:
72
+ ProjectClient: A client for interacting with project resources
73
+ """
74
+ return get_default_session().project
75
+
76
+
67
77
  __all__ = [
68
78
  "Session",
69
79
  "__version__",
70
80
  "tenant",
71
81
  "assessment",
72
82
  "cost",
83
+ "project",
73
84
  "get_default_session",
74
85
  ]
@@ -11,6 +11,9 @@ from day2.models.account import (
11
11
  )
12
12
  from day2.models.account import (
13
13
  ListAccountsOutput,
14
+ ListRegionStatusOutput,
15
+ RegionStatus,
16
+ RegionStatusErrorDetail,
14
17
  )
15
18
  from day2.models.assessment import (
16
19
  Assessment,
@@ -47,6 +50,15 @@ from day2.models.bot import (
47
50
  ResourceType,
48
51
  )
49
52
  from day2.models.cost import GetCostByChargeTypeOutput
53
+ from day2.models.project import AccountItem as ProjectAccountItem
54
+ from day2.models.project import (
55
+ AccountRegion,
56
+ ListProjectRequestsOutput,
57
+ ListProjectsOutput,
58
+ ProjectItem,
59
+ ProjectMetadata,
60
+ ProjectRequestItem,
61
+ )
50
62
  from day2.models.report import (
51
63
  DeleteReportInput,
52
64
  DeleteReportOutput,
@@ -62,6 +74,7 @@ from day2.models.resource import (
62
74
  ListRegionsOutput,
63
75
  ListResourceTypesOutput,
64
76
  )
77
+ from day2.models.role import ListRolesOutput, RoleModel
65
78
  from day2.models.tenant import (
66
79
  CreateTenantInput,
67
80
  CreateTenantOutput,
@@ -75,6 +88,7 @@ from day2.models.user import ListUsersOutput, User
75
88
 
76
89
  __all__ = [
77
90
  "AccountItem",
91
+ "RegionStatusErrorDetail",
78
92
  "ListAccountsOutput",
79
93
  "TenantDetails",
80
94
  "TenantCategory",
@@ -88,6 +102,8 @@ __all__ = [
88
102
  "ListUsersOutput",
89
103
  "ListTenantCategoriesOutput",
90
104
  "User",
105
+ "RoleModel",
106
+ "ListRolesOutput",
91
107
  "Assessment",
92
108
  "AzureAssessment",
93
109
  "AzureFinding",
@@ -121,4 +137,13 @@ __all__ = [
121
137
  "InventorySummaryByResourceType",
122
138
  "DeleteReportInput",
123
139
  "DeleteReportOutput",
140
+ "ProjectItem",
141
+ "ProjectMetadata",
142
+ "ProjectRequestItem",
143
+ "ListProjectRequestsOutput",
144
+ "RegionStatus",
145
+ "ProjectAccountItem",
146
+ "AccountRegion",
147
+ "ListProjectsOutput",
148
+ "ListRegionStatusOutput",
124
149
  ]
@@ -1,6 +1,6 @@
1
1
  """Account models for the MontyCloud SDK."""
2
2
 
3
- from typing import List
3
+ from typing import List, Optional
4
4
 
5
5
  from pydantic import BaseModel, ConfigDict, Field
6
6
 
@@ -83,3 +83,50 @@ class ListAccountsOutput(BaseModel):
83
83
 
84
84
  # Allow extra fields
85
85
  model_config = ConfigDict(extra="allow")
86
+
87
+
88
+ class RegionStatusErrorDetail(BaseModel):
89
+ """Error detail information for region status.
90
+
91
+ Attributes:
92
+ step: The step where the error occurred
93
+ reason: The reason for the error
94
+ """
95
+
96
+ step: str = Field(..., description="The step where the error occurred.")
97
+ reason: str = Field(..., description="The reason for the error.")
98
+
99
+ # Allow extra fields
100
+ model_config = ConfigDict(extra="allow")
101
+
102
+
103
+ class RegionStatus(BaseModel):
104
+ """Region Status information for a single region.
105
+
106
+ Attributes:
107
+ discovery_status (Optional[str]): Discovery status of the region (e.g., "COMPLETED", "PENDING", "STARTED").
108
+ error (Optional[List[RegionStatusErrorDetail]]): List of error details if the region connection has encountered issues.
109
+ region_code (str): Code identifying the region (e.g., "us-east-1", "eu-west-1", "ap-south-1").
110
+ status (str): Operational status of the region (e.g., "CONNECTED", "DISCONNECTED", "ACTIVE").
111
+ """
112
+
113
+ discovery_status: Optional[str] = Field(alias="DiscoveryStatus", default=None)
114
+ error: Optional[List[RegionStatusErrorDetail]] = Field(alias="Error", default=None)
115
+ region_code: str = Field(alias="RegionCode")
116
+ status: str = Field(alias="Status")
117
+
118
+ # Allow extra fields
119
+ model_config = ConfigDict(extra="allow")
120
+
121
+
122
+ class ListRegionStatusOutput(BaseModel):
123
+ """Output model for list Region Status API.
124
+
125
+ Attributes:
126
+ region_status (List[RegionStatus]): List of Region Status for an AWS account.
127
+ """
128
+
129
+ region_status: List[RegionStatus] = Field(alias="RegionStatus", default=[])
130
+
131
+ # Allow extra fields
132
+ model_config = ConfigDict(extra="allow")
@@ -631,3 +631,55 @@ class GenerateAssessmentReportOutput(BaseModel):
631
631
 
632
632
  # Allow extra fields
633
633
  model_config = ConfigDict(extra="allow", populate_by_name=True)
634
+
635
+
636
+ class AssessmentListItem(BaseModel):
637
+ """Details of an assessment.
638
+
639
+ Attributes:
640
+ tenant_id: ID of the tenant
641
+ id: Unique identifier for the assessment
642
+ assessment_name: Name of the assessment
643
+ assessment_arn: ARN of the assessment
644
+ description: Description of the assessment
645
+ status: Current status of the assessment
646
+ lenses: List of lenses associated with the assessment
647
+ total_questions: Total number of questions in the assessment
648
+ answered_questions: Number of questions answered in the assessment
649
+ last_run_at: Timestamp for when the assessment was last run
650
+ created_at: Timestamp when the assessment was created
651
+ updated_at: Timestamp when the assessment was last updated
652
+ """
653
+
654
+ tenant_id: str = Field(alias="TenantId")
655
+ id: str = Field(alias="AssessmentId")
656
+ assessment_name: str = Field(alias="AssessmentName")
657
+ assessment_arn: str = Field(alias="AssessmentArn")
658
+ description: str = Field(alias="Description")
659
+ status: str = Field(alias="Status")
660
+ lenses: List[str] = Field(alias="Lenses")
661
+ total_questions: int = Field(alias="TotalQuestions")
662
+ answered_questions: int = Field(alias="AnsweredQuestions")
663
+ last_run_at: datetime = Field(alias="LastRunAt")
664
+ created_at: datetime = Field(alias="CreatedAt")
665
+ updated_at: datetime = Field(alias="UpdatedAt")
666
+
667
+ # Allow extra fields
668
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
669
+
670
+
671
+ class ListAssessmentsAcrossTenantsOutput(BaseModel):
672
+ """Output of list assessments across tenants operation.
673
+
674
+ Attributes:
675
+ page_number: Current page number
676
+ has_more: Indicates if there are more pages of results
677
+ assessments: List of assessments across tenants
678
+ """
679
+
680
+ page_number: int = Field(alias="PageNumber")
681
+ has_more: bool = Field(alias="HasMore")
682
+ assessments: List[AssessmentListItem] = Field(alias="Assessments")
683
+
684
+ # Allow extra fields
685
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
@@ -0,0 +1,156 @@
1
+ """Project models for the MontyCloud DAY2 SDK."""
2
+
3
+ from typing import List, Optional
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+
8
+ class AccountRegion(BaseModel):
9
+ """Region information for an account.
10
+
11
+ Attributes:
12
+ region_code: Region location code
13
+ status: Status of region
14
+ """
15
+
16
+ region_code: str = Field(alias="RegionCode")
17
+ status: str = Field(alias="Status")
18
+
19
+ # Allow extra fields
20
+ model_config = ConfigDict(extra="allow")
21
+
22
+
23
+ class AccountItem(BaseModel):
24
+ """Account information within a project.
25
+
26
+ Attributes:
27
+ account_name: Name of account
28
+ account_number: Account number
29
+ account_id: Unique identifier for account
30
+ status: Connection status of account
31
+ regions: List of regions for this account
32
+ """
33
+
34
+ account_name: str = Field(alias="AccountName")
35
+ account_number: str = Field(alias="AccountNumber")
36
+ account_id: str = Field(alias="AccountId")
37
+ status: Optional[str] = Field(None, alias="Status")
38
+ regions: List[AccountRegion] = Field(default=[], alias="Regions")
39
+
40
+ # Allow extra fields
41
+ model_config = ConfigDict(extra="allow")
42
+
43
+
44
+ class ProjectMetadata(BaseModel):
45
+ """Metadata information for a project.
46
+
47
+ Attributes:
48
+ budget_exist: Boolean value if budget exists
49
+ budget_value: Amount of budget
50
+ group_name: Department/category account belongs to
51
+ owner: Owner name
52
+ point_person: Point of contact
53
+ """
54
+
55
+ budget_exist: Optional[bool] = Field(None, alias="BudgetExist")
56
+ budget_value: Optional[int] = Field(None, alias="BudgetValue")
57
+ group_name: Optional[str] = Field(None, alias="GroupName")
58
+ owner: Optional[str] = Field(None, alias="Owner")
59
+ point_person: Optional[str] = Field(None, alias="PointPerson")
60
+
61
+ # Allow extra fields
62
+ model_config = ConfigDict(extra="allow")
63
+
64
+
65
+ class ProjectItem(BaseModel):
66
+ """Project item in a list response.
67
+
68
+ Attributes:
69
+ project_id: Unique identifier for the project
70
+ name: Name of project
71
+ description: Description of project
72
+ accounts: List of accounts associated with project
73
+ environments: Number of environments
74
+ created_by: User who created the project
75
+ created_on: Creation datetime
76
+ modified_by: Modified by username
77
+ modified_on: Modification datetime
78
+ metadata: Project metadata including budget and ownership info
79
+ users: Number of users linked
80
+ """
81
+
82
+ project_id: str = Field(alias="ProjectId")
83
+ name: str = Field(alias="Name")
84
+ description: Optional[str] = Field(None, alias="Description")
85
+ accounts: List[AccountItem] = Field(default=[], alias="Accounts")
86
+ environments: Optional[int] = Field(None, alias="Environments")
87
+ created_by: Optional[str] = Field(None, alias="CreatedBy")
88
+ created_on: Optional[str] = Field(None, alias="CreatedOn")
89
+ modified_by: Optional[str] = Field(None, alias="ModifiedBy")
90
+ modified_on: Optional[str] = Field(None, alias="ModifiedOn")
91
+ metadata: Optional[ProjectMetadata] = Field(None, alias="Metadata")
92
+ users: Optional[int] = Field(None, alias="Users")
93
+
94
+ # Allow extra fields
95
+ model_config = ConfigDict(extra="allow")
96
+
97
+
98
+ class ListProjectsOutput(BaseModel):
99
+ """Output of list_projects operation.
100
+
101
+ Attributes:
102
+ projects: List of project details
103
+ """
104
+
105
+ projects: List[ProjectItem] = Field(default=[], alias="Projects")
106
+
107
+ # Allow extra fields
108
+ model_config = ConfigDict(extra="allow")
109
+
110
+
111
+ class ProjectRequestItem(BaseModel):
112
+ """Project request item in a list response.
113
+
114
+ Attributes:
115
+ request_id: Unique identifier for the project request
116
+ name: Name of project request
117
+ description: Description of project request
118
+ status: Status of the project request (e.g. PENDING/INACTIVE)
119
+ status_change_message: Message associated with status change
120
+ status_changed_by: User who changed the status
121
+ created_at: Creation datetime
122
+ created_by: User who created the request
123
+ modified_at: Modification datetime
124
+ modified_by: User who modified the request
125
+ metadata: Project metadata including budget and ownership info
126
+ """
127
+
128
+ request_id: str = Field(alias="RequestId")
129
+ name: str = Field(alias="Name")
130
+ description: Optional[str] = Field(None, alias="Description")
131
+ status: Optional[str] = Field(None, alias="Status")
132
+ status_change_message: Optional[str] = Field(None, alias="StatusChangeMessage")
133
+ status_changed_by: Optional[str] = Field(None, alias="StatusChangedBy")
134
+ created_at: Optional[str] = Field(None, alias="CreatedAt")
135
+ created_by: Optional[str] = Field(None, alias="CreatedBy")
136
+ modified_at: Optional[str] = Field(None, alias="ModifiedAt")
137
+ modified_by: Optional[str] = Field(None, alias="ModifiedBy")
138
+ metadata: Optional[ProjectMetadata] = Field(None, alias="Metadata")
139
+
140
+ # Allow extra fields
141
+ model_config = ConfigDict(extra="allow")
142
+
143
+
144
+ class ListProjectRequestsOutput(BaseModel):
145
+ """Output of list_project_requests operation.
146
+
147
+ Attributes:
148
+ project_requests: List of project request details
149
+ """
150
+
151
+ project_requests: List[ProjectRequestItem] = Field(
152
+ default=[], alias="ProjectRequests"
153
+ )
154
+
155
+ # Allow extra fields
156
+ model_config = ConfigDict(extra="allow")
@@ -0,0 +1,43 @@
1
+ """Role models for the MontyCloud SDK."""
2
+
3
+ from typing import List
4
+
5
+ from pydantic import BaseModel, ConfigDict, Field
6
+
7
+
8
+ class RoleModel(BaseModel):
9
+ """Details of a role.
10
+
11
+ Attributes:
12
+ description: Detailed description of the role and the permissions it grants
13
+ id: Unique identifier for the role
14
+ name: Name of the role
15
+ """
16
+
17
+ description: str = Field(
18
+ ...,
19
+ alias="Description",
20
+ description="Detailed description of the role and the permissions it grants",
21
+ )
22
+ id: str = Field(..., alias="ID", description="Unique identifier for the role")
23
+ name: str = Field(..., alias="Name", description="Name of the role")
24
+
25
+ # Allow extra fields
26
+ model_config = ConfigDict(extra="allow")
27
+
28
+
29
+ class ListRolesOutput(BaseModel):
30
+ """Output model for list roles API.
31
+
32
+ Attributes:
33
+ role: List all available roles that can be assigned to the users
34
+ """
35
+
36
+ roles: List[RoleModel] = Field(
37
+ default=[],
38
+ alias="Roles",
39
+ description="List all available roles that can be assigned to the users",
40
+ )
41
+
42
+ # Allow extra fields
43
+ model_config = ConfigDict(extra="allow")
@@ -5,8 +5,10 @@ from day2.resources.assessment import AssessmentClient
5
5
  from day2.resources.azure_account import AzureAccountClient
6
6
  from day2.resources.bot import BotClient
7
7
  from day2.resources.cost import CostClient
8
+ from day2.resources.project import ProjectClient
8
9
  from day2.resources.report import ReportClient
9
10
  from day2.resources.resource import ResourceClient
11
+ from day2.resources.role import AuthorizationClient
10
12
  from day2.resources.tenant import TenantClient
11
13
 
12
14
  __all__ = [
@@ -18,4 +20,6 @@ __all__ = [
18
20
  "ReportClient",
19
21
  "BotClient",
20
22
  "ResourceClient",
23
+ "ProjectClient",
24
+ "AuthorizationClient",
21
25
  ]
@@ -7,6 +7,7 @@ from day2.models.account import (
7
7
  GenerateOnboardingTemplateInput,
8
8
  GenerateOnboardingTemplateOutput,
9
9
  ListAccountsOutput,
10
+ ListRegionStatusOutput,
10
11
  )
11
12
  from day2.session import Session
12
13
 
@@ -99,3 +100,34 @@ class AccountClient(BaseClient):
99
100
  "GET", f"tenants/{tenant_id}/accounts", params=params
100
101
  )
101
102
  return ListAccountsOutput.model_validate(response)
103
+
104
+ def list_region_status(
105
+ self, tenant_id: str, account_id: str
106
+ ) -> ListRegionStatusOutput:
107
+ """List Region Status for an AWS account.
108
+
109
+ Args:
110
+ tenant_id: ID of the tenant.
111
+ account_id: ID of the account.
112
+
113
+ Returns:
114
+ ListRegionStatusOutput: Object containing list of region statuses.
115
+
116
+ Raises:
117
+ ClientError: If the request is invalid.
118
+ ServerError: If an internal server error occurs.
119
+ AuthenticationError: If authentication fails.
120
+
121
+ Examples:
122
+ >>> session = Session(api_key="your-api-key", api_secret_key="your-secret-key")
123
+ >>> client = session.account
124
+ >>> response = client.list_region_status(tenant_id="your-tenant-id", account_id="your-account-id")
125
+ >>> for region in response.region_status:
126
+ ... print(f"Region: {region.region_code}")
127
+ ... print(f" Status: {region.status}")
128
+ ... print(f" Discovery Status: {region.discovery_status}")
129
+ """
130
+ response = self._make_request(
131
+ "GET", f"tenants/{tenant_id}/accounts/{account_id}/region-status"
132
+ )
133
+ return ListRegionStatusOutput.model_validate(response)
@@ -12,6 +12,7 @@ from day2.models.assessment import (
12
12
  GenerateAssessmentReportOutput,
13
13
  GetAssessmentOutput,
14
14
  GetQuestionOutput,
15
+ ListAssessmentsAcrossTenantsOutput,
15
16
  ListAssessmentsOutput,
16
17
  ListFindingsOutput,
17
18
  ListQuestionsOutput,
@@ -529,3 +530,70 @@ class AssessmentClient(BaseClient):
529
530
 
530
531
  # Validate and return the output model
531
532
  return GenerateAssessmentReportOutput.model_validate(response)
533
+
534
+ def list_assessments_across_tenants(
535
+ self,
536
+ tenant_ids: Optional[List[str]] = None,
537
+ last_run_after: Optional[str] = None,
538
+ page_size: int = 10,
539
+ page_number: int = 1,
540
+ ) -> ListAssessmentsAcrossTenantsOutput:
541
+ """List assessments across all accessible tenants - with the option to filter by specific tenants or by the date an assessment was last run.
542
+
543
+ !!! info "Access Requirement"
544
+ This operation is available only to Business Admin users and returns assessments only from the tenants they have access to.
545
+
546
+ Args:
547
+ tenant_ids: Optional list of tenant IDs to filter assessments by specific tenants. Maximum 5 tenant IDs allowed.
548
+ If not provided, returns assessments from all accessible tenants.
549
+ last_run_after: Optional timestamp to filter assessments that were last run after this time.
550
+ Format: ISO 8601 timestamp (e.g., "2023-12-01T00:00:00Z"). If not provided, returns all assessments.
551
+ page_size: Number of assessments per page.
552
+ page_number: Page number for pagination.
553
+
554
+ Returns:
555
+ ListAssessmentsAcrossTenantsOutput: Object containing list of assessments across tenants and pagination info.
556
+
557
+ Raises:
558
+ ClientError: If the request is invalid.
559
+ ServerError: If an internal server error occurs.
560
+ AuthenticationError: If authentication fails.
561
+
562
+ Examples:
563
+ >>> session = Session(api_key="your-api-key", api_secret_key="your-secret-key")
564
+ >>> client = session.assessment
565
+ >>> # List assessments across tenants with default pagination:
566
+ >>> response = client.list_assessments_across_tenants()
567
+ >>> for assessment in response.assessments:
568
+ ... print(f"{assessment.tenant_id}: {assessment.assessment_name}")
569
+ >>> # Filter by specific tenants:
570
+ >>> response = client.list_assessments_across_tenants(
571
+ ... tenant_ids=["tenant-1", "tenant-2"]
572
+ ... )
573
+ >>> # Filter assessments with last_run_after:
574
+ >>> response = client.list_assessments_across_tenants(
575
+ ... last_run_after="2023-12-01T00:00:00Z"
576
+ ... )
577
+ >>> # With multiple filters and pagination:
578
+ >>> response = client.list_assessments_across_tenants(
579
+ ... tenant_ids=["tenant-1", "tenant-2", "tenant-3"],
580
+ ... last_run_after="2023-12-01T00:00:00Z",
581
+ ... page_size=20,
582
+ ... page_number=2
583
+ ... )
584
+ """
585
+ params: Dict[str, Union[str, int, List[str]]] = {
586
+ "PageSize": page_size,
587
+ "PageNumber": page_number,
588
+ }
589
+
590
+ # Only include LastRunAfter if it's provided
591
+ if last_run_after is not None:
592
+ params["LastRunAfter"] = last_run_after
593
+
594
+ # Only include TenantIds if it's provided
595
+ if tenant_ids is not None:
596
+ params["TenantIds"] = tenant_ids
597
+
598
+ response = self._make_request("GET", "assessments", params=params)
599
+ return ListAssessmentsAcrossTenantsOutput.model_validate(response)
@@ -0,0 +1,89 @@
1
+ """Project resource implementation for the MontyCloud DAY2 SDK."""
2
+
3
+ from typing import Optional
4
+
5
+ from day2.client.base import BaseClient
6
+ from day2.models.project import ListProjectRequestsOutput, ListProjectsOutput
7
+ from day2.session import Session
8
+
9
+
10
+ class ProjectClient(BaseClient):
11
+ """Client for interacting with Projects."""
12
+
13
+ def __init__(self, session: Session) -> None:
14
+ """Initialize a new ProjectClient.
15
+
16
+ Args:
17
+ session: MontyCloud session.
18
+ """
19
+ super().__init__(session, "project")
20
+
21
+ def list_projects(
22
+ self,
23
+ tenant_id: str,
24
+ ) -> ListProjectsOutput:
25
+ """List all projects for a tenant.
26
+
27
+ Args:
28
+ tenant_id: Tenant ID to list projects for.
29
+
30
+ Returns:
31
+ ListProjectsOutput: Object containing list of projects.
32
+
33
+ Raises:
34
+ ClientError: If the request is invalid.
35
+ ServerError: If an internal server error occurs.
36
+ AuthenticationError: If authentication fails.
37
+
38
+ Examples:
39
+ >>> session = Session(api_key="your-api-key", api_secret_key="your-secret-key")
40
+ >>> client = session.project
41
+ >>> response = client.list_projects(tenant_id="tenant-123")
42
+ >>> for project in response.projects:
43
+ ... print(f"Project ID: {project.project_id}")
44
+ ... print(f" Project Name: {project.name}")
45
+
46
+ """
47
+ response = self._make_request("GET", f"tenants/{tenant_id}/projects")
48
+ return ListProjectsOutput.model_validate(response)
49
+
50
+ def list_project_requests(
51
+ self,
52
+ tenant_id: str,
53
+ status: Optional[str] = None,
54
+ ) -> ListProjectRequestsOutput:
55
+ """List all project requests for a tenant.
56
+
57
+ Args:
58
+ tenant_id: Tenant ID to list project requests for.
59
+ status: Optional status filter (e.g., "PENDING", "INACTIVE").
60
+
61
+ Returns:
62
+ ListProjectRequestsOutput: Object containing list of project
63
+ requests.
64
+
65
+ Raises:
66
+ ClientError: If the request is invalid.
67
+ ServerError: If an internal server error occurs.
68
+ AuthenticationError: If authentication fails.
69
+
70
+ Examples:
71
+ >>> session = Session(api_key="your-api-key", api_secret_key="your-secret-key")
72
+ >>> client = session.project
73
+ >>> response = client.list_project_requests(tenant_id="tenant-123")
74
+ >>> for request in response.project_requests:
75
+ ... print(f"Request ID: {request.request_id}")
76
+ ... print(f" Name: {request.name}")
77
+ ... print(f" Status: {request.status}")
78
+ >>> # Filter by status
79
+ >>> response = client.list_project_requests(tenant_id="tenant-123", status="PENDING")
80
+ """
81
+ # Build query parameters
82
+ params = {}
83
+ if status:
84
+ params["Status"] = status
85
+
86
+ response = self._make_request(
87
+ "GET", f"tenants/{tenant_id}/projects/requests", params=params
88
+ )
89
+ return ListProjectRequestsOutput.model_validate(response)
@@ -0,0 +1,41 @@
1
+ """Role resource implementation for the MontyCloud DAY2 SDK."""
2
+
3
+ from day2.client.base import BaseClient
4
+ from day2.models.role import ListRolesOutput
5
+ from day2.session import Session
6
+
7
+
8
+ class AuthorizationClient(BaseClient):
9
+ """Client for interacting with Role."""
10
+
11
+ def __init__(self, session: Session) -> None:
12
+ """Initialize a new AuthorizationClient.
13
+
14
+ Args:
15
+ session: MontyCloud session.
16
+ """
17
+ super().__init__(session, "role")
18
+
19
+ def list_roles(self) -> ListRolesOutput:
20
+ """List all available roles.
21
+ This endpoint retrieves the list of roles that can be assigned to the users.
22
+
23
+ Returns:
24
+ ListRolesOutput: Object containing list of roles.
25
+
26
+ Raises:
27
+ ClientError: If the request is invalid.
28
+ ServerError: If an internal server error occurs.
29
+ AuthenticationError: If authentication fails.
30
+
31
+ Examples:
32
+ >>> session = Session(api_key="your-api-key", api_secret_key="your-secret-key")
33
+ >>> client = session.authorization
34
+ >>> response = client.list_roles()
35
+ >>> for role in response.roles:
36
+ ... print(f"Role ID: {role.id}")
37
+ ... print(f" Name: {role.name}")
38
+ ... print(f" Description: {role.description}")
39
+ """
40
+ response = self._make_request("GET", "roles")
41
+ return ListRolesOutput.model_validate(response)