From 3af0f8994ac2a305263743bf42bbf72868713bf0 Mon Sep 17 00:00:00 2001 From: pranjal Date: Tue, 19 Nov 2024 17:04:34 +0530 Subject: [PATCH] updated python client --- onelens_backend_client_v2/models.py | 929 ++++++++++++++- onelens_backend_client_v2/rpc/__init__.py | 20 + .../rpc/feature_service_rpc_handler.py | 8 +- .../metrics_control_service_rpc_handler.py | 522 +++++++++ ...navira_conversation_service_rpc_handler.py | 1033 +++++++++++++++++ .../tenant_connection_service_rpc_handler.py | 127 ++ ...tenant_ticket_audit_service_rpc_handler.py | 144 +++ .../rpc/tenant_ticket_service_rpc_handler.py | 127 ++ ...ket_status_metadata_service_rpc_handler.py | 398 +++++++ 9 files changed, 3290 insertions(+), 18 deletions(-) create mode 100644 onelens_backend_client_v2/rpc/metrics_control_service_rpc_handler.py create mode 100644 onelens_backend_client_v2/rpc/navira_conversation_service_rpc_handler.py create mode 100644 onelens_backend_client_v2/rpc/tenant_ticket_audit_service_rpc_handler.py create mode 100644 onelens_backend_client_v2/rpc/ticket_status_metadata_service_rpc_handler.py diff --git a/onelens_backend_client_v2/models.py b/onelens_backend_client_v2/models.py index 824f91a6..7ec9a00c 100644 --- a/onelens_backend_client_v2/models.py +++ b/onelens_backend_client_v2/models.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: -# timestamp: 2024-11-11T13:54:11+00:00 +# timestamp: 2024-11-19T11:33:12+00:00 from __future__ import annotations @@ -21,10 +21,22 @@ ) +class APIEnableMetricsResponse(BaseModel): + success: Optional[bool] = Field( + None, description="Whether the operation was successful", title="Success" + ) + + class APIUpdateFeatureStatusEnabledRequest(BaseModel): id: UUID4 = Field(..., title="Id") +class APIUpdateMetricsControlResponse(BaseModel): + success: Optional[bool] = Field( + None, description="Whether the operation was successful", title="Success" + ) + + class ActivatePolicyTemplateRequest(BaseModel): id: UUID4 = Field( ..., description="The unique identifier of the policy template.", title="Id" @@ -35,6 +47,24 @@ class ActivatePolicyTemplateResponse(BaseModel): pass +class ActivityLogFormat(BaseModel): + title: str = Field( + ..., + description="Dynamic title for the activity log entry. Example: 'Ticket closed due to modification'", + title="Title", + ) + note: Optional[str] = Field( + None, + description="Optional note providing additional context about the activity", + title="Note", + ) + + +class AgentType(str, Enum): + TEST_WORKFLOW = "TEST_WORKFLOW" + HIERARCHY_WORKFLOW = "HIERARCHY_WORKFLOW" + + class AndItem(BaseModel): gte: Optional[List] = Field(None, title="Gte") gt: Optional[List] = Field(None, title="Gt") @@ -130,6 +160,13 @@ class Auth0UserConnection(str, Enum): Username_Password_Authentication = "Username-Password-Authentication" +class AuthorRole(str, Enum): + USER = "USER" + ASSISTANT = "ASSISTANT" + SYSTEM = "SYSTEM" + TOOL = "TOOL" + + class AwsService(str, Enum): aws_ec2 = "aws_ec2" aws_ebs = "aws_ebs" @@ -483,6 +520,7 @@ class ConnectionStatus(str, Enum): class ConnectionType(str, Enum): MAIN = "MAIN" REPLICA = "REPLICA" + CLICKHOUSE = "CLICKHOUSE" class CostAnalyzerGraphRequest(BaseModel): @@ -703,6 +741,21 @@ class CreateTenantTicketsResponse(BaseModel): pass +class CreateThreadRequest(BaseModel): + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + name: Optional[str] = Field( + None, description="Optional name for the thread", title="Name" + ) + agent_type: AgentType = Field(..., description="Type of the workflow") + user_id: Optional[UUID4] = Field( + None, + description="Unique identifier of the user, required if agent_type is not provided to create a new thread for the user", + title="User Id", + ) + + class CreateUserTenantMappingRequest(BaseModel): user_id: UUID4 = Field( ..., description="Unique identifier for the user in onelens.", title="User Id" @@ -886,6 +939,15 @@ class FeatureConfig(BaseModel): None, title="Enable Metrics For Days" ) threshold_percentage: Optional[int] = Field(None, title="Threshold Percentage") + look_back_days_for_metrics: Optional[int] = Field( + None, title="Look Back Days For Metrics" + ) + minimum_data_points_for_metrics: Optional[int] = Field( + None, title="Minimum Data Points For Metrics" + ) + reactivate_disabled_metrics_after_days: Optional[int] = Field( + None, title="Reactivate Disabled Metrics After Days" + ) class FeatureStore(BaseModel): @@ -920,6 +982,18 @@ class GenerationStatus(str, Enum): AMBIGUOUS_QUERY = "AMBIGUOUS_QUERY" +class GetAgentTypesRequest(BaseModel): + pass + + +class GetAgentTypesResponse(BaseModel): + agent_types: List[AgentType] = Field( + ..., + description="List of agent types available for the context", + title="Agent Types", + ) + + class GetAllFeaturesRequest(BaseModel): pass @@ -933,6 +1007,20 @@ class GetAllParentNodesRequest(BaseModel): ) +class GetAllTenantConnectionsRequest(BaseModel): + connection_type: ConnectionType = Field(..., description="Type of the connection") + + +class GetAllThreadsFilters(BaseModel): + user_ids: Optional[List[UUID4]] = Field( + None, description="Unique identifiers of the users", title="User Ids" + ) + agent_types: Optional[List[AgentType]] = Field( + None, description="Types of the workflows", title="Agent Types" + ) + name: Optional[str] = Field(None, description="Name of the thread", title="Name") + + class GetCURDataMetricsConfigAPIRequest(BaseModel): resource_id: UUID = Field(..., title="Resource Id") @@ -981,6 +1069,16 @@ class GetHierarchyNodeMetricsRequest(BaseModel): ) +class GetMessagesRequest(BaseModel): + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + thread_id: UUID4 = Field( + ..., description="Unique identifier of the thread", title="Thread Id" + ) + agent_type: AgentType = Field(..., description="Type of the workflow") + + class GetPolicyTemplateByAliasRequest(BaseModel): alias: str = Field( ..., description="The alias of the policy template.", title="Alias" @@ -1018,6 +1116,25 @@ class GetPolicyTicketsExportToResponseType(BaseModel): ) +class GetPolicyTicketsForNotificationRequest(BaseModel): + tenant_id: UUID4 = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + ticket_ids: Optional[List[UUID]] = Field( + [], description="List of ticket ids", title="Ticket Ids" + ) + can_get_org_cost_center: Optional[bool] = Field( + False, + description="Flag to check if the org cost center can be fetched", + title="Can Get Org Cost Center", + ) + get_only_ticket_data: Optional[bool] = Field( + False, + description="Flag to check if the ticket data can be fetched", + title="Get Only Ticket Data", + ) + + class GetRecommendationTicketRequest(BaseModel): ticket_id: UUID4 = Field(..., description="Ticket ID", title="Ticket Id") tenant_id: UUID4 = Field( @@ -1076,6 +1193,31 @@ class GetResourceIdsListForNodeIdsResponse(BaseModel): ) +class GetSinglePolicyTicketForNotificationResponse(BaseModel): + ticket: Dict[str, Any] = Field(..., title="Ticket") + resource: Optional[Dict[str, Any]] = Field( + None, description="Resource data of the ticket", title="Resource" + ) + policy: Optional[Dict[str, Any]] = Field( + None, description="Policy data of the ticket", title="Policy" + ) + recommendation: Optional[Dict[str, Any]] = Field( + None, description="Recommendation data of the ticket", title="Recommendation" + ) + cost: Optional[Dict[str, Any]] = Field( + None, description="Cost data of the ticket", title="Cost" + ) + resource_cost_center: Optional[List[UUID]] = Field( + None, description="List of cost center ids", title="Resource Cost Center" + ) + anomaly_cost: Optional[Dict[str, Any]] = Field( + None, description="Anomaly cost impact of the ticket", title="Anomaly Cost" + ) + org_cost_center: Optional[Dict[str, Any]] = Field( + None, description="List of cost center ids", title="Org Cost Center" + ) + + class GetSinglePolicyViolationsResponse(BaseModel): policy_id: UUID = Field( ..., description="The unique identifier of the policy", title="Policy Id" @@ -1099,6 +1241,40 @@ class GetSinglePolicyViolationsResponse(BaseModel): ) +class GetSingleTenantTicketAuditResponse(BaseModel): + trigger_id: UUID4 = Field( + ..., description="The unique identifier of the trigger", title="Trigger Id" + ) + ticket_id: UUID4 = Field( + ..., description="The unique identifier of the ticket", title="Ticket Id" + ) + created_at: datetime = Field( + ..., description="Creation datetime of the ticket", title="Created At" + ) + id: UUID4 = Field(..., description="The unique identifier of the audit", title="Id") + op: str = Field(..., description="The operation performed", title="Op") + record: Dict[str, Any] = Field(..., description="The new record", title="Record") + old_record: Dict[str, Any] = Field( + ..., description="The old record", title="Old Record" + ) + + +class GetStateRequest(BaseModel): + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + thread_id: UUID4 = Field( + ..., description="Unique identifier of the thread", title="Thread Id" + ) + agent_type: AgentType = Field(..., description="Type of the workflow") + + +class GetStateResponse(BaseModel): + output_state: Dict[str, Any] = Field( + ..., description="Current state of the agent", title="Output State" + ) + + class GetTenantByIDRequest(BaseModel): id: UUID4 = Field(..., description="Unique identifier for the tenant", title="Id") @@ -1180,6 +1356,15 @@ class GetTenantUserByIDRequest(BaseModel): ) +class GetThreadByIdRequest(BaseModel): + thread_id: UUID4 = Field( + ..., description="Unique identifier of the thread", title="Thread Id" + ) + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + + class GetTicketByIdPolicyDetailsRequest(BaseModel): tenant_id: UUID4 = Field( ..., description="The unique identifier of the tenant", title="Tenant Id" @@ -1274,6 +1459,13 @@ class LastRunAtUpdateItem(BaseModel): ) +class LinkDetails(BaseModel): + link: str = Field(..., description="The link URL", title="Link") + linkText: str = Field( + ..., description="The text to display for the link", title="Linktext" + ) + + class MarkViewAsDefaultRequest(BaseModel): id: UUID4 = Field( ..., description="Unique identifier for the saved view", title="Id" @@ -1290,6 +1482,32 @@ class MarkViewAsDefaultResponse(BaseModel): pass +class MessageAuthor(BaseModel): + user_id: Optional[UUID4] = Field( + None, description="Unique identifier of the user", title="User Id" + ) + role: AuthorRole = Field(..., description="Role of the author (USER or ASSISTANT)") + + +class MessagePartType(str, Enum): + TEXT = "TEXT" + TOOL_REQUEST = "TOOL_REQUEST" + TOOL_RESPONSE = "TOOL_RESPONSE" + SQL = "SQL" + + +class MetricFeatureTheme(str, Enum): + METRICS_ENABLED = "METRICS_ENABLED" + MEMORY_METRICS_NOT_ENABLED = "MEMORY_METRICS_NOT_ENABLED" + METRICS_INTEGRATION_ENABLED = "METRICS_INTEGRATION_ENABLED" + METRICS_STOPPED = "METRICS_STOPPED" + METRICS_FETCH_ERROR = "METRICS_FETCH_ERROR" + + +class MetricName(str, Enum): + mem_used_percent = "mem_used_percent" + + class MetricsAggregationType(str, Enum): p99_maximum = "p99_maximum" p95_maximum = "p95_maximum" @@ -1306,6 +1524,28 @@ class MetricsAggregationType(str, Enum): minimum = "minimum" +class MetricsControlStatus(str, Enum): + REQUESTED = "REQUESTED" + ENABLED = "ENABLED" + DISABLED = "DISABLED" + ABORTED = "ABORTED" + APPROVED = "APPROVED" + CANCELLED = "CANCELLED" + COMPLETED = "COMPLETED" + FAILED = "FAILED" + INPROGRESS = "INPROGRESS" + PENDING = "PENDING" + PROCESSING = "PROCESSING" + RUNBOOKINPROGRESS = "RUNBOOKINPROGRESS" + RUNNING = "RUNNING" + SCHEDULED = "SCHEDULED" + SUBMITTED_TO_CUSTOMER = "SUBMITTED_TO_CUSTOMER" + SUCCEEDED = "SUCCEEDED" + SUCCESS = "SUCCESS" + TERMINATED = "TERMINATED" + TIMED_OUT = "TIMED_OUT" + + class MetricsValueUnit(BaseModel): value: int = Field(..., description="The value of the metric.", title="Value") unit: Optional[str] = Field( @@ -2479,6 +2719,15 @@ class TenantState(str, Enum): INACTIVE = "INACTIVE" +class TenantTicketAuditFilters(BaseModel): + trigger_ids: Optional[List[UUID]] = Field( + None, description="The unique identifier of the trigger", title="Trigger Ids" + ) + ticket_ids: Optional[List[UUID]] = Field( + None, description="List of ticket ids", title="Ticket Ids" + ) + + class TenantTicketsStatsMetrics(str, Enum): SUM_SAVINGS = "SUM_SAVINGS" DISTINCT_ENTITY_COUNT = "DISTINCT_ENTITY_COUNT" @@ -2522,6 +2771,45 @@ class TenantVerifyResponse(BaseModel): accounts: Dict[str, Any] = Field(..., description="accounts", title="Accounts") +class TenantsList(BaseModel): + tenant_id: UUID4 = Field( + ..., description="Unique identifier for the tenant", title="Tenant Id" + ) + tenant_name: str = Field(..., description="Name of the tenant", title="Tenant Name") + status: str = Field(..., description="Status of the tenant", title="Status") + short_id: str = Field(..., description="Short id of the tenant", title="Short Id") + account_count: Optional[int] = Field( + None, description="Account count of the tenant", title="Account Count" + ) + region: str = Field(..., description="Region of the tenant", title="Region") + timezone: str = Field(..., description="Timezone of the tenant", title="Timezone") + created_at: Optional[datetime] = Field( + ..., description="Created at of the tenant", title="Created At" + ) + + +class Thread(BaseModel): + id: Optional[UUID4] = Field( + None, description="Unique identifier of the thread", title="Id" + ) + created_at: Optional[datetime] = Field( + None, description="Timestamp of thread creation", title="Created At" + ) + updated_at: Optional[datetime] = Field( + None, description="Timestamp of last thread update", title="Updated At" + ) + name: Optional[str] = Field(None, description="Name of the thread", title="Name") + user_id: Optional[UUID4] = Field( + None, + description="Unique identifier of the user associated with the thread", + title="User Id", + ) + agent_type: Optional[AgentType] = Field( + None, + description="Type of the workflow, required if user_id is not provided to create a new thread for the workflow", + ) + + class TicketAssignment(str, Enum): UNASSIGNED = "UNASSIGNED" ASSIGNED = "ASSIGNED" @@ -2671,6 +2959,23 @@ class UpdateRecommendationUnitResponse(BaseModel): ) +class UpdateStateRequest(BaseModel): + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + thread_id: UUID4 = Field( + ..., description="Unique identifier of the thread", title="Thread Id" + ) + agent_type: AgentType = Field(..., description="Type of the workflow") + input_state: Dict[str, Any] = Field( + ..., description="New state of the agent", title="Input State" + ) + + +class UpdateStateResponse(BaseModel): + pass + + class UpdateTenantEmbedAppsLinksRequest(BaseModel): tab_name: Optional[str] = Field( None, description="Name of the tab", title="Tab Name" @@ -2881,6 +3186,70 @@ class UpdateTenantTicketResponse(BaseModel): pass +class UpdateTenantTicketStatusMetadataRequest(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: Optional[str] = Field( + None, description="Display name for the status", title="Display Name" + ) + activity_log_format: Optional[ActivityLogFormat] = Field( + None, description="JSON containing title and note format templates" + ) + display_priority: Optional[int] = Field( + None, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field(None, description="State of the ticket status") + is_active: Optional[bool] = Field( + None, description="Whether the status is active", title="Is Active" + ) + updated_by: UUID4 = Field( + ..., + description="UUID of the user who last updated this status metadata", + title="Updated By", + ) + tenant_id: UUID4 = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + + +class UpdateTenantTicketStatusMetadataResponse(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: str = Field( + ..., description="Display name for the status", title="Display Name" + ) + activity_log_format: ActivityLogFormat = Field( + ..., description="JSON containing title and note format templates" + ) + display_priority: Optional[int] = Field( + 0, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field( + "OPEN", description="State of the ticket status" + ) + is_active: Optional[bool] = Field( + True, description="Whether the status is active", title="Is Active" + ) + created_by: UUID4 = Field( + ..., + description="UUID of the user who created this status metadata", + title="Created By", + ) + updated_by: UUID4 = Field( + ..., + description="UUID of the user who last updated this status metadata", + title="Updated By", + ) + created_at: datetime = Field( + ..., description="Datetime of metadata creation", title="Created At" + ) + updated_at: datetime = Field( + ..., description="Datetime of metadata updation", title="Updated At" + ) + + class UpdateTenantTicketsAPIRequest(BaseModel): updated_ticket_details: List[UpdateTenantTicketRequestMixin] = Field( ..., @@ -2959,6 +3328,21 @@ class ValidationError(BaseModel): type: str = Field(..., title="Error Type") +class ViolationAttributesDetails(BaseModel): + key: str = Field(..., description="violation attribute key", title="Key") + display_name: str = Field( + ..., description="violation attribute display name", title="Display Name" + ) + value: str = Field(..., description="violation attribute value", title="Value") + theme: str = Field(..., description="violation attribute theme", title="Theme") + status: str = Field(..., description="violation attribute status", title="Status") + tool_tip_message: str = Field( + ..., + description="violation attribute tool tip message", + title="Tool Tip Message", + ) + + class OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator(str, Enum): between = "between" contains = "contains" @@ -3104,6 +3488,32 @@ class OnelensModelsServiceInterfacesUtilitiesDataRetrieverServiceTimeDimension( ) +class APIEnableMetricsRequest(BaseModel): + resource_ids: List[UUID] = Field( + ..., + description="The unique identifiers of the resources", + min_length=1, + title="Resource Ids", + ) + metric_name: MetricName = Field(..., description="The name of the metric") + entity_id: str = Field(..., description="The entity id", title="Entity Id") + metrics_validity_period_days: int = Field( + ..., + description="Number of days the metrics collection will remain enabled", + title="Metrics Validity Period Days", + ) + look_back_days_for_metrics: int = Field( + ..., + description="Number of days to look back for metrics", + title="Look Back Days For Metrics", + ) + minimum_data_points_for_metrics: int = Field( + ..., + description="Minimum number of data points required for metrics", + title="Minimum Data Points For Metrics", + ) + + class APIGetFeaturesByFiltersRequest(BaseModel): scope: Optional[TenantFeatureScope] = Field( None, description="Scope of the feature" @@ -3119,6 +3529,33 @@ class APIGetFeaturesByFiltersRequest(BaseModel): ) +class APIMetricsControlFilter(BaseModel): + resource_ids: Optional[List[UUID]] = Field( + None, + description="The unique identifiers of the resources", + title="Resource Ids", + ) + metric_name: Optional[MetricName] = Field( + None, description="The name of the metric" + ) + status: Optional[MetricsControlStatus] = Field( + None, description="The status of the metric control" + ) + entity_id: Optional[str] = Field( + None, description="The entity id", title="Entity Id" + ) + + +class APIUpdateMetricsControlRequest(BaseModel): + resource_ids: List[UUID] = Field( + ..., description="The unique identifiers of the resources", title="Resource Ids" + ) + metric_name: MetricName = Field(..., description="The name of the metric") + status: MetricsControlStatus = Field( + ..., description="The status of the metric control" + ) + + class ActionType(BaseModel): service: Union[AwsService, GcpService] = Field( ..., description="Service AWS etc.", title="Service" @@ -3304,9 +3741,7 @@ class BulkUpdateTenantTicketsAPIRequest(BaseModel): assigned_to: Optional[str] = Field( None, description="Assignee of the ticket", title="Assigned To" ) - comment: Optional[str] = Field( - None, description="Comment of the ticket", title="Comment" - ) + note: Optional[str] = Field(None, description="Comment of the ticket", title="Note") class BulkUpdateTenantTicketsRequest(BaseModel): @@ -3322,9 +3757,7 @@ class BulkUpdateTenantTicketsRequest(BaseModel): assigned_to: Optional[str] = Field( None, description="Assignee of the ticket", title="Assigned To" ) - comment: Optional[str] = Field( - None, description="Comment of the ticket", title="Comment" - ) + note: Optional[str] = Field(None, description="Comment of the ticket", title="Note") tenant_id: UUID4 = Field( ..., description="The unique identifier of the tenant", title="Tenant Id" ) @@ -3343,9 +3776,7 @@ class BulkUpdateTenantTicketsRequestMixin(BaseModel): assigned_to: Optional[str] = Field( None, description="Assignee of the ticket", title="Assigned To" ) - comment: Optional[str] = Field( - None, description="Comment of the ticket", title="Comment" - ) + note: Optional[str] = Field(None, description="Comment of the ticket", title="Note") class BulkUpdateTenantTicketsResponse(BaseModel): @@ -3746,6 +4177,72 @@ class CreateTenantTicketRequestMixin(BaseModel): ) +class CreateTenantTicketStatusMetadataRequest(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: str = Field( + ..., description="Display name for the status", title="Display Name" + ) + activity_log_format: ActivityLogFormat = Field( + ..., description="JSON containing title and note format templates" + ) + display_priority: Optional[int] = Field( + 0, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field( + "OPEN", description="State of the ticket status" + ) + is_active: Optional[bool] = Field( + True, description="Whether the status is active", title="Is Active" + ) + created_by: UUID4 = Field( + ..., + description="UUID of the user who created this status metadata", + title="Created By", + ) + tenant_id: UUID4 = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + + +class CreateTenantTicketStatusMetadataResponse(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: str = Field( + ..., description="Display name for the status", title="Display Name" + ) + activity_log_format: ActivityLogFormat = Field( + ..., description="JSON containing title and note format templates" + ) + display_priority: Optional[int] = Field( + 0, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field( + "OPEN", description="State of the ticket status" + ) + is_active: Optional[bool] = Field( + True, description="Whether the status is active", title="Is Active" + ) + created_by: UUID4 = Field( + ..., + description="UUID of the user who created this status metadata", + title="Created By", + ) + updated_by: UUID4 = Field( + ..., + description="UUID of the user who last updated this status metadata", + title="Updated By", + ) + created_at: datetime = Field( + ..., description="Datetime of metadata creation", title="Created At" + ) + updated_at: datetime = Field( + ..., description="Datetime of metadata updation", title="Updated At" + ) + + class CreateTenantTicketsAPIRequest(BaseModel): new_ticket_details: List[CreateTenantTicketRequestMixin] = Field( ..., @@ -3913,6 +4410,10 @@ class CreateTenantUserResponse(BaseModel): id: UUID4 = Field(..., description="PK in the tenant users table", title="Id") +class CreateThreadResponse(BaseModel): + thread: Thread = Field(..., description="Newly created thread") + + class CreateUserRequest(BaseModel): auth0_id: constr(min_length=1, max_length=255) = Field( ..., description="Auth0 user identifier", title="Auth0 Id" @@ -4100,6 +4601,42 @@ class DisableTenantUserResponse(BaseModel): id: UUID4 = Field(..., description="PK in the tenant users table", title="Id") +class EnableMetricsRequest(BaseModel): + resource_ids: List[UUID] = Field( + ..., + description="The unique identifiers of the resources", + min_length=1, + title="Resource Ids", + ) + metric_name: MetricName = Field(..., description="The name of the metric") + entity_id: str = Field(..., description="The entity id", title="Entity Id") + metrics_validity_period_days: int = Field( + ..., + description="Number of days the metrics collection will remain enabled", + title="Metrics Validity Period Days", + ) + look_back_days_for_metrics: int = Field( + ..., + description="Number of days to look back for metrics", + title="Look Back Days For Metrics", + ) + minimum_data_points_for_metrics: int = Field( + ..., + description="Minimum number of data points required for metrics", + title="Minimum Data Points For Metrics", + ) + tenant_id: Optional[UUID4] = Field( + None, description="The unique identifier of the tenant", title="Tenant Id" + ) + user_id: Optional[UUID4] = Field( + None, description="The unique identifier of the user", title="User Id" + ) + user_role: Optional[UserRole] = Field(None, description="The role of the user") + node_ids: Optional[List[UUID4]] = Field( + None, description="The unique identifiers of the nodes", title="Node Ids" + ) + + class EnableTenantAnomalySettingsResponse(BaseModel): config_overrides: Optional[AnomalyLogicOperation] = Field( None, description="The config overrides for the tenant anomaly." @@ -4269,6 +4806,10 @@ class GetAllResourceCatalogsResponse(BaseModel): ) +class GetAllTenantConnectionsResponse(BaseModel): + tenant: List[GetTenantConnectionResponse] = Field(..., title="Tenant") + + class GetAllTenantEmbedAppsLinksResponse(BaseModel): pagination: PaginationFields = Field(..., description="Pagination fields.") links: List[TenantEmbedAppsLinksWithUser] = Field( @@ -4276,6 +4817,28 @@ class GetAllTenantEmbedAppsLinksResponse(BaseModel): ) +class GetAllThreadsRequest(BaseModel): + pagination: Optional[PaginationParams] = Field( + default_factory=lambda: PaginationParams.model_validate( + {"page": 1, "page_size": 10} + ), + description="Pagination parameters for the request.", + ) + tenant_id: Optional[UUID4] = Field( + None, description="Unique identifier of the tenant", title="Tenant Id" + ) + filters: Optional[GetAllThreadsFilters] = Field( + {}, description="Filters for the threads" + ) + + +class GetAllThreadsResponse(BaseModel): + pagination: PaginationFields = Field(..., description="Pagination fields.") + threads: List[Thread] = Field( + ..., description="List of threads for the tenant", title="Threads" + ) + + class GetAllUsersRequest(BaseModel): auth0_id: constr(min_length=1, max_length=255) = Field( ..., description="Auth0 user identifier", title="Auth0 Id" @@ -4303,6 +4866,22 @@ class GetCloudMetadataRequest(BaseModel): ) +class GetFeaturesByFiltersRequest(BaseModel): + scope: Optional[TenantFeatureScope] = Field( + None, description="Scope of the feature" + ) + entity_id: Optional[List[str]] = Field( + None, description="List of entity IDs for the feature", title="Entity Id" + ) + feature_name: Optional[str] = Field( + None, description="Name of the feature", title="Feature Name" + ) + is_enabled: Optional[bool] = Field( + None, description="Whether the feature is enabled", title="Is Enabled" + ) + tenant_id: UUID4 = Field(..., title="Tenant Id") + + class GetHierarchyFilters(BaseModel): state: Optional[HierarchyState] = Field( "ACTIVE", description="Filter by state(ACTIVE, INACTIVE, DRAFT)" @@ -4391,6 +4970,45 @@ class GetLeafNodesRequest(BaseModel): ) +class GetMetricsControlStatusRequest(BaseModel): + resource_ids: Optional[List[UUID]] = Field( + None, + description="The unique identifiers of the resources", + title="Resource Ids", + ) + metric_name: Optional[MetricName] = Field( + None, description="The name of the metric" + ) + status: Optional[MetricsControlStatus] = Field( + None, description="The status of the metric control" + ) + entity_id: Optional[str] = Field( + None, description="The entity id", title="Entity Id" + ) + tenant_id: Optional[UUID4] = Field( + None, description="The unique identifier of the tenant", title="Tenant Id" + ) + user_id: Optional[UUID4] = Field( + None, description="The unique identifier of the user", title="User Id" + ) + user_role: Optional[UserRole] = Field(None, description="The role of the user") + node_ids: Optional[List[UUID4]] = Field( + None, description="The unique identifiers of the nodes", title="Node Ids" + ) + + +class GetMetricsControlWebhookRequest(BaseModel): + id: UUID = Field( + ..., description="The unique identifier of the metrics control", title="Id" + ) + tenant_id: UUID = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + status: MetricsControlStatus = Field( + ..., description="The status of the change manager request" + ) + + class GetMetricsResponse(BaseModel): metrics: List[OnelensModelsServiceInterfacesTenantDataMetricsServiceMetric] = Field( ..., title="Metrics" @@ -4513,6 +5131,12 @@ class GetPolicyTicketStatsResponse(BaseModel): ) +class GetPolicyTicketsForNotificationResponse(BaseModel): + data: List[GetSinglePolicyTicketForNotificationResponse] = Field( + ..., description="List of tickets", title="Data" + ) + + class GetRecommendationTicket(BaseModel): recommendation_unit_id: str = Field( ..., description="Recommendation Unit ID", title="Recommendation Unit Id" @@ -4645,6 +5269,13 @@ class GetSinglePolicyTicketByPolicyIdResponse(BaseModel): violation_attributes: Optional[Dict[str, Any]] = Field( None, description="Attributes of the violation", title="Violation Attributes" ) + violation_attributes_details: Optional[Dict[str, ViolationAttributesDetails]] = ( + Field( + None, + description="Details of the violation attributes", + title="Violation Attributes Details", + ) + ) entity_id: Optional[UUID] = Field( None, description="The id of the resource experiencing policy violation.", @@ -4841,6 +5472,23 @@ class GetTenantPoliciesRequest(BaseModel): ) +class GetTenantTicketsAuditRequest(BaseModel): + tenant_id: UUID4 = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + filters: TenantTicketAuditFilters = Field(..., description="Filters to be applied") + pagination_params: PaginationParams = Field( + ..., description="Pagination parameters" + ) + + +class GetTenantTicketsAuditResponse(BaseModel): + data: List[GetSingleTenantTicketAuditResponse] = Field( + ..., description="List of tickets", title="Data" + ) + pagination: PaginationFields = Field(..., description="Pagination fields") + + class GetTenantUserProfileResponse(BaseModel): model_config = ConfigDict( extra="forbid", @@ -4927,12 +5575,20 @@ class GetTenantUsersWithoutUserContextResponse(BaseModel): ) +class GetTenantsListResponse(BaseModel): + tenants: List[TenantsList] = Field(..., title="Tenants") + + class GetTenantsRequest(BaseModel): filters: Optional[TenantFilters] = Field( {}, description="Filters to apply to the policy templates." ) +class GetThreadByIdResponse(BaseModel): + thread: Thread = Field(..., description="Thread with the given unique identifier") + + class GetUserByIDResponse(BaseModel): auth0_id: constr(min_length=1, max_length=255) = Field( ..., description="Auth0 user identifier", title="Auth0 Id" @@ -5087,6 +5743,11 @@ class LeafNodes(BaseModel): ) +class MessagePart(BaseModel): + type: MessagePartType = Field(..., description="Type of the message part") + value: Any = Field(..., description="Value of the message part", title="Value") + + class MetricChartFilters(BaseModel): key: str = Field( ..., description="Dynamic key-value pairs for metric filters", title="Key" @@ -5102,6 +5763,44 @@ class MetricChartFilters(BaseModel): ) +class MetricFeature(BaseModel): + metric_name: str = Field(..., description="Name of the metric", title="Metric Name") + enabled: bool = Field( + ..., description="Whether the metric is enabled", title="Enabled" + ) + status: str = Field(..., description="Status of the metric", title="Status") + title: str = Field(..., description="Title of the metric", title="Title") + description: str = Field( + ..., description="Description of the metric", title="Description" + ) + linkDetails: LinkDetails = Field(..., description="Link details for the metric") + theme: MetricFeatureTheme = Field(..., description="Theme for the metric") + + +class MetricsControlResponse(BaseModel): + resource_id: UUID = Field( + ..., description="The unique identifier of the resource", title="Resource Id" + ) + metric_name: MetricName = Field(..., description="The name of the metric") + status: MetricsControlStatus = Field( + ..., description="The status of the metric control" + ) + requested_on: datetime = Field( + ..., + description="The date and time when the metric control was requested", + title="Requested On", + ) + expires_on: datetime = Field( + ..., + description="The date and time when the metric control expires", + title="Expires On", + ) + entity_id: str = Field(..., description="The entity id", title="Entity Id") + attributes: Optional[Dict[str, Any]] = Field( + None, description="The attributes of the metric control", title="Attributes" + ) + + class MetricsLookBackPeriod(BaseModel): value_from: str = Field( ..., description="value from for the look back.", title="Value From" @@ -5548,6 +6247,11 @@ class ResponseGetTenantUserProfileResponse(BaseModel): message: Optional[str] = Field(None, title="Message") +class ResponseGetTenantsListResponse(BaseModel): + data: GetTenantsListResponse + message: Optional[str] = Field(None, title="Message") + + class ResponseGetUsersNodesCategories(BaseModel): data: GetUsersNodesCategories message: Optional[str] = Field(None, title="Message") @@ -5899,7 +6603,7 @@ class TenantTicket(BaseModel): ticket_alias: Optional[int] = Field( None, description="the numeric ticket alias of the ticket", title="Ticket Alias" ) - trigger_id: UUID = Field( + trigger_id: UUID4 = Field( ..., description="The unique identifier of the trigger that created the ticket", title="Trigger Id", @@ -5936,6 +6640,58 @@ class TenantTicketFilters(BaseModel): ) +class TenantTicketStatusMetadata(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: str = Field( + ..., description="Display name for the status", title="Display Name" + ) + activity_log_format: ActivityLogFormat = Field( + ..., description="JSON containing title and note format templates" + ) + display_priority: Optional[int] = Field( + 0, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field( + "OPEN", description="State of the ticket status" + ) + is_active: Optional[bool] = Field( + True, description="Whether the status is active", title="Is Active" + ) + created_by: UUID4 = Field( + ..., + description="UUID of the user who created this status metadata", + title="Created By", + ) + updated_by: UUID4 = Field( + ..., + description="UUID of the user who last updated this status metadata", + title="Updated By", + ) + created_at: datetime = Field( + ..., description="Datetime of metadata creation", title="Created At" + ) + updated_at: datetime = Field( + ..., description="Datetime of metadata updation", title="Updated At" + ) + + +class TenantTicketStatusMetadataApiResponse(BaseModel): + id: str = Field( + ..., description="The unique identifier of the status metadata", title="Id" + ) + display_name: str = Field( + ..., description="Display name for the status", title="Display Name" + ) + display_priority: Optional[int] = Field( + 0, description="Priority for display ordering", title="Display Priority" + ) + state: Optional[TicketState] = Field( + "OPEN", description="State of the ticket status" + ) + + class TenantTicketWithTicketAlias(BaseModel): created_at: datetime = Field( ..., description="Datetime of ticket creation", title="Created At" @@ -6005,7 +6761,7 @@ class TenantTicketWithTicketAlias(BaseModel): description="the # included ticket alias of the ticket", title="Ticket Alias", ) - trigger_id: UUID = Field( + trigger_id: UUID4 = Field( ..., description="The unique identifier of the trigger that created the ticket", title="Trigger Id", @@ -6121,7 +6877,7 @@ class UpdateHierarchyNodeAPIRequest(BaseModel): ) resource_filter_expression: Optional[constr(max_length=200)] = Field( None, - description="Resource filter expression of the node", + description="Resource filter expression of the node, needs to be provided if resource_filters not provided. For example `{1} AND {2}` where 1 and 2 are keys in resource_filters", title="Resource Filter Expression", ) is_shared: Optional[bool] = Field( @@ -6146,7 +6902,7 @@ class UpdateHierarchyNodeRequest(BaseModel): ) resource_filter_expression: Optional[constr(max_length=200)] = Field( None, - description="Resource filter expression of the node", + description="Resource filter expression of the node, needs to be provided if resource_filters not provided. For example `{1} AND {2}` where 1 and 2 are keys in resource_filters", title="Resource Filter Expression", ) is_shared: Optional[bool] = Field( @@ -6213,6 +6969,26 @@ class UpdateHierarchyNodeResponse(BaseModel): ) +class UpdateMetricsControlRequest(BaseModel): + resource_ids: List[UUID] = Field( + ..., description="The unique identifiers of the resources", title="Resource Ids" + ) + metric_name: MetricName = Field(..., description="The name of the metric") + status: MetricsControlStatus = Field( + ..., description="The status of the metric control" + ) + tenant_id: Optional[UUID4] = Field( + None, description="The unique identifier of the tenant", title="Tenant Id" + ) + user_id: Optional[UUID4] = Field( + None, description="The unique identifier of the user", title="User Id" + ) + user_role: Optional[UserRole] = Field(None, description="The role of the user") + node_ids: Optional[List[UUID4]] = Field( + None, description="The unique identifiers of the nodes", title="Node Ids" + ) + + class UpdateTenantUserBySystemRequest(BaseModel): last_login: Optional[datetime] = Field( None, description="Last login of the user", title="Last Login" @@ -6841,6 +7617,12 @@ class CreateTenantProviderResponse(BaseModel): state: TenantProviderState = Field(..., description="state") +class FeaturesPolicyResponse(BaseModel): + metrics: Optional[List[MetricFeature]] = Field( + None, description="List of metrics", title="Metrics" + ) + + class GetAllParentNodesResponse(BaseModel): parent_nodes: Dict[str, List[HierarchyNodeEntityDTOOutput]] = Field( ..., description="List of parent nodes.", title="Parent Nodes" @@ -7083,6 +7865,14 @@ class GetMappedResourcesRequest(BaseModel): ) +class GetMetricsControlStatusResponse(BaseModel): + metrics_control_entities: List[MetricsControlResponse] = Field( + ..., + description="The statuses of the metrics control", + title="Metrics Control Entities", + ) + + class GetMetricsCountAPIRequest(BaseModel): node_id: Optional[UUID4] = Field( None, description="The id of the node to be validated.", title="Node Id" @@ -7591,6 +8381,33 @@ class GetTenantProvidersResponse(BaseModel): attributes_data: Optional[Dict[str, Any]] = Field(..., title="Attributes Data") +class GetTenantTicketStatusMetadataApiRequest(BaseModel): + filters: Optional[ + List[OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria] + ] = Field([], description="List of filter criteria to apply", title="Filters") + + +class GetTenantTicketStatusMetadataApiResponse(BaseModel): + status_metadata: List[TenantTicketStatusMetadataApiResponse] = Field( + ..., description="List of status metadata entries", title="Status Metadata" + ) + + +class GetTenantTicketStatusMetadataRequest(BaseModel): + filters: Optional[ + List[OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria] + ] = Field([], description="List of filter criteria to apply", title="Filters") + tenant_id: UUID4 = Field( + ..., description="The unique identifier of the tenant", title="Tenant Id" + ) + + +class GetTenantTicketStatusMetadataResponse(BaseModel): + status_metadata: List[TenantTicketStatusMetadata] = Field( + ..., description="List of status metadata entries", title="Status Metadata" + ) + + class GetTenantTicketsAPIRequest(BaseModel): pagination: Optional[PaginationParams] = Field( default_factory=lambda: PaginationParams.model_validate( @@ -7744,6 +8561,38 @@ class HierarchyNodeEntityWithDetails(BaseModel): ) +class MessageInput(BaseModel): + id: Optional[UUID4] = Field( + None, description="Unique identifier of the message", title="Id" + ) + parts: List[MessagePart] = Field( + ..., description="Parts of the message", title="Parts" + ) + created_at: Optional[datetime] = Field( + None, description="Timestamp of message creation", title="Created At" + ) + updated_at: Optional[datetime] = Field( + None, description="Timestamp of last message update", title="Updated At" + ) + author: MessageAuthor = Field(..., description="Author of the message") + + +class MessageOutput(BaseModel): + id: Optional[UUID4] = Field( + None, description="Unique identifier of the message", title="Id" + ) + parts: List[MessagePart] = Field( + ..., description="Parts of the message", title="Parts" + ) + created_at: Optional[datetime] = Field( + None, description="Timestamp of message creation", title="Created At" + ) + updated_at: Optional[datetime] = Field( + None, description="Timestamp of last message update", title="Updated At" + ) + author: MessageAuthor = Field(..., description="Author of the message") + + class MetricsChartConfigInput(BaseModel): chart_title: str = Field( ..., description="The title of the chart.", title="Chart Title" @@ -8012,6 +8861,11 @@ class ResponseGetTenantProvidersResponse(BaseModel): message: Optional[str] = Field(None, title="Message") +class ResponseGetTenantTicketStatusMetadataApiResponse(BaseModel): + data: GetTenantTicketStatusMetadataApiResponse + message: Optional[str] = Field(None, title="Message") + + class ResponseGetTenantTicketsResponse(BaseModel): data: GetTenantTicketsResponse message: Optional[str] = Field(None, title="Message") @@ -8073,6 +8927,41 @@ class SavedViewItemPayloadOutput(BaseModel): ) +class SendMessageRequest(BaseModel): + tenant_id: Optional[UUID4] = Field( + None, + description="Unique identifier of the tenant, required for tenant specific workflows", + title="Tenant Id", + ) + thread_id: Optional[UUID4] = Field( + None, + description="Unique identifier of the thread, if none is provided, a new thread will be created", + title="Thread Id", + ) + agent_type: Optional[AgentType] = Field( + None, + description="Type of the workflow, required if thread_id is not provided to create a new thread for the workflow", + ) + message: MessageInput = Field(..., description="Message to be sent") + input_state: Optional[Dict[str, Any]] = Field( + None, + description="State of the agent, if provided, it will be used to update the agent state", + title="Input State", + ) + + +class SendMessageResponse(BaseModel): + new_messages: List[MessageOutput] = Field( + ..., description="List of new messages generated", title="New Messages" + ) + output_state: Dict[str, Any] = Field( + ..., description="Updated state of the agent", title="Output State" + ) + thread_id: UUID4 = Field( + ..., description="Unique identifier of the thread", title="Thread Id" + ) + + class TenantPolicy(BaseModel): parent_ptp_id: UUID4 = Field( ..., @@ -8794,6 +9683,12 @@ class GetMappedResourcesResponse(BaseModel): ) +class GetMessagesResponse(BaseModel): + messages: List[MessageOutput] = Field( + ..., description="List of messages in the thread", title="Messages" + ) + + class GetMetricsAPIRequest(BaseModel): query: MetricsQueryInput @@ -8965,6 +9860,9 @@ class GetTenantPoliciesWithSettingsResponse(BaseModel): class GetTenantPolicyByIdResponse(BaseModel): + features: Optional[FeaturesPolicyResponse] = Field( + None, description="Features configuration" + ) parent_ptp_id: UUID4 = Field( ..., description="The id of the parent policy template pack.", @@ -9150,6 +10048,9 @@ class GetTicketByIdPolicyDetailsResponse(BaseModel): account_details: Dict[str, Any] = Field( ..., description="The account details", title="Account Details" ) + features: Optional[FeaturesPolicyResponse] = Field( + None, description="Features configuration" + ) class PolicyTemplate(BaseModel): diff --git a/onelens_backend_client_v2/rpc/__init__.py b/onelens_backend_client_v2/rpc/__init__.py index 596cd981..fe654f63 100644 --- a/onelens_backend_client_v2/rpc/__init__.py +++ b/onelens_backend_client_v2/rpc/__init__.py @@ -106,10 +106,26 @@ TenantConnectionServiceRpcHandler, ) +from onelens_backend_client_v2.rpc.navira_conversation_service_rpc_handler import ( + NaviraConversationServiceRpcHandler, +) + from onelens_backend_client_v2.rpc.feature_service_rpc_handler import ( FeatureServiceRpcHandler, ) +from onelens_backend_client_v2.rpc.ticket_status_metadata_service_rpc_handler import ( + TicketStatusMetadataServiceRpcHandler, +) + +from onelens_backend_client_v2.rpc.metrics_control_service_rpc_handler import ( + MetricsControlServiceRpcHandler, +) + +from onelens_backend_client_v2.rpc.tenant_ticket_audit_service_rpc_handler import ( + TenantTicketAuditServiceRpcHandler, +) + __all__ = [ "TenantVerifyServiceRpcHandler", @@ -139,5 +155,9 @@ "NaviraServiceRpcHandler", "ActionTypeMigrationServiceRpcHandler", "TenantConnectionServiceRpcHandler", + "NaviraConversationServiceRpcHandler", "FeatureServiceRpcHandler", + "TicketStatusMetadataServiceRpcHandler", + "MetricsControlServiceRpcHandler", + "TenantTicketAuditServiceRpcHandler", ] diff --git a/onelens_backend_client_v2/rpc/feature_service_rpc_handler.py b/onelens_backend_client_v2/rpc/feature_service_rpc_handler.py index 73313f3d..3d428bdd 100644 --- a/onelens_backend_client_v2/rpc/feature_service_rpc_handler.py +++ b/onelens_backend_client_v2/rpc/feature_service_rpc_handler.py @@ -11,7 +11,7 @@ from onelens_backend_client_v2.models import GetAllFeaturesResponse -from onelens_backend_client_v2.models import APIGetFeaturesByFiltersRequest +from onelens_backend_client_v2.models import GetFeaturesByFiltersRequest from onelens_backend_client_v2.models import GetFeaturesByFiltersResponse @@ -164,7 +164,7 @@ def _get_all_serialize( @validate_call def get_features_by_filters( self, - request: APIGetFeaturesByFiltersRequest, + request: GetFeaturesByFiltersRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -182,7 +182,7 @@ def get_features_by_filters( :param request: (required) - :type request: APIGetFeaturesByFiltersRequest + :type request: GetFeaturesByFiltersRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -228,7 +228,7 @@ def get_features_by_filters( def _get_features_by_filters_serialize( self, - request: APIGetFeaturesByFiltersRequest, + request: GetFeaturesByFiltersRequest, _request_auth, _content_type, _headers, diff --git a/onelens_backend_client_v2/rpc/metrics_control_service_rpc_handler.py b/onelens_backend_client_v2/rpc/metrics_control_service_rpc_handler.py new file mode 100644 index 00000000..a282813e --- /dev/null +++ b/onelens_backend_client_v2/rpc/metrics_control_service_rpc_handler.py @@ -0,0 +1,522 @@ +# MetricsControlServiceRpcHandler API + +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + + +from onelens_backend_client_v2.models import EnableMetricsRequest + + +from onelens_backend_client_v2.models import APIEnableMetricsResponse + + +from onelens_backend_client_v2.models import GetMetricsControlStatusRequest + + +from onelens_backend_client_v2.models import GetMetricsControlStatusResponse + + +from onelens_backend_client_v2.models import GetMetricsControlWebhookRequest + + +from onelens_backend_client_v2.models import UpdateMetricsControlRequest + + +from onelens_backend_client_v2.models import APIUpdateMetricsControlResponse + + +from onelens_backend_client_v2.api_client import ApiClient, RequestSerialized + + +class MetricsControlServiceRpcHandler: + """NOTE: This class is auto generated. Do not edit the class manually.""" + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + def enable_metrics( + self, + request: EnableMetricsRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> APIEnableMetricsResponse: + """Enable Metrics + + + + :param request: (required) + :type request: EnableMetricsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._enable_metrics_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "APIEnableMetricsResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _enable_metrics_serialize( + self, + request: EnableMetricsRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/metrics_control_service/enable_metrics", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_metrics_control_status( + self, + request: GetMetricsControlStatusRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetMetricsControlStatusResponse: + """Get Metrics Control Status + + + + :param request: (required) + :type request: GetMetricsControlStatusRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_metrics_control_status_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetMetricsControlStatusResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_metrics_control_status_serialize( + self, + request: GetMetricsControlStatusRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/metrics_control_service/get_metrics_control_status", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def process_metrics_control_webhook( + self, + request: GetMetricsControlWebhookRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Any: + """Process Metrics Control Webhook + + + + :param request: (required) + :type request: GetMetricsControlWebhookRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._process_metrics_control_webhook_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Any", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _process_metrics_control_webhook_serialize( + self, + request: GetMetricsControlWebhookRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/metrics_control_service/process_metrics_control_webhook", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def update_metric_status( + self, + request: UpdateMetricsControlRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> APIUpdateMetricsControlResponse: + """Update Metric Status + + + + :param request: (required) + :type request: UpdateMetricsControlRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._update_metric_status_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "APIUpdateMetricsControlResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _update_metric_status_serialize( + self, + request: UpdateMetricsControlRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/metrics_control_service/update_metric_status", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/onelens_backend_client_v2/rpc/navira_conversation_service_rpc_handler.py b/onelens_backend_client_v2/rpc/navira_conversation_service_rpc_handler.py new file mode 100644 index 00000000..bd0ab5df --- /dev/null +++ b/onelens_backend_client_v2/rpc/navira_conversation_service_rpc_handler.py @@ -0,0 +1,1033 @@ +# NaviraConversationServiceRpcHandler API + +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + + +from onelens_backend_client_v2.models import CreateThreadRequest + + +from onelens_backend_client_v2.models import CreateThreadResponse + + +from onelens_backend_client_v2.models import GetAgentTypesRequest + + +from onelens_backend_client_v2.models import GetAgentTypesResponse + + +from onelens_backend_client_v2.models import GetAllThreadsRequest + + +from onelens_backend_client_v2.models import GetAllThreadsResponse + + +from onelens_backend_client_v2.models import GetMessagesRequest + + +from onelens_backend_client_v2.models import GetMessagesResponse + + +from onelens_backend_client_v2.models import GetStateRequest + + +from onelens_backend_client_v2.models import GetStateResponse + + +from onelens_backend_client_v2.models import GetThreadByIdRequest + + +from onelens_backend_client_v2.models import GetThreadByIdResponse + + +from onelens_backend_client_v2.models import SendMessageRequest + + +from onelens_backend_client_v2.models import SendMessageResponse + + +from onelens_backend_client_v2.models import UpdateStateRequest + + +from onelens_backend_client_v2.models import UpdateStateResponse + + +from onelens_backend_client_v2.api_client import ApiClient, RequestSerialized + + +class NaviraConversationServiceRpcHandler: + """NOTE: This class is auto generated. Do not edit the class manually.""" + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + def create_thread( + self, + request: CreateThreadRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateThreadResponse: + """Create Thread + + + + :param request: (required) + :type request: CreateThreadRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._create_thread_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateThreadResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _create_thread_serialize( + self, + request: CreateThreadRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/create_thread", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_agent_types( + self, + request: GetAgentTypesRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetAgentTypesResponse: + """Get Agent Types + + + + :param request: (required) + :type request: GetAgentTypesRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_agent_types_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetAgentTypesResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_agent_types_serialize( + self, + request: GetAgentTypesRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/get_agent_types", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_all_threads( + self, + request: GetAllThreadsRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetAllThreadsResponse: + """Get All Threads + + + + :param request: (required) + :type request: GetAllThreadsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_all_threads_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetAllThreadsResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_all_threads_serialize( + self, + request: GetAllThreadsRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/get_all_threads", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_messages( + self, + request: GetMessagesRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetMessagesResponse: + """Get Messages + + + + :param request: (required) + :type request: GetMessagesRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_messages_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetMessagesResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_messages_serialize( + self, + request: GetMessagesRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/get_messages", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_state( + self, + request: GetStateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetStateResponse: + """Get State + + + + :param request: (required) + :type request: GetStateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_state_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetStateResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_state_serialize( + self, + request: GetStateRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/get_state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_thread_by_id( + self, + request: GetThreadByIdRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetThreadByIdResponse: + """Get Thread By Id + + + + :param request: (required) + :type request: GetThreadByIdRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_thread_by_id_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetThreadByIdResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_thread_by_id_serialize( + self, + request: GetThreadByIdRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/get_thread_by_id", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def send_message( + self, + request: SendMessageRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SendMessageResponse: + """Send Message + + + + :param request: (required) + :type request: SendMessageRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._send_message_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "SendMessageResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _send_message_serialize( + self, + request: SendMessageRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/send_message", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def update_state( + self, + request: UpdateStateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UpdateStateResponse: + """Update State + + + + :param request: (required) + :type request: UpdateStateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._update_state_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UpdateStateResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _update_state_serialize( + self, + request: UpdateStateRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/navira_conversation_service/update_state", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/onelens_backend_client_v2/rpc/tenant_connection_service_rpc_handler.py b/onelens_backend_client_v2/rpc/tenant_connection_service_rpc_handler.py index 10469eaa..b46f4f86 100644 --- a/onelens_backend_client_v2/rpc/tenant_connection_service_rpc_handler.py +++ b/onelens_backend_client_v2/rpc/tenant_connection_service_rpc_handler.py @@ -11,6 +11,12 @@ from onelens_backend_client_v2.models import GetTenantConnectionResponse +from onelens_backend_client_v2.models import GetAllTenantConnectionsRequest + + +from onelens_backend_client_v2.models import GetAllTenantConnectionsResponse + + from onelens_backend_client_v2.models import GetTenantConnectionRequest @@ -152,6 +158,127 @@ def _create_tenant_connection_serialize( _request_auth=_request_auth, ) + @validate_call + def get_all_tenant_connections( + self, + request: GetAllTenantConnectionsRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetAllTenantConnectionsResponse: + """Get All Tenant Connections + + + + :param request: (required) + :type request: GetAllTenantConnectionsRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_all_tenant_connections_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetAllTenantConnectionsResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_all_tenant_connections_serialize( + self, + request: GetAllTenantConnectionsRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/tenant_connection_service/get_all_tenant_connections", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def get_tenant_connection( self, diff --git a/onelens_backend_client_v2/rpc/tenant_ticket_audit_service_rpc_handler.py b/onelens_backend_client_v2/rpc/tenant_ticket_audit_service_rpc_handler.py new file mode 100644 index 00000000..9ab682fe --- /dev/null +++ b/onelens_backend_client_v2/rpc/tenant_ticket_audit_service_rpc_handler.py @@ -0,0 +1,144 @@ +# TenantTicketAuditServiceRpcHandler API + +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + + +from onelens_backend_client_v2.models import GetTenantTicketsAuditRequest + + +from onelens_backend_client_v2.models import GetTenantTicketsAuditResponse + + +from onelens_backend_client_v2.api_client import ApiClient, RequestSerialized + + +class TenantTicketAuditServiceRpcHandler: + """NOTE: This class is auto generated. Do not edit the class manually.""" + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + def get( + self, + request: GetTenantTicketsAuditRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetTenantTicketsAuditResponse: + """Get + + + + :param request: (required) + :type request: GetTenantTicketsAuditRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetTenantTicketsAuditResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_serialize( + self, + request: GetTenantTicketsAuditRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/tenant_ticket_audit_service/get", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/onelens_backend_client_v2/rpc/tenant_ticket_service_rpc_handler.py b/onelens_backend_client_v2/rpc/tenant_ticket_service_rpc_handler.py index 7c756160..7853c5e6 100644 --- a/onelens_backend_client_v2/rpc/tenant_ticket_service_rpc_handler.py +++ b/onelens_backend_client_v2/rpc/tenant_ticket_service_rpc_handler.py @@ -29,6 +29,12 @@ from onelens_backend_client_v2.models import GetAllPolicyViolationsResponse +from onelens_backend_client_v2.models import GetPolicyTicketsForNotificationRequest + + +from onelens_backend_client_v2.models import GetPolicyTicketsForNotificationResponse + + from onelens_backend_client_v2.models import GetPolicyTicketStatsRequest @@ -569,6 +575,127 @@ def _get_all_policy_violations_serialize( _request_auth=_request_auth, ) + @validate_call + def get_policy_ticket_for_notification( + self, + request: GetPolicyTicketsForNotificationRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetPolicyTicketsForNotificationResponse: + """Get Policy Ticket For Notification + + + + :param request: (required) + :type request: GetPolicyTicketsForNotificationRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_policy_ticket_for_notification_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetPolicyTicketsForNotificationResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_policy_ticket_for_notification_serialize( + self, + request: GetPolicyTicketsForNotificationRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/tenant_ticket_service/get_policy_ticket_for_notification", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def get_policy_ticket_stats( self, diff --git a/onelens_backend_client_v2/rpc/ticket_status_metadata_service_rpc_handler.py b/onelens_backend_client_v2/rpc/ticket_status_metadata_service_rpc_handler.py new file mode 100644 index 00000000..b54246a0 --- /dev/null +++ b/onelens_backend_client_v2/rpc/ticket_status_metadata_service_rpc_handler.py @@ -0,0 +1,398 @@ +# TicketStatusMetadataServiceRpcHandler API + +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + + +from onelens_backend_client_v2.models import CreateTenantTicketStatusMetadataRequest + + +from onelens_backend_client_v2.models import CreateTenantTicketStatusMetadataResponse + + +from onelens_backend_client_v2.models import GetTenantTicketStatusMetadataRequest + + +from onelens_backend_client_v2.models import GetTenantTicketStatusMetadataResponse + + +from onelens_backend_client_v2.models import UpdateTenantTicketStatusMetadataRequest + + +from onelens_backend_client_v2.models import UpdateTenantTicketStatusMetadataResponse + + +from onelens_backend_client_v2.api_client import ApiClient, RequestSerialized + + +class TicketStatusMetadataServiceRpcHandler: + """NOTE: This class is auto generated. Do not edit the class manually.""" + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + def create_status_metadata( + self, + request: CreateTenantTicketStatusMetadataRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CreateTenantTicketStatusMetadataResponse: + """Creates a new tenant ticket status metadata. + + + + :param request: (required) + :type request: CreateTenantTicketStatusMetadataRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._create_status_metadata_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateTenantTicketStatusMetadataResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _create_status_metadata_serialize( + self, + request: CreateTenantTicketStatusMetadataRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/ticket_status_metadata_service/create_status_metadata", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_status_metadata( + self, + request: GetTenantTicketStatusMetadataRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetTenantTicketStatusMetadataResponse: + """Retrieves all status metadata for a tenant with optional filters. + + + + :param request: (required) + :type request: GetTenantTicketStatusMetadataRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._get_status_metadata_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetTenantTicketStatusMetadataResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _get_status_metadata_serialize( + self, + request: GetTenantTicketStatusMetadataRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/ticket_status_metadata_service/get_status_metadata", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def update_status_metadata( + self, + request: UpdateTenantTicketStatusMetadataRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UpdateTenantTicketStatusMetadataResponse: + """Updates an existing tenant ticket status metadata. + + + + :param request: (required) + :type request: UpdateTenantTicketStatusMetadataRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ + + _param = self._update_status_metadata_serialize( + request=request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "UpdateTenantTicketStatusMetadataResponse", + "422": "HTTPValidationError", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + def _update_status_metadata_serialize( + self, + request: UpdateTenantTicketStatusMetadataRequest, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the body parameter + if request is not None: + _body_params = request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/rpc/ticket_status_metadata_service/update_status_metadata", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + )