diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index fbaf84d..8855160 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -14,6 +14,7 @@ docs/ApplicationVolumeProviderSpec.md docs/ApplicationVolumeStatus.md docs/ApplicationsSummaryStatusType.md docs/AuthConfig.md +docs/AuthOrganizationsConfig.md docs/AuthenticationApi.md docs/Batch.md docs/BatchLimit.md @@ -40,6 +41,7 @@ docs/DeviceIntegrityCheckStatus.md docs/DeviceIntegrityCheckStatusType.md docs/DeviceIntegrityStatus.md docs/DeviceIntegrityStatusSummaryType.md +docs/DeviceLastSeen.md docs/DeviceLifecycleHookType.md docs/DeviceLifecycleStatus.md docs/DeviceLifecycleStatusType.md @@ -51,6 +53,8 @@ docs/DeviceOsStatus.md docs/DeviceOwnershipChangedDetails.md docs/DeviceResourceStatus.md docs/DeviceResourceStatusType.md +docs/DeviceResumeRequest.md +docs/DeviceResumeResponse.md docs/DeviceSpec.md docs/DeviceSpecSystemd.md docs/DeviceStatus.md @@ -60,6 +64,7 @@ docs/DeviceSystemInfo.md docs/DeviceUpdatePolicySpec.md docs/DeviceUpdatedStatus.md docs/DeviceUpdatedStatusType.md +docs/DeviceactionsApi.md docs/DevicesSummary.md docs/DiskResourceMonitorSpec.md docs/DisruptionBudget.md @@ -115,6 +120,7 @@ docs/ImageVolumeSource.md docs/InlineApplicationProviderSpec.md docs/InlineConfigProviderSpec.md docs/InternalTaskFailedDetails.md +docs/InternalTaskPermanentlyFailedDetails.md docs/KubernetesSecretProviderSpec.md docs/KubernetesSecretProviderSpecSecretRef.md docs/LabelApi.md @@ -167,6 +173,7 @@ flightctl/api/__init__.py flightctl/api/authentication_api.py flightctl/api/certificatesigningrequest_api.py flightctl/api/device_api.py +flightctl/api/deviceactions_api.py flightctl/api/enrollmentrequest_api.py flightctl/api/event_api.py flightctl/api/fleet_api.py @@ -191,6 +198,7 @@ flightctl/models/application_volume_provider_spec.py flightctl/models/application_volume_status.py flightctl/models/applications_summary_status_type.py flightctl/models/auth_config.py +flightctl/models/auth_organizations_config.py flightctl/models/batch.py flightctl/models/batch_limit.py flightctl/models/batch_sequence.py @@ -214,6 +222,7 @@ flightctl/models/device_integrity_check_status.py flightctl/models/device_integrity_check_status_type.py flightctl/models/device_integrity_status.py flightctl/models/device_integrity_status_summary_type.py +flightctl/models/device_last_seen.py flightctl/models/device_lifecycle_hook_type.py flightctl/models/device_lifecycle_status.py flightctl/models/device_lifecycle_status_type.py @@ -225,6 +234,8 @@ flightctl/models/device_os_status.py flightctl/models/device_ownership_changed_details.py flightctl/models/device_resource_status.py flightctl/models/device_resource_status_type.py +flightctl/models/device_resume_request.py +flightctl/models/device_resume_response.py flightctl/models/device_spec.py flightctl/models/device_spec_systemd.py flightctl/models/device_status.py @@ -286,6 +297,7 @@ flightctl/models/image_volume_source.py flightctl/models/inline_application_provider_spec.py flightctl/models/inline_config_provider_spec.py flightctl/models/internal_task_failed_details.py +flightctl/models/internal_task_permanently_failed_details.py flightctl/models/kubernetes_secret_provider_spec.py flightctl/models/kubernetes_secret_provider_spec_secret_ref.py flightctl/models/label_selector.py @@ -337,22 +349,4 @@ setup.cfg setup.py test-requirements.txt test/__init__.py -test/test_device_integrity_check_status.py -test/test_device_integrity_check_status_type.py -test/test_device_multiple_owners_detected_details.py -test/test_device_multiple_owners_resolved_details.py -test/test_device_ownership_changed_details.py -test/test_fleet_rollout_batch_completed_details.py -test/test_fleet_rollout_batch_dispatched_details.py -test/test_fleet_rollout_completed_details.py -test/test_fleet_rollout_device_selected_details.py -test/test_fleet_rollout_failed_details.py -test/test_fleet_rollout_started_details.py -test/test_internal_task_failed_details.py -test/test_organization.py -test/test_organization_api.py -test/test_organization_list.py -test/test_organization_spec.py -test/test_referenced_repository_updated_details.py -test/test_resource_sync_completed_details.py tox.ini diff --git a/README.md b/README.md index 0c28a8a..f7356dc 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Class | Method | HTTP request | Description *DeviceApi* | [**decommission_device**](docs/DeviceApi.md#decommission_device) | **PUT** /api/v1/devices/{name}/decommission | *DeviceApi* | [**delete_device**](docs/DeviceApi.md#delete_device) | **DELETE** /api/v1/devices/{name} | *DeviceApi* | [**get_device**](docs/DeviceApi.md#get_device) | **GET** /api/v1/devices/{name} | +*DeviceApi* | [**get_device_last_seen**](docs/DeviceApi.md#get_device_last_seen) | **GET** /api/v1/devices/{name}/lastseen | *DeviceApi* | [**get_device_status**](docs/DeviceApi.md#get_device_status) | **GET** /api/v1/devices/{name}/status | *DeviceApi* | [**get_rendered_device**](docs/DeviceApi.md#get_rendered_device) | **GET** /api/v1/devices/{name}/rendered | *DeviceApi* | [**list_devices**](docs/DeviceApi.md#list_devices) | **GET** /api/v1/devices | @@ -105,6 +106,7 @@ Class | Method | HTTP request | Description *DeviceApi* | [**patch_device_status**](docs/DeviceApi.md#patch_device_status) | **PATCH** /api/v1/devices/{name}/status | *DeviceApi* | [**replace_device**](docs/DeviceApi.md#replace_device) | **PUT** /api/v1/devices/{name} | *DeviceApi* | [**replace_device_status**](docs/DeviceApi.md#replace_device_status) | **PUT** /api/v1/devices/{name}/status | +*DeviceactionsApi* | [**resume_devices**](docs/DeviceactionsApi.md#resume_devices) | **POST** /api/v1/deviceactions/resume | *EnrollmentrequestApi* | [**approve_enrollment_request**](docs/EnrollmentrequestApi.md#approve_enrollment_request) | **PUT** /api/v1/enrollmentrequests/{name}/approval | *EnrollmentrequestApi* | [**create_enrollment_request**](docs/EnrollmentrequestApi.md#create_enrollment_request) | **POST** /api/v1/enrollmentrequests | *EnrollmentrequestApi* | [**delete_enrollment_request**](docs/EnrollmentrequestApi.md#delete_enrollment_request) | **DELETE** /api/v1/enrollmentrequests/{name} | @@ -159,6 +161,7 @@ Class | Method | HTTP request | Description - [ApplicationVolumeStatus](docs/ApplicationVolumeStatus.md) - [ApplicationsSummaryStatusType](docs/ApplicationsSummaryStatusType.md) - [AuthConfig](docs/AuthConfig.md) + - [AuthOrganizationsConfig](docs/AuthOrganizationsConfig.md) - [Batch](docs/Batch.md) - [BatchLimit](docs/BatchLimit.md) - [BatchSequence](docs/BatchSequence.md) @@ -182,6 +185,7 @@ Class | Method | HTTP request | Description - [DeviceIntegrityCheckStatusType](docs/DeviceIntegrityCheckStatusType.md) - [DeviceIntegrityStatus](docs/DeviceIntegrityStatus.md) - [DeviceIntegrityStatusSummaryType](docs/DeviceIntegrityStatusSummaryType.md) + - [DeviceLastSeen](docs/DeviceLastSeen.md) - [DeviceLifecycleHookType](docs/DeviceLifecycleHookType.md) - [DeviceLifecycleStatus](docs/DeviceLifecycleStatus.md) - [DeviceLifecycleStatusType](docs/DeviceLifecycleStatusType.md) @@ -193,6 +197,8 @@ Class | Method | HTTP request | Description - [DeviceOwnershipChangedDetails](docs/DeviceOwnershipChangedDetails.md) - [DeviceResourceStatus](docs/DeviceResourceStatus.md) - [DeviceResourceStatusType](docs/DeviceResourceStatusType.md) + - [DeviceResumeRequest](docs/DeviceResumeRequest.md) + - [DeviceResumeResponse](docs/DeviceResumeResponse.md) - [DeviceSpec](docs/DeviceSpec.md) - [DeviceSpecSystemd](docs/DeviceSpecSystemd.md) - [DeviceStatus](docs/DeviceStatus.md) @@ -254,6 +260,7 @@ Class | Method | HTTP request | Description - [InlineApplicationProviderSpec](docs/InlineApplicationProviderSpec.md) - [InlineConfigProviderSpec](docs/InlineConfigProviderSpec.md) - [InternalTaskFailedDetails](docs/InternalTaskFailedDetails.md) + - [InternalTaskPermanentlyFailedDetails](docs/InternalTaskPermanentlyFailedDetails.md) - [KubernetesSecretProviderSpec](docs/KubernetesSecretProviderSpec.md) - [KubernetesSecretProviderSpecSecretRef](docs/KubernetesSecretProviderSpecSecretRef.md) - [LabelSelector](docs/LabelSelector.md) diff --git a/api/v1alpha1/openapi.yml b/api/v1alpha1/openapi.yml index 995375e..fa2e539 100644 --- a/api/v1alpha1/openapi.yml +++ b/api/v1alpha1/openapi.yml @@ -20,6 +20,8 @@ tags: description: Operations on CertificateSigningRequest resources. - name: device description: Operations on Device resources. + - name: deviceactions + description: Operations for device actions. - name: enrollmentrequest description: Operations on EnrollmentRequest resources. - name: event @@ -1521,6 +1523,111 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/devices/{name}/lastseen: + get: + tags: + - device + description: Get the last seen timestamp of the Device resource. + operationId: getDeviceLastSeen + parameters: + - name: name + in: path + description: The name of the Device resource to get the last seen timestamp for. + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceLastSeen' + "204": + description: No Content + content: {} + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "404": + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "429": + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "503": + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/deviceactions/resume: + post: + tags: + - deviceactions + description: Resume devices based on label selector and/or field selector. + operationId: resumeDevices + x-rbac: + resource: devices/resume + action: update + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceResumeRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DeviceResumeResponse' + "400": + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "429": + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "503": + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/enrollmentconfig: get: tags: @@ -1577,6 +1684,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/enrollmentrequests: get: tags: @@ -3552,6 +3660,40 @@ components: required: - target description: Metadata about a device decommissioning request. + + DeviceResumeRequest: + type: object + additionalProperties: false + properties: + labelSelector: + type: string + description: A selector to restrict the list of devices to resume by their labels. Uses the same format as Kubernetes label selectors (e.g., "key1=value1,key2!=value2"). + fieldSelector: + type: string + description: A selector to restrict the list of devices to resume by their fields. Uses the same format as Kubernetes field selectors (e.g., "metadata.name=device1,status.phase!=Pending"). + anyOf: + - required: + - labelSelector + - required: + - fieldSelector + description: Request to resume devices based on label selector and/or field selector. At least one selector must be provided. + example: + labelSelector: "environment=production,tier=frontend" + + DeviceResumeResponse: + type: object + additionalProperties: false + required: + - resumedDevices + properties: + resumedDevices: + type: integer + description: Number of devices that were successfully resumed. + description: Response from resuming devices. + example: + resumedDevices: 3 + + PatchRequest: type: array items: @@ -3573,6 +3715,7 @@ components: - add - replace - remove + - test Repository: type: object properties: @@ -4291,7 +4434,6 @@ components: - os - updated - summary - - lastSeen - lifecycle properties: conditions: @@ -4322,10 +4464,21 @@ components: $ref: "#/components/schemas/DeviceSummaryStatus" lastSeen: type: string - description: The last time the device was seen by the service. + description: "The last time the device was seen by the service (NOTE: this property is not returned by the API)." format: date-time + x-go-json-ignore: true lifecycle: $ref: '#/components/schemas/DeviceLifecycleStatus' + DeviceLastSeen: + type: object + description: DeviceLastSeen represents the last seen timestamp of a device. + required: + - lastSeen + properties: + lastSeen: + type: string + description: The last time the device was seen by the service. + format: date-time DeviceSystemInfo: required: - architecture @@ -4481,6 +4634,8 @@ components: - "Rebooting" - "PoweredOff" - "Unknown" + - "AwaitingReconnect" + - "ConflictPaused" x-enum-varnames: - "DeviceSummaryStatusOnline" - "DeviceSummaryStatusDegraded" @@ -4488,6 +4643,8 @@ components: - "DeviceSummaryStatusRebooting" - "DeviceSummaryStatusPoweredOff" - "DeviceSummaryStatusUnknown" + - "DeviceSummaryStatusAwaitingReconnect" + - "DeviceSummaryStatusConflictPaused" DeviceUpdatedStatus: type: object description: Current status of the device update. @@ -5180,10 +5337,23 @@ components: authURL: type: string description: Auth URL. + authOrganizationsConfig: + $ref: '#/components/schemas/AuthOrganizationsConfig' required: - authType - authURL + - authOrganizationsConfig description: Auth config. + AuthOrganizationsConfig: + type: object + description: Auth related organizations configuration. + properties: + enabled: + type: boolean + description: If true, support for IdP provided organizations is enabled. + default: false + required: + - enabled ListMeta: type: object properties: @@ -5341,9 +5511,11 @@ components: description: Type of condition in CamelCase. enum: - 'Approved' # EnrollmentRequest + - 'TPMVerified' # EnrollmentRequest - 'Approved' # CertificateSigningRequest - 'Denied' # CertificateSigningRequest - 'Failed' # CertificateSigningRequest + - 'TPMVerified' # CertificateSigningRequest - 'Accessible' # Repository - 'Accessible' # ResourceSync - 'ResourceParsed' # ResourceSync @@ -5356,9 +5528,11 @@ components: - 'DeviceDecommissioning' # Device x-enum-varnames: - EnrollmentRequestApproved + - EnrollmentRequestTPMVerified - CertificateSigningRequestApproved - CertificateSigningRequestDenied - CertificateSigningRequestFailed + - CertificateSigningRequestTPMVerified - RepositoryAccessible - ResourceSyncAccessible - ResourceSyncResourceParsed @@ -5483,6 +5657,7 @@ components: - version Event: type: object + description: Event represents a single event that occurred in the system. required: - apiVersion - kind @@ -5530,6 +5705,8 @@ components: - DeviceApplicationHealthy - DeviceDisconnected - DeviceIsRebooting + - DeviceConflictPaused + - DeviceConflictResolved - DeviceConnected - DeviceContentUpToDate - DeviceContentOutOfDate @@ -5542,6 +5719,7 @@ components: - DeviceSpecValid - DeviceSpecInvalid - InternalTaskFailed + - InternalTaskPermanentlyFailed - RepositoryAccessible - RepositoryInaccessible - ReferencedRepositoryUpdated @@ -5561,6 +5739,7 @@ components: - ResourceSyncParsingFailed - ResourceSyncSynced - ResourceSyncSyncFailed + - SystemRestored message: type: string description: A human-readable description of the status of this operation. @@ -5634,6 +5813,7 @@ components: DeviceMultipleOwnersDetected: "#/components/schemas/DeviceMultipleOwnersDetectedDetails" DeviceMultipleOwnersResolved: "#/components/schemas/DeviceMultipleOwnersResolvedDetails" InternalTaskFailed: "#/components/schemas/InternalTaskFailedDetails" + InternalTaskPermanentlyFailed: "#/components/schemas/InternalTaskPermanentlyFailedDetails" ResourceSyncCompleted: "#/components/schemas/ResourceSyncCompletedDetails" ReferencedRepositoryUpdated: "#/components/schemas/ReferencedRepositoryUpdatedDetails" FleetRolloutStarted: "#/components/schemas/FleetRolloutStartedDetails" @@ -5648,6 +5828,7 @@ components: - $ref: "#/components/schemas/DeviceMultipleOwnersDetectedDetails" - $ref: "#/components/schemas/DeviceMultipleOwnersResolvedDetails" - $ref: "#/components/schemas/InternalTaskFailedDetails" + - $ref: "#/components/schemas/InternalTaskPermanentlyFailedDetails" - $ref: "#/components/schemas/ResourceSyncCompletedDetails" - $ref: "#/components/schemas/ReferencedRepositoryUpdatedDetails" - $ref: "#/components/schemas/FleetRolloutStartedDetails" @@ -5739,27 +5920,41 @@ components: type: object required: - detailType - - taskType - errorMessage + - originalEvent properties: detailType: type: string enum: [InternalTaskFailed] description: The type of detail for discriminator purposes. - taskType: - type: string - description: The type of internal task that failed. errorMessage: type: string description: The error message describing the failure. retryCount: type: integer description: Number of times the task has been retried. - taskParameters: - type: object - additionalProperties: - type: string - description: Parameters needed to retry the task. + originalEvent: + $ref: '#/components/schemas/Event' + InternalTaskPermanentlyFailedDetails: + type: object + required: + - detailType + - errorMessage + - retryCount + - originalEvent + properties: + detailType: + type: string + enum: [InternalTaskPermanentlyFailed] + description: The type of detail for discriminator purposes. + errorMessage: + type: string + description: The error message describing the permanent failure. + retryCount: + type: integer + description: Number of times the task was retried before being marked as permanently failed. + originalEvent: + $ref: '#/components/schemas/Event' ResourceSyncCompletedDetails: type: object required: @@ -5962,4 +6157,4 @@ components: description: 'List of Organizations.' items: $ref: '#/components/schemas/Organization' - description: OrganizationList is a list of Organizations. + description: OrganizationList is a list of Organizations. \ No newline at end of file diff --git a/docs/AuthConfig.md b/docs/AuthConfig.md index 60fd9a5..7c1fccb 100644 --- a/docs/AuthConfig.md +++ b/docs/AuthConfig.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **auth_type** | **str** | Auth type. | **auth_url** | **str** | Auth URL. | +**auth_organizations_config** | [**AuthOrganizationsConfig**](AuthOrganizationsConfig.md) | | ## Example diff --git a/docs/AuthOrganizationsConfig.md b/docs/AuthOrganizationsConfig.md new file mode 100644 index 0000000..f17a062 --- /dev/null +++ b/docs/AuthOrganizationsConfig.md @@ -0,0 +1,30 @@ +# AuthOrganizationsConfig + +Auth related organizations configuration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | If true, support for IdP provided organizations is enabled. | [default to False] + +## Example + +```python +from flightctl.models.auth_organizations_config import AuthOrganizationsConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of AuthOrganizationsConfig from a JSON string +auth_organizations_config_instance = AuthOrganizationsConfig.from_json(json) +# print the JSON string representation of the object +print(AuthOrganizationsConfig.to_json()) + +# convert the object into a dict +auth_organizations_config_dict = auth_organizations_config_instance.to_dict() +# create an instance of AuthOrganizationsConfig from a dict +auth_organizations_config_from_dict = AuthOrganizationsConfig.from_dict(auth_organizations_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ConditionType.md b/docs/ConditionType.md index 6277d9a..a310f66 100644 --- a/docs/ConditionType.md +++ b/docs/ConditionType.md @@ -6,12 +6,16 @@ Type of condition in CamelCase. * `APPROVED` (value: `'Approved'`) +* `TPMVERIFIED` (value: `'TPMVerified'`) + * `APPROVED` (value: `'Approved'`) * `DENIED` (value: `'Denied'`) * `FAILED` (value: `'Failed'`) +* `TPMVERIFIED` (value: `'TPMVerified'`) + * `ACCESSIBLE` (value: `'Accessible'`) * `ACCESSIBLE` (value: `'Accessible'`) diff --git a/docs/DeviceApi.md b/docs/DeviceApi.md index 5113d1a..44eb42d 100644 --- a/docs/DeviceApi.md +++ b/docs/DeviceApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**decommission_device**](DeviceApi.md#decommission_device) | **PUT** /api/v1/devices/{name}/decommission | [**delete_device**](DeviceApi.md#delete_device) | **DELETE** /api/v1/devices/{name} | [**get_device**](DeviceApi.md#get_device) | **GET** /api/v1/devices/{name} | +[**get_device_last_seen**](DeviceApi.md#get_device_last_seen) | **GET** /api/v1/devices/{name}/lastseen | [**get_device_status**](DeviceApi.md#get_device_status) | **GET** /api/v1/devices/{name}/status | [**get_rendered_device**](DeviceApi.md#get_rendered_device) | **GET** /api/v1/devices/{name}/rendered | [**list_devices**](DeviceApi.md#list_devices) | **GET** /api/v1/devices | @@ -310,6 +311,79 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_device_last_seen** +> DeviceLastSeen get_device_last_seen(name) + + + +Get the last seen timestamp of the Device resource. + +### Example + + +```python +import flightctl +from flightctl.models.device_last_seen import DeviceLastSeen +from flightctl.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = flightctl.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with flightctl.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flightctl.DeviceApi(api_client) + name = 'name_example' # str | The name of the Device resource to get the last seen timestamp for. + + try: + api_response = api_instance.get_device_last_seen(name) + print("The response of DeviceApi->get_device_last_seen:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DeviceApi->get_device_last_seen: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **name** | **str**| The name of the Device resource to get the last seen timestamp for. | + +### Return type + +[**DeviceLastSeen**](DeviceLastSeen.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**204** | No Content | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**429** | Too Many Requests | - | +**503** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_device_status** > Device get_device_status(name) diff --git a/docs/DeviceLastSeen.md b/docs/DeviceLastSeen.md new file mode 100644 index 0000000..1b5b14c --- /dev/null +++ b/docs/DeviceLastSeen.md @@ -0,0 +1,30 @@ +# DeviceLastSeen + +DeviceLastSeen represents the last seen timestamp of a device. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**last_seen** | **datetime** | The last time the device was seen by the service. | + +## Example + +```python +from flightctl.models.device_last_seen import DeviceLastSeen + +# TODO update the JSON string below +json = "{}" +# create an instance of DeviceLastSeen from a JSON string +device_last_seen_instance = DeviceLastSeen.from_json(json) +# print the JSON string representation of the object +print(DeviceLastSeen.to_json()) + +# convert the object into a dict +device_last_seen_dict = device_last_seen_instance.to_dict() +# create an instance of DeviceLastSeen from a dict +device_last_seen_from_dict = DeviceLastSeen.from_dict(device_last_seen_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeviceResumeRequest.md b/docs/DeviceResumeRequest.md new file mode 100644 index 0000000..a218084 --- /dev/null +++ b/docs/DeviceResumeRequest.md @@ -0,0 +1,31 @@ +# DeviceResumeRequest + +Request to resume devices based on label selector and/or field selector. At least one selector must be provided. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**label_selector** | **str** | A selector to restrict the list of devices to resume by their labels. Uses the same format as Kubernetes label selectors (e.g., \"key1=value1,key2!=value2\"). | [optional] +**field_selector** | **str** | A selector to restrict the list of devices to resume by their fields. Uses the same format as Kubernetes field selectors (e.g., \"metadata.name=device1,status.phase!=Pending\"). | [optional] + +## Example + +```python +from flightctl.models.device_resume_request import DeviceResumeRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of DeviceResumeRequest from a JSON string +device_resume_request_instance = DeviceResumeRequest.from_json(json) +# print the JSON string representation of the object +print(DeviceResumeRequest.to_json()) + +# convert the object into a dict +device_resume_request_dict = device_resume_request_instance.to_dict() +# create an instance of DeviceResumeRequest from a dict +device_resume_request_from_dict = DeviceResumeRequest.from_dict(device_resume_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeviceResumeResponse.md b/docs/DeviceResumeResponse.md new file mode 100644 index 0000000..62f1e93 --- /dev/null +++ b/docs/DeviceResumeResponse.md @@ -0,0 +1,30 @@ +# DeviceResumeResponse + +Response from resuming devices. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**resumed_devices** | **int** | Number of devices that were successfully resumed. | + +## Example + +```python +from flightctl.models.device_resume_response import DeviceResumeResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DeviceResumeResponse from a JSON string +device_resume_response_instance = DeviceResumeResponse.from_json(json) +# print the JSON string representation of the object +print(DeviceResumeResponse.to_json()) + +# convert the object into a dict +device_resume_response_dict = device_resume_response_instance.to_dict() +# create an instance of DeviceResumeResponse from a dict +device_resume_response_from_dict = DeviceResumeResponse.from_dict(device_resume_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeviceStatus.md b/docs/DeviceStatus.md index 9b1fdd3..feb0baf 100644 --- a/docs/DeviceStatus.md +++ b/docs/DeviceStatus.md @@ -16,7 +16,7 @@ Name | Type | Description | Notes **os** | [**DeviceOsStatus**](DeviceOsStatus.md) | | **updated** | [**DeviceUpdatedStatus**](DeviceUpdatedStatus.md) | | **summary** | [**DeviceSummaryStatus**](DeviceSummaryStatus.md) | | -**last_seen** | **datetime** | The last time the device was seen by the service. | +**last_seen** | **datetime** | The last time the device was seen by the service (NOTE: this property is not returned by the API). | [optional] **lifecycle** | [**DeviceLifecycleStatus**](DeviceLifecycleStatus.md) | | ## Example diff --git a/docs/DeviceSummaryStatusType.md b/docs/DeviceSummaryStatusType.md index 895f126..499e1d2 100644 --- a/docs/DeviceSummaryStatusType.md +++ b/docs/DeviceSummaryStatusType.md @@ -16,6 +16,10 @@ Status of the device. * `UNKNOWN` (value: `'Unknown'`) +* `AWAITINGRECONNECT` (value: `'AwaitingReconnect'`) + +* `CONFLICTPAUSED` (value: `'ConflictPaused'`) + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/DeviceactionsApi.md b/docs/DeviceactionsApi.md new file mode 100644 index 0000000..427380c --- /dev/null +++ b/docs/DeviceactionsApi.md @@ -0,0 +1,82 @@ +# flightctl.DeviceactionsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**resume_devices**](DeviceactionsApi.md#resume_devices) | **POST** /api/v1/deviceactions/resume | + + +# **resume_devices** +> DeviceResumeResponse resume_devices(device_resume_request) + + + +Resume devices based on label selector and/or field selector. + +### Example + + +```python +import flightctl +from flightctl.models.device_resume_request import DeviceResumeRequest +from flightctl.models.device_resume_response import DeviceResumeResponse +from flightctl.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = flightctl.Configuration( + host = "http://localhost" +) + + +# Enter a context with an instance of the API client +with flightctl.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = flightctl.DeviceactionsApi(api_client) + device_resume_request = flightctl.DeviceResumeRequest() # DeviceResumeRequest | + + try: + api_response = api_instance.resume_devices(device_resume_request) + print("The response of DeviceactionsApi->resume_devices:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DeviceactionsApi->resume_devices: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **device_resume_request** | [**DeviceResumeRequest**](DeviceResumeRequest.md)| | + +### Return type + +[**DeviceResumeResponse**](DeviceResumeResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**429** | Too Many Requests | - | +**503** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Event.md b/docs/Event.md index 7045244..08067b5 100644 --- a/docs/Event.md +++ b/docs/Event.md @@ -1,5 +1,6 @@ # Event +Event represents a single event that occurred in the system. ## Properties diff --git a/docs/EventDetails.md b/docs/EventDetails.md index 88ee54e..42eafe2 100644 --- a/docs/EventDetails.md +++ b/docs/EventDetails.md @@ -14,10 +14,9 @@ Name | Type | Description | Notes **resolution_type** | **str** | How the conflict was resolved. | **assigned_owner** | **str** | The fleet assigned as owner (null if no owner). | [optional] **previous_matching_fleets** | **List[str]** | List of fleets that previously matched the device. | [optional] -**task_type** | **str** | The type of internal task that failed. | -**error_message** | **str** | The error message describing the failure. | -**retry_count** | **int** | Number of times the task has been retried. | [optional] -**task_parameters** | **Dict[str, str]** | Parameters needed to retry the task. | [optional] +**error_message** | **str** | The error message describing the permanent failure. | +**retry_count** | **int** | Number of times the task was retried before being marked as permanently failed. | +**original_event** | [**Event**](Event.md) | | **commit_hash** | **str** | Hash of the last commit. | **change_count** | **int** | Number of changes introduced by this ResourceSync update. | **error_count** | **int** | Number of errors encountered by this ResourceSync update. | diff --git a/docs/ImageVolumeSource.md b/docs/ImageVolumeSource.md index 3e0bbd5..1d0234e 100644 --- a/docs/ImageVolumeSource.md +++ b/docs/ImageVolumeSource.md @@ -7,7 +7,7 @@ Describes the source of an OCI-compliant image or artifact. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **reference** | **str** | Reference to an OCI-compliant image or artifact in a registry. This may be a container image or another type of OCI artifact, as long as it conforms to the OCI image specification. | -**pull_policy** | [**ImagePullPolicy**](ImagePullPolicy.md) | | [optional] [default to ImagePullPolicy.IFNOTPRESENT] +**pull_policy** | [**ImagePullPolicy**](ImagePullPolicy.md) | | [optional] [default to ImagePullPolicy.NUMBER_PullIfNotPresent] ## Example diff --git a/docs/InternalTaskFailedDetails.md b/docs/InternalTaskFailedDetails.md index e0e0ab5..cd733ed 100644 --- a/docs/InternalTaskFailedDetails.md +++ b/docs/InternalTaskFailedDetails.md @@ -6,10 +6,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **detail_type** | **str** | The type of detail for discriminator purposes. | -**task_type** | **str** | The type of internal task that failed. | **error_message** | **str** | The error message describing the failure. | **retry_count** | **int** | Number of times the task has been retried. | [optional] -**task_parameters** | **Dict[str, str]** | Parameters needed to retry the task. | [optional] +**original_event** | [**Event**](Event.md) | | ## Example diff --git a/docs/InternalTaskPermanentlyFailedDetails.md b/docs/InternalTaskPermanentlyFailedDetails.md new file mode 100644 index 0000000..a356835 --- /dev/null +++ b/docs/InternalTaskPermanentlyFailedDetails.md @@ -0,0 +1,32 @@ +# InternalTaskPermanentlyFailedDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**detail_type** | **str** | The type of detail for discriminator purposes. | +**error_message** | **str** | The error message describing the permanent failure. | +**retry_count** | **int** | Number of times the task was retried before being marked as permanently failed. | +**original_event** | [**Event**](Event.md) | | + +## Example + +```python +from flightctl.models.internal_task_permanently_failed_details import InternalTaskPermanentlyFailedDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of InternalTaskPermanentlyFailedDetails from a JSON string +internal_task_permanently_failed_details_instance = InternalTaskPermanentlyFailedDetails.from_json(json) +# print the JSON string representation of the object +print(InternalTaskPermanentlyFailedDetails.to_json()) + +# convert the object into a dict +internal_task_permanently_failed_details_dict = internal_task_permanently_failed_details_instance.to_dict() +# create an instance of InternalTaskPermanentlyFailedDetails from a dict +internal_task_permanently_failed_details_from_dict = InternalTaskPermanentlyFailedDetails.from_dict(internal_task_permanently_failed_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/flightctl/__init__.py b/flightctl/__init__.py index f1e98cc..b14bc65 100644 --- a/flightctl/__init__.py +++ b/flightctl/__init__.py @@ -21,6 +21,7 @@ from flightctl.api.authentication_api import AuthenticationApi from flightctl.api.certificatesigningrequest_api import CertificatesigningrequestApi from flightctl.api.device_api import DeviceApi +from flightctl.api.deviceactions_api import DeviceactionsApi from flightctl.api.enrollmentrequest_api import EnrollmentrequestApi from flightctl.api.event_api import EventApi from flightctl.api.fleet_api import FleetApi @@ -53,6 +54,7 @@ from flightctl.models.application_volume_status import ApplicationVolumeStatus from flightctl.models.applications_summary_status_type import ApplicationsSummaryStatusType from flightctl.models.auth_config import AuthConfig +from flightctl.models.auth_organizations_config import AuthOrganizationsConfig from flightctl.models.batch import Batch from flightctl.models.batch_limit import BatchLimit from flightctl.models.batch_sequence import BatchSequence @@ -76,6 +78,7 @@ from flightctl.models.device_integrity_check_status_type import DeviceIntegrityCheckStatusType from flightctl.models.device_integrity_status import DeviceIntegrityStatus from flightctl.models.device_integrity_status_summary_type import DeviceIntegrityStatusSummaryType +from flightctl.models.device_last_seen import DeviceLastSeen from flightctl.models.device_lifecycle_hook_type import DeviceLifecycleHookType from flightctl.models.device_lifecycle_status import DeviceLifecycleStatus from flightctl.models.device_lifecycle_status_type import DeviceLifecycleStatusType @@ -87,6 +90,8 @@ from flightctl.models.device_ownership_changed_details import DeviceOwnershipChangedDetails from flightctl.models.device_resource_status import DeviceResourceStatus from flightctl.models.device_resource_status_type import DeviceResourceStatusType +from flightctl.models.device_resume_request import DeviceResumeRequest +from flightctl.models.device_resume_response import DeviceResumeResponse from flightctl.models.device_spec import DeviceSpec from flightctl.models.device_spec_systemd import DeviceSpecSystemd from flightctl.models.device_status import DeviceStatus @@ -148,6 +153,7 @@ from flightctl.models.inline_application_provider_spec import InlineApplicationProviderSpec from flightctl.models.inline_config_provider_spec import InlineConfigProviderSpec from flightctl.models.internal_task_failed_details import InternalTaskFailedDetails +from flightctl.models.internal_task_permanently_failed_details import InternalTaskPermanentlyFailedDetails from flightctl.models.kubernetes_secret_provider_spec import KubernetesSecretProviderSpec from flightctl.models.kubernetes_secret_provider_spec_secret_ref import KubernetesSecretProviderSpecSecretRef from flightctl.models.label_selector import LabelSelector diff --git a/flightctl/api/__init__.py b/flightctl/api/__init__.py index c649bbb..683cb1e 100644 --- a/flightctl/api/__init__.py +++ b/flightctl/api/__init__.py @@ -4,6 +4,7 @@ from flightctl.api.authentication_api import AuthenticationApi from flightctl.api.certificatesigningrequest_api import CertificatesigningrequestApi from flightctl.api.device_api import DeviceApi +from flightctl.api.deviceactions_api import DeviceactionsApi from flightctl.api.enrollmentrequest_api import EnrollmentrequestApi from flightctl.api.event_api import EventApi from flightctl.api.fleet_api import FleetApi diff --git a/flightctl/api/device_api.py b/flightctl/api/device_api.py index 93fb6c7..63887ec 100644 --- a/flightctl/api/device_api.py +++ b/flightctl/api/device_api.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from flightctl.models.device import Device from flightctl.models.device_decommission import DeviceDecommission +from flightctl.models.device_last_seen import DeviceLastSeen from flightctl.models.device_list import DeviceList from flightctl.models.patch_request_inner import PatchRequestInner from flightctl.models.status import Status @@ -1191,6 +1192,284 @@ def _get_device_serialize( + @validate_call + def get_device_last_seen( + self, + name: Annotated[StrictStr, Field(description="The name of the Device resource to get the last seen timestamp for.")], + _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, + ) -> DeviceLastSeen: + """get_device_last_seen + + Get the last seen timestamp of the Device resource. + + :param name: The name of the Device resource to get the last seen timestamp for. (required) + :type name: str + :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. + """ # noqa: E501 + + _param = self._get_device_last_seen_serialize( + name=name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceLastSeen", + '204': None, + '401': "Status", + '403': "Status", + '404': "Status", + '429': "Status", + '503': "Status", + } + 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 + + + @validate_call + def get_device_last_seen_with_http_info( + self, + name: Annotated[StrictStr, Field(description="The name of the Device resource to get the last seen timestamp for.")], + _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, + ) -> ApiResponse[DeviceLastSeen]: + """get_device_last_seen + + Get the last seen timestamp of the Device resource. + + :param name: The name of the Device resource to get the last seen timestamp for. (required) + :type name: str + :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. + """ # noqa: E501 + + _param = self._get_device_last_seen_serialize( + name=name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceLastSeen", + '204': None, + '401': "Status", + '403': "Status", + '404': "Status", + '429': "Status", + '503': "Status", + } + 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, + ) + + + @validate_call + def get_device_last_seen_without_preload_content( + self, + name: Annotated[StrictStr, Field(description="The name of the Device resource to get the last seen timestamp for.")], + _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, + ) -> RESTResponseType: + """get_device_last_seen + + Get the last seen timestamp of the Device resource. + + :param name: The name of the Device resource to get the last seen timestamp for. (required) + :type name: str + :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. + """ # noqa: E501 + + _param = self._get_device_last_seen_serialize( + name=name, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceLastSeen", + '204': None, + '401': "Status", + '403': "Status", + '404': "Status", + '429': "Status", + '503': "Status", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_device_last_seen_serialize( + self, + name, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if name is not None: + _path_params['name'] = name + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/devices/{name}/lastseen', + 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_device_status( self, diff --git a/flightctl/api/deviceactions_api.py b/flightctl/api/deviceactions_api.py new file mode 100644 index 0000000..9a7e5cc --- /dev/null +++ b/flightctl/api/deviceactions_api.py @@ -0,0 +1,327 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from typing import Optional +from flightctl.models.device_resume_request import DeviceResumeRequest +from flightctl.models.device_resume_response import DeviceResumeResponse + +from flightctl.api_client import ApiClient, RequestSerialized +from flightctl.api_response import ApiResponse +from flightctl.rest import RESTResponseType + + +class DeviceactionsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + 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 resume_devices( + self, + device_resume_request: Optional[DeviceResumeRequest], + _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, + ) -> DeviceResumeResponse: + """resume_devices + + Resume devices based on label selector and/or field selector. + + :param device_resume_request: (required) + :type device_resume_request: DeviceResumeRequest + :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. + """ # noqa: E501 + + _param = self._resume_devices_serialize( + device_resume_request=device_resume_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceResumeResponse", + '400': "Status", + '401': "Status", + '403': "Status", + '429': "Status", + '503': "Status", + } + 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 + + + @validate_call + def resume_devices_with_http_info( + self, + device_resume_request: Optional[DeviceResumeRequest], + _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, + ) -> ApiResponse[DeviceResumeResponse]: + """resume_devices + + Resume devices based on label selector and/or field selector. + + :param device_resume_request: (required) + :type device_resume_request: DeviceResumeRequest + :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. + """ # noqa: E501 + + _param = self._resume_devices_serialize( + device_resume_request=device_resume_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceResumeResponse", + '400': "Status", + '401': "Status", + '403': "Status", + '429': "Status", + '503': "Status", + } + 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, + ) + + + @validate_call + def resume_devices_without_preload_content( + self, + device_resume_request: Optional[DeviceResumeRequest], + _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, + ) -> RESTResponseType: + """resume_devices + + Resume devices based on label selector and/or field selector. + + :param device_resume_request: (required) + :type device_resume_request: DeviceResumeRequest + :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. + """ # noqa: E501 + + _param = self._resume_devices_serialize( + device_resume_request=device_resume_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeviceResumeResponse", + '400': "Status", + '401': "Status", + '403': "Status", + '429': "Status", + '503': "Status", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _resume_devices_serialize( + self, + device_resume_request, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if device_resume_request is not None: + _body_params = device_resume_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _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='/api/v1/deviceactions/resume', + 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/flightctl/models/__init__.py b/flightctl/models/__init__.py index 55bb599..e67ce39 100644 --- a/flightctl/models/__init__.py +++ b/flightctl/models/__init__.py @@ -26,6 +26,7 @@ from flightctl.models.application_volume_status import ApplicationVolumeStatus from flightctl.models.applications_summary_status_type import ApplicationsSummaryStatusType from flightctl.models.auth_config import AuthConfig +from flightctl.models.auth_organizations_config import AuthOrganizationsConfig from flightctl.models.batch import Batch from flightctl.models.batch_limit import BatchLimit from flightctl.models.batch_sequence import BatchSequence @@ -49,6 +50,7 @@ from flightctl.models.device_integrity_check_status_type import DeviceIntegrityCheckStatusType from flightctl.models.device_integrity_status import DeviceIntegrityStatus from flightctl.models.device_integrity_status_summary_type import DeviceIntegrityStatusSummaryType +from flightctl.models.device_last_seen import DeviceLastSeen from flightctl.models.device_lifecycle_hook_type import DeviceLifecycleHookType from flightctl.models.device_lifecycle_status import DeviceLifecycleStatus from flightctl.models.device_lifecycle_status_type import DeviceLifecycleStatusType @@ -60,6 +62,8 @@ from flightctl.models.device_ownership_changed_details import DeviceOwnershipChangedDetails from flightctl.models.device_resource_status import DeviceResourceStatus from flightctl.models.device_resource_status_type import DeviceResourceStatusType +from flightctl.models.device_resume_request import DeviceResumeRequest +from flightctl.models.device_resume_response import DeviceResumeResponse from flightctl.models.device_spec import DeviceSpec from flightctl.models.device_spec_systemd import DeviceSpecSystemd from flightctl.models.device_status import DeviceStatus @@ -121,6 +125,7 @@ from flightctl.models.inline_application_provider_spec import InlineApplicationProviderSpec from flightctl.models.inline_config_provider_spec import InlineConfigProviderSpec from flightctl.models.internal_task_failed_details import InternalTaskFailedDetails +from flightctl.models.internal_task_permanently_failed_details import InternalTaskPermanentlyFailedDetails from flightctl.models.kubernetes_secret_provider_spec import KubernetesSecretProviderSpec from flightctl.models.kubernetes_secret_provider_spec_secret_ref import KubernetesSecretProviderSpecSecretRef from flightctl.models.label_selector import LabelSelector diff --git a/flightctl/models/auth_config.py b/flightctl/models/auth_config.py index ebaa565..67c6cde 100644 --- a/flightctl/models/auth_config.py +++ b/flightctl/models/auth_config.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List +from flightctl.models.auth_organizations_config import AuthOrganizationsConfig from typing import Optional, Set from typing_extensions import Self @@ -29,7 +30,8 @@ class AuthConfig(BaseModel): """ # noqa: E501 auth_type: StrictStr = Field(description="Auth type.", alias="authType") auth_url: StrictStr = Field(description="Auth URL.", alias="authURL") - __properties: ClassVar[List[str]] = ["authType", "authURL"] + auth_organizations_config: AuthOrganizationsConfig = Field(alias="authOrganizationsConfig") + __properties: ClassVar[List[str]] = ["authType", "authURL", "authOrganizationsConfig"] model_config = ConfigDict( populate_by_name=True, @@ -70,6 +72,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of auth_organizations_config + if self.auth_organizations_config: + _dict['authOrganizationsConfig'] = self.auth_organizations_config.to_dict() return _dict @classmethod @@ -83,7 +88,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "authType": obj.get("authType"), - "authURL": obj.get("authURL") + "authURL": obj.get("authURL"), + "authOrganizationsConfig": AuthOrganizationsConfig.from_dict(obj["authOrganizationsConfig"]) if obj.get("authOrganizationsConfig") is not None else None }) return _obj diff --git a/flightctl/models/auth_organizations_config.py b/flightctl/models/auth_organizations_config.py new file mode 100644 index 0000000..5407d91 --- /dev/null +++ b/flightctl/models/auth_organizations_config.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AuthOrganizationsConfig(BaseModel): + """ + Auth related organizations configuration. + """ # noqa: E501 + enabled: StrictBool = Field(description="If true, support for IdP provided organizations is enabled.") + __properties: ClassVar[List[str]] = ["enabled"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthOrganizationsConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthOrganizationsConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if obj.get("enabled") is not None else False + }) + return _obj + + diff --git a/flightctl/models/condition_type.py b/flightctl/models/condition_type.py index 4476fbd..5be5093 100644 --- a/flightctl/models/condition_type.py +++ b/flightctl/models/condition_type.py @@ -28,6 +28,7 @@ class ConditionType(str, Enum): allowed enum values """ APPROVED = 'Approved' + TPMVERIFIED = 'TPMVerified' DENIED = 'Denied' FAILED = 'Failed' ACCESSIBLE = 'Accessible' diff --git a/flightctl/models/device_last_seen.py b/flightctl/models/device_last_seen.py new file mode 100644 index 0000000..b9fce2a --- /dev/null +++ b/flightctl/models/device_last_seen.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class DeviceLastSeen(BaseModel): + """ + DeviceLastSeen represents the last seen timestamp of a device. + """ # noqa: E501 + last_seen: datetime = Field(description="The last time the device was seen by the service.", alias="lastSeen") + __properties: ClassVar[List[str]] = ["lastSeen"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeviceLastSeen from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeviceLastSeen from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "lastSeen": obj.get("lastSeen") + }) + return _obj + + diff --git a/flightctl/models/device_resume_request.py b/flightctl/models/device_resume_request.py new file mode 100644 index 0000000..cfe822a --- /dev/null +++ b/flightctl/models/device_resume_request.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DeviceResumeRequest(BaseModel): + """ + Request to resume devices based on label selector and/or field selector. At least one selector must be provided. + """ # noqa: E501 + label_selector: Optional[StrictStr] = Field(default=None, description="A selector to restrict the list of devices to resume by their labels. Uses the same format as Kubernetes label selectors (e.g., \"key1=value1,key2!=value2\").", alias="labelSelector") + field_selector: Optional[StrictStr] = Field(default=None, description="A selector to restrict the list of devices to resume by their fields. Uses the same format as Kubernetes field selectors (e.g., \"metadata.name=device1,status.phase!=Pending\").", alias="fieldSelector") + __properties: ClassVar[List[str]] = [] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeviceResumeRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeviceResumeRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + }) + return _obj + + diff --git a/flightctl/models/device_resume_response.py b/flightctl/models/device_resume_response.py new file mode 100644 index 0000000..d27a3c5 --- /dev/null +++ b/flightctl/models/device_resume_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class DeviceResumeResponse(BaseModel): + """ + Response from resuming devices. + """ # noqa: E501 + resumed_devices: StrictInt = Field(description="Number of devices that were successfully resumed.", alias="resumedDevices") + __properties: ClassVar[List[str]] = ["resumedDevices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeviceResumeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeviceResumeResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "resumedDevices": obj.get("resumedDevices") + }) + return _obj + + diff --git a/flightctl/models/device_status.py b/flightctl/models/device_status.py index 509a90d..34dfe32 100644 --- a/flightctl/models/device_status.py +++ b/flightctl/models/device_status.py @@ -20,7 +20,7 @@ from datetime import datetime from pydantic import BaseModel, ConfigDict, Field -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional from flightctl.models.condition import Condition from flightctl.models.device_application_status import DeviceApplicationStatus from flightctl.models.device_applications_summary_status import DeviceApplicationsSummaryStatus @@ -49,7 +49,7 @@ class DeviceStatus(BaseModel): os: DeviceOsStatus updated: DeviceUpdatedStatus summary: DeviceSummaryStatus - last_seen: datetime = Field(description="The last time the device was seen by the service.", alias="lastSeen") + last_seen: Optional[datetime] = Field(default=None, description="The last time the device was seen by the service (NOTE: this property is not returned by the API).", alias="lastSeen") lifecycle: DeviceLifecycleStatus __properties: ClassVar[List[str]] = ["conditions", "systemInfo", "applications", "applicationsSummary", "resources", "integrity", "config", "os", "updated", "summary", "lastSeen", "lifecycle"] diff --git a/flightctl/models/device_summary_status_type.py b/flightctl/models/device_summary_status_type.py index b089776..afb2d2f 100644 --- a/flightctl/models/device_summary_status_type.py +++ b/flightctl/models/device_summary_status_type.py @@ -33,6 +33,8 @@ class DeviceSummaryStatusType(str, Enum): REBOOTING = 'Rebooting' POWEREDOFF = 'PoweredOff' UNKNOWN = 'Unknown' + AWAITINGRECONNECT = 'AwaitingReconnect' + CONFLICTPAUSED = 'ConflictPaused' @classmethod def from_json(cls, json_str: str) -> Self: diff --git a/flightctl/models/event.py b/flightctl/models/event.py index 1e5902d..ca014f1 100644 --- a/flightctl/models/event.py +++ b/flightctl/models/event.py @@ -20,7 +20,6 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from flightctl.models.event_details import EventDetails from flightctl.models.event_source import EventSource from flightctl.models.object_meta import ObjectMeta from flightctl.models.object_reference import ObjectReference @@ -29,7 +28,7 @@ class Event(BaseModel): """ - Event + Event represents a single event that occurred in the system. """ # noqa: E501 api_version: StrictStr = Field(description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources.", alias="apiVersion") kind: StrictStr = Field(description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds.") @@ -46,8 +45,8 @@ class Event(BaseModel): @field_validator('reason') def reason_validate_enum(cls, value): """Validates the enum""" - if value not in set(['ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed', 'DeviceDecommissioned', 'DeviceDecommissionFailed', 'DeviceCPUCritical', 'DeviceCPUWarning', 'DeviceCPUNormal', 'DeviceMemoryCritical', 'DeviceMemoryWarning', 'DeviceMemoryNormal', 'DeviceDiskCritical', 'DeviceDiskWarning', 'DeviceDiskNormal', 'DeviceApplicationError', 'DeviceApplicationDegraded', 'DeviceApplicationHealthy', 'DeviceDisconnected', 'DeviceIsRebooting', 'DeviceConnected', 'DeviceContentUpToDate', 'DeviceContentOutOfDate', 'DeviceContentUpdating', 'DeviceUpdateFailed', 'EnrollmentRequestApproved', 'EnrollmentRequestApprovalFailed', 'DeviceMultipleOwnersDetected', 'DeviceMultipleOwnersResolved', 'DeviceSpecValid', 'DeviceSpecInvalid', 'InternalTaskFailed', 'RepositoryAccessible', 'RepositoryInaccessible', 'ReferencedRepositoryUpdated', 'FleetValid', 'FleetInvalid', 'FleetRolloutCreated', 'FleetRolloutStarted', 'FleetRolloutFailed', 'FleetRolloutCompleted', 'FleetRolloutBatchDispatched', 'FleetRolloutDeviceSelected', 'FleetRolloutBatchCompleted', 'ResourceSyncCommitDetected', 'ResourceSyncAccessible', 'ResourceSyncInaccessible', 'ResourceSyncParsed', 'ResourceSyncParsingFailed', 'ResourceSyncSynced', 'ResourceSyncSyncFailed']): - raise ValueError("must be one of enum values ('ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed', 'DeviceDecommissioned', 'DeviceDecommissionFailed', 'DeviceCPUCritical', 'DeviceCPUWarning', 'DeviceCPUNormal', 'DeviceMemoryCritical', 'DeviceMemoryWarning', 'DeviceMemoryNormal', 'DeviceDiskCritical', 'DeviceDiskWarning', 'DeviceDiskNormal', 'DeviceApplicationError', 'DeviceApplicationDegraded', 'DeviceApplicationHealthy', 'DeviceDisconnected', 'DeviceIsRebooting', 'DeviceConnected', 'DeviceContentUpToDate', 'DeviceContentOutOfDate', 'DeviceContentUpdating', 'DeviceUpdateFailed', 'EnrollmentRequestApproved', 'EnrollmentRequestApprovalFailed', 'DeviceMultipleOwnersDetected', 'DeviceMultipleOwnersResolved', 'DeviceSpecValid', 'DeviceSpecInvalid', 'InternalTaskFailed', 'RepositoryAccessible', 'RepositoryInaccessible', 'ReferencedRepositoryUpdated', 'FleetValid', 'FleetInvalid', 'FleetRolloutCreated', 'FleetRolloutStarted', 'FleetRolloutFailed', 'FleetRolloutCompleted', 'FleetRolloutBatchDispatched', 'FleetRolloutDeviceSelected', 'FleetRolloutBatchCompleted', 'ResourceSyncCommitDetected', 'ResourceSyncAccessible', 'ResourceSyncInaccessible', 'ResourceSyncParsed', 'ResourceSyncParsingFailed', 'ResourceSyncSynced', 'ResourceSyncSyncFailed')") + if value not in set(['ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed', 'DeviceDecommissioned', 'DeviceDecommissionFailed', 'DeviceCPUCritical', 'DeviceCPUWarning', 'DeviceCPUNormal', 'DeviceMemoryCritical', 'DeviceMemoryWarning', 'DeviceMemoryNormal', 'DeviceDiskCritical', 'DeviceDiskWarning', 'DeviceDiskNormal', 'DeviceApplicationError', 'DeviceApplicationDegraded', 'DeviceApplicationHealthy', 'DeviceDisconnected', 'DeviceIsRebooting', 'DeviceConflictPaused', 'DeviceConflictResolved', 'DeviceConnected', 'DeviceContentUpToDate', 'DeviceContentOutOfDate', 'DeviceContentUpdating', 'DeviceUpdateFailed', 'EnrollmentRequestApproved', 'EnrollmentRequestApprovalFailed', 'DeviceMultipleOwnersDetected', 'DeviceMultipleOwnersResolved', 'DeviceSpecValid', 'DeviceSpecInvalid', 'InternalTaskFailed', 'InternalTaskPermanentlyFailed', 'RepositoryAccessible', 'RepositoryInaccessible', 'ReferencedRepositoryUpdated', 'FleetValid', 'FleetInvalid', 'FleetRolloutCreated', 'FleetRolloutStarted', 'FleetRolloutFailed', 'FleetRolloutCompleted', 'FleetRolloutBatchDispatched', 'FleetRolloutDeviceSelected', 'FleetRolloutBatchCompleted', 'ResourceSyncCommitDetected', 'ResourceSyncAccessible', 'ResourceSyncInaccessible', 'ResourceSyncParsed', 'ResourceSyncParsingFailed', 'ResourceSyncSynced', 'ResourceSyncSyncFailed', 'SystemRestored']): + raise ValueError("must be one of enum values ('ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed', 'DeviceDecommissioned', 'DeviceDecommissionFailed', 'DeviceCPUCritical', 'DeviceCPUWarning', 'DeviceCPUNormal', 'DeviceMemoryCritical', 'DeviceMemoryWarning', 'DeviceMemoryNormal', 'DeviceDiskCritical', 'DeviceDiskWarning', 'DeviceDiskNormal', 'DeviceApplicationError', 'DeviceApplicationDegraded', 'DeviceApplicationHealthy', 'DeviceDisconnected', 'DeviceIsRebooting', 'DeviceConflictPaused', 'DeviceConflictResolved', 'DeviceConnected', 'DeviceContentUpToDate', 'DeviceContentOutOfDate', 'DeviceContentUpdating', 'DeviceUpdateFailed', 'EnrollmentRequestApproved', 'EnrollmentRequestApprovalFailed', 'DeviceMultipleOwnersDetected', 'DeviceMultipleOwnersResolved', 'DeviceSpecValid', 'DeviceSpecInvalid', 'InternalTaskFailed', 'InternalTaskPermanentlyFailed', 'RepositoryAccessible', 'RepositoryInaccessible', 'ReferencedRepositoryUpdated', 'FleetValid', 'FleetInvalid', 'FleetRolloutCreated', 'FleetRolloutStarted', 'FleetRolloutFailed', 'FleetRolloutCompleted', 'FleetRolloutBatchDispatched', 'FleetRolloutDeviceSelected', 'FleetRolloutBatchCompleted', 'ResourceSyncCommitDetected', 'ResourceSyncAccessible', 'ResourceSyncInaccessible', 'ResourceSyncParsed', 'ResourceSyncParsingFailed', 'ResourceSyncSynced', 'ResourceSyncSyncFailed', 'SystemRestored')") return value @field_validator('type') @@ -133,4 +132,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: }) return _obj +from flightctl.models.event_details import EventDetails +# TODO: Rewrite to not use raise_errors +Event.model_rebuild(raise_errors=False) diff --git a/flightctl/models/event_details.py b/flightctl/models/event_details.py index 48f9d00..c74dc2f 100644 --- a/flightctl/models/event_details.py +++ b/flightctl/models/event_details.py @@ -27,7 +27,6 @@ from flightctl.models.fleet_rollout_device_selected_details import FleetRolloutDeviceSelectedDetails from flightctl.models.fleet_rollout_failed_details import FleetRolloutFailedDetails from flightctl.models.fleet_rollout_started_details import FleetRolloutStartedDetails -from flightctl.models.internal_task_failed_details import InternalTaskFailedDetails from flightctl.models.referenced_repository_updated_details import ReferencedRepositoryUpdatedDetails from flightctl.models.resource_sync_completed_details import ResourceSyncCompletedDetails from flightctl.models.resource_updated_details import ResourceUpdatedDetails @@ -35,7 +34,7 @@ from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -EVENTDETAILS_ONE_OF_SCHEMAS = ["DeviceMultipleOwnersDetectedDetails", "DeviceMultipleOwnersResolvedDetails", "DeviceOwnershipChangedDetails", "FleetRolloutBatchCompletedDetails", "FleetRolloutBatchDispatchedDetails", "FleetRolloutCompletedDetails", "FleetRolloutDeviceSelectedDetails", "FleetRolloutFailedDetails", "FleetRolloutStartedDetails", "InternalTaskFailedDetails", "ReferencedRepositoryUpdatedDetails", "ResourceSyncCompletedDetails", "ResourceUpdatedDetails"] +EVENTDETAILS_ONE_OF_SCHEMAS = ["DeviceMultipleOwnersDetectedDetails", "DeviceMultipleOwnersResolvedDetails", "DeviceOwnershipChangedDetails", "FleetRolloutBatchCompletedDetails", "FleetRolloutBatchDispatchedDetails", "FleetRolloutCompletedDetails", "FleetRolloutDeviceSelectedDetails", "FleetRolloutFailedDetails", "FleetRolloutStartedDetails", "InternalTaskFailedDetails", "InternalTaskPermanentlyFailedDetails", "ReferencedRepositoryUpdatedDetails", "ResourceSyncCompletedDetails", "ResourceUpdatedDetails"] class EventDetails(BaseModel): """ @@ -51,24 +50,26 @@ class EventDetails(BaseModel): oneof_schema_4_validator: Optional[DeviceMultipleOwnersResolvedDetails] = None # data type: InternalTaskFailedDetails oneof_schema_5_validator: Optional[InternalTaskFailedDetails] = None + # data type: InternalTaskPermanentlyFailedDetails + oneof_schema_6_validator: Optional[InternalTaskPermanentlyFailedDetails] = None # data type: ResourceSyncCompletedDetails - oneof_schema_6_validator: Optional[ResourceSyncCompletedDetails] = None + oneof_schema_7_validator: Optional[ResourceSyncCompletedDetails] = None # data type: ReferencedRepositoryUpdatedDetails - oneof_schema_7_validator: Optional[ReferencedRepositoryUpdatedDetails] = None + oneof_schema_8_validator: Optional[ReferencedRepositoryUpdatedDetails] = None # data type: FleetRolloutStartedDetails - oneof_schema_8_validator: Optional[FleetRolloutStartedDetails] = None + oneof_schema_9_validator: Optional[FleetRolloutStartedDetails] = None # data type: FleetRolloutFailedDetails - oneof_schema_9_validator: Optional[FleetRolloutFailedDetails] = None + oneof_schema_10_validator: Optional[FleetRolloutFailedDetails] = None # data type: FleetRolloutCompletedDetails - oneof_schema_10_validator: Optional[FleetRolloutCompletedDetails] = None + oneof_schema_11_validator: Optional[FleetRolloutCompletedDetails] = None # data type: FleetRolloutBatchDispatchedDetails - oneof_schema_11_validator: Optional[FleetRolloutBatchDispatchedDetails] = None + oneof_schema_12_validator: Optional[FleetRolloutBatchDispatchedDetails] = None # data type: FleetRolloutBatchCompletedDetails - oneof_schema_12_validator: Optional[FleetRolloutBatchCompletedDetails] = None + oneof_schema_13_validator: Optional[FleetRolloutBatchCompletedDetails] = None # data type: FleetRolloutDeviceSelectedDetails - oneof_schema_13_validator: Optional[FleetRolloutDeviceSelectedDetails] = None - actual_instance: Optional[Union[DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails]] = None - one_of_schemas: Set[str] = { "DeviceMultipleOwnersDetectedDetails", "DeviceMultipleOwnersResolvedDetails", "DeviceOwnershipChangedDetails", "FleetRolloutBatchCompletedDetails", "FleetRolloutBatchDispatchedDetails", "FleetRolloutCompletedDetails", "FleetRolloutDeviceSelectedDetails", "FleetRolloutFailedDetails", "FleetRolloutStartedDetails", "InternalTaskFailedDetails", "ReferencedRepositoryUpdatedDetails", "ResourceSyncCompletedDetails", "ResourceUpdatedDetails" } + oneof_schema_14_validator: Optional[FleetRolloutDeviceSelectedDetails] = None + actual_instance: Optional[Union[DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails]] = None + one_of_schemas: Set[str] = { "DeviceMultipleOwnersDetectedDetails", "DeviceMultipleOwnersResolvedDetails", "DeviceOwnershipChangedDetails", "FleetRolloutBatchCompletedDetails", "FleetRolloutBatchDispatchedDetails", "FleetRolloutCompletedDetails", "FleetRolloutDeviceSelectedDetails", "FleetRolloutFailedDetails", "FleetRolloutStartedDetails", "InternalTaskFailedDetails", "InternalTaskPermanentlyFailedDetails", "ReferencedRepositoryUpdatedDetails", "ResourceSyncCompletedDetails", "ResourceUpdatedDetails" } model_config = ConfigDict( validate_assignment=True, @@ -119,6 +120,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `InternalTaskFailedDetails`") else: match += 1 + # validate data type: InternalTaskPermanentlyFailedDetails + if not isinstance(v, InternalTaskPermanentlyFailedDetails): + error_messages.append(f"Error! Input type `{type(v)}` is not `InternalTaskPermanentlyFailedDetails`") + else: + match += 1 # validate data type: ResourceSyncCompletedDetails if not isinstance(v, ResourceSyncCompletedDetails): error_messages.append(f"Error! Input type `{type(v)}` is not `ResourceSyncCompletedDetails`") @@ -161,10 +167,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) else: return v @@ -234,6 +240,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = InternalTaskFailedDetails.from_json(json_str) return instance + # check if data type is `InternalTaskPermanentlyFailedDetails` + if _data_type == "InternalTaskPermanentlyFailed": + instance.actual_instance = InternalTaskPermanentlyFailedDetails.from_json(json_str) + return instance + # check if data type is `ReferencedRepositoryUpdatedDetails` if _data_type == "ReferencedRepositoryUpdated": instance.actual_instance = ReferencedRepositoryUpdatedDetails.from_json(json_str) @@ -299,6 +310,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = InternalTaskFailedDetails.from_json(json_str) return instance + # check if data type is `InternalTaskPermanentlyFailedDetails` + if _data_type == "InternalTaskPermanentlyFailedDetails": + instance.actual_instance = InternalTaskPermanentlyFailedDetails.from_json(json_str) + return instance + # check if data type is `ReferencedRepositoryUpdatedDetails` if _data_type == "ReferencedRepositoryUpdatedDetails": instance.actual_instance = ReferencedRepositoryUpdatedDetails.from_json(json_str) @@ -344,6 +360,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into InternalTaskPermanentlyFailedDetails + try: + instance.actual_instance = InternalTaskPermanentlyFailedDetails.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into ResourceSyncCompletedDetails try: instance.actual_instance = ResourceSyncCompletedDetails.from_json(json_str) @@ -395,10 +417,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into EventDetails with oneOf schemas: DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) else: return instance @@ -412,7 +434,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], DeviceMultipleOwnersDetectedDetails, DeviceMultipleOwnersResolvedDetails, DeviceOwnershipChangedDetails, FleetRolloutBatchCompletedDetails, FleetRolloutBatchDispatchedDetails, FleetRolloutCompletedDetails, FleetRolloutDeviceSelectedDetails, FleetRolloutFailedDetails, FleetRolloutStartedDetails, InternalTaskFailedDetails, InternalTaskPermanentlyFailedDetails, ReferencedRepositoryUpdatedDetails, ResourceSyncCompletedDetails, ResourceUpdatedDetails]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None @@ -427,4 +449,8 @@ def to_str(self) -> str: """Returns the string representation of the actual instance""" return pprint.pformat(self.model_dump()) +from flightctl.models.internal_task_failed_details import InternalTaskFailedDetails +from flightctl.models.internal_task_permanently_failed_details import InternalTaskPermanentlyFailedDetails +# TODO: Rewrite to not use raise_errors +EventDetails.model_rebuild(raise_errors=False) diff --git a/flightctl/models/internal_task_failed_details.py b/flightctl/models/internal_task_failed_details.py index 4e51500..962ab59 100644 --- a/flightctl/models/internal_task_failed_details.py +++ b/flightctl/models/internal_task_failed_details.py @@ -28,11 +28,10 @@ class InternalTaskFailedDetails(BaseModel): InternalTaskFailedDetails """ # noqa: E501 detail_type: StrictStr = Field(description="The type of detail for discriminator purposes.", alias="detailType") - task_type: StrictStr = Field(description="The type of internal task that failed.", alias="taskType") error_message: StrictStr = Field(description="The error message describing the failure.", alias="errorMessage") retry_count: Optional[StrictInt] = Field(default=None, description="Number of times the task has been retried.", alias="retryCount") - task_parameters: Optional[Dict[str, StrictStr]] = Field(default=None, description="Parameters needed to retry the task.", alias="taskParameters") - __properties: ClassVar[List[str]] = ["detailType", "taskType", "errorMessage", "retryCount", "taskParameters"] + original_event: Event = Field(alias="originalEvent") + __properties: ClassVar[List[str]] = ["detailType", "errorMessage", "retryCount", "originalEvent"] @field_validator('detail_type') def detail_type_validate_enum(cls, value): @@ -80,6 +79,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of original_event + if self.original_event: + _dict['originalEvent'] = self.original_event.to_dict() return _dict @classmethod @@ -93,11 +95,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "detailType": obj.get("detailType"), - "taskType": obj.get("taskType"), "errorMessage": obj.get("errorMessage"), "retryCount": obj.get("retryCount"), - "taskParameters": obj.get("taskParameters") + "originalEvent": Event.from_dict(obj["originalEvent"]) if obj.get("originalEvent") is not None else None }) return _obj +from flightctl.models.event import Event +# TODO: Rewrite to not use raise_errors +InternalTaskFailedDetails.model_rebuild(raise_errors=False) diff --git a/flightctl/models/internal_task_permanently_failed_details.py b/flightctl/models/internal_task_permanently_failed_details.py new file mode 100644 index 0000000..efd093a --- /dev/null +++ b/flightctl/models/internal_task_permanently_failed_details.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class InternalTaskPermanentlyFailedDetails(BaseModel): + """ + InternalTaskPermanentlyFailedDetails + """ # noqa: E501 + detail_type: StrictStr = Field(description="The type of detail for discriminator purposes.", alias="detailType") + error_message: StrictStr = Field(description="The error message describing the permanent failure.", alias="errorMessage") + retry_count: StrictInt = Field(description="Number of times the task was retried before being marked as permanently failed.", alias="retryCount") + original_event: Event = Field(alias="originalEvent") + __properties: ClassVar[List[str]] = ["detailType", "errorMessage", "retryCount", "originalEvent"] + + @field_validator('detail_type') + def detail_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['InternalTaskPermanentlyFailed']): + raise ValueError("must be one of enum values ('InternalTaskPermanentlyFailed')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InternalTaskPermanentlyFailedDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of original_event + if self.original_event: + _dict['originalEvent'] = self.original_event.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InternalTaskPermanentlyFailedDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "detailType": obj.get("detailType"), + "errorMessage": obj.get("errorMessage"), + "retryCount": obj.get("retryCount"), + "originalEvent": Event.from_dict(obj["originalEvent"]) if obj.get("originalEvent") is not None else None + }) + return _obj + +from flightctl.models.event import Event +# TODO: Rewrite to not use raise_errors +InternalTaskPermanentlyFailedDetails.model_rebuild(raise_errors=False) + diff --git a/flightctl/models/patch_request_inner.py b/flightctl/models/patch_request_inner.py index 32d90f9..d1d2afd 100644 --- a/flightctl/models/patch_request_inner.py +++ b/flightctl/models/patch_request_inner.py @@ -35,8 +35,8 @@ class PatchRequestInner(BaseModel): @field_validator('op') def op_validate_enum(cls, value): """Validates the enum""" - if value not in set(['add', 'replace', 'remove']): - raise ValueError("must be one of enum values ('add', 'replace', 'remove')") + if value not in set(['add', 'replace', 'remove', 'test']): + raise ValueError("must be one of enum values ('add', 'replace', 'remove', 'test')") return value model_config = ConfigDict( diff --git a/test/test_auth_organizations_config.py b/test/test_auth_organizations_config.py new file mode 100644 index 0000000..86261ba --- /dev/null +++ b/test/test_auth_organizations_config.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.models.auth_organizations_config import AuthOrganizationsConfig + +class TestAuthOrganizationsConfig(unittest.TestCase): + """AuthOrganizationsConfig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AuthOrganizationsConfig: + """Test AuthOrganizationsConfig + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AuthOrganizationsConfig` + """ + model = AuthOrganizationsConfig() + if include_optional: + return AuthOrganizationsConfig( + enabled = True + ) + else: + return AuthOrganizationsConfig( + enabled = True, + ) + """ + + def testAuthOrganizationsConfig(self): + """Test AuthOrganizationsConfig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_device_last_seen.py b/test/test_device_last_seen.py new file mode 100644 index 0000000..801465e --- /dev/null +++ b/test/test_device_last_seen.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.models.device_last_seen import DeviceLastSeen + +class TestDeviceLastSeen(unittest.TestCase): + """DeviceLastSeen unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeviceLastSeen: + """Test DeviceLastSeen + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeviceLastSeen` + """ + model = DeviceLastSeen() + if include_optional: + return DeviceLastSeen( + last_seen = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') + ) + else: + return DeviceLastSeen( + last_seen = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + ) + """ + + def testDeviceLastSeen(self): + """Test DeviceLastSeen""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_device_resume_request.py b/test/test_device_resume_request.py new file mode 100644 index 0000000..5e09800 --- /dev/null +++ b/test/test_device_resume_request.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.models.device_resume_request import DeviceResumeRequest + +class TestDeviceResumeRequest(unittest.TestCase): + """DeviceResumeRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeviceResumeRequest: + """Test DeviceResumeRequest + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeviceResumeRequest` + """ + model = DeviceResumeRequest() + if include_optional: + return DeviceResumeRequest( + label_selector = '', + field_selector = '' + ) + else: + return DeviceResumeRequest( + ) + """ + + def testDeviceResumeRequest(self): + """Test DeviceResumeRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_device_resume_response.py b/test/test_device_resume_response.py new file mode 100644 index 0000000..f0ffd01 --- /dev/null +++ b/test/test_device_resume_response.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.models.device_resume_response import DeviceResumeResponse + +class TestDeviceResumeResponse(unittest.TestCase): + """DeviceResumeResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeviceResumeResponse: + """Test DeviceResumeResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `DeviceResumeResponse` + """ + model = DeviceResumeResponse() + if include_optional: + return DeviceResumeResponse( + resumed_devices = 56 + ) + else: + return DeviceResumeResponse( + resumed_devices = 56, + ) + """ + + def testDeviceResumeResponse(self): + """Test DeviceResumeResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_deviceactions_api.py b/test/test_deviceactions_api.py new file mode 100644 index 0000000..c04b7a4 --- /dev/null +++ b/test/test_deviceactions_api.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.api.deviceactions_api import DeviceactionsApi + + +class TestDeviceactionsApi(unittest.TestCase): + """DeviceactionsApi unit test stubs""" + + def setUp(self) -> None: + self.api = DeviceactionsApi() + + def tearDown(self) -> None: + pass + + def test_resume_devices(self) -> None: + """Test case for resume_devices + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_internal_task_permanently_failed_details.py b/test/test_internal_task_permanently_failed_details.py new file mode 100644 index 0000000..98d5ec2 --- /dev/null +++ b/test/test_internal_task_permanently_failed_details.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Flight Control API + + [Flight Control](https://flightctl.io) is a service for declarative management of fleets of edge devices and their workloads. + + The version of the OpenAPI document: v1alpha1 + Contact: team@flightctl.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from flightctl.models.internal_task_permanently_failed_details import InternalTaskPermanentlyFailedDetails + +class TestInternalTaskPermanentlyFailedDetails(unittest.TestCase): + """InternalTaskPermanentlyFailedDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> InternalTaskPermanentlyFailedDetails: + """Test InternalTaskPermanentlyFailedDetails + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `InternalTaskPermanentlyFailedDetails` + """ + model = InternalTaskPermanentlyFailedDetails() + if include_optional: + return InternalTaskPermanentlyFailedDetails( + detail_type = 'InternalTaskPermanentlyFailed', + error_message = '', + retry_count = 56, + original_event = flightctl.models.event.Event( + api_version = '', + kind = '', + metadata = flightctl.models.object_meta.ObjectMeta( + creation_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deletion_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + name = '', + labels = { + 'key' : '' + }, + generation = 56, + owner = '', + annotations = { + 'key' : '' + }, + resource_version = '', ), + involved_object = flightctl.models.object_reference.ObjectReference( + kind = '', + name = '', ), + reason = 'ResourceCreated', + message = '', + details = flightctl.models.event_details.EventDetails(), + type = 'Normal', + source = flightctl.models.event_source.EventSource( + component = '', ), + actor = '', ) + ) + else: + return InternalTaskPermanentlyFailedDetails( + detail_type = 'InternalTaskPermanentlyFailed', + error_message = '', + retry_count = 56, + original_event = flightctl.models.event.Event( + api_version = '', + kind = '', + metadata = flightctl.models.object_meta.ObjectMeta( + creation_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deletion_timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + name = '', + labels = { + 'key' : '' + }, + generation = 56, + owner = '', + annotations = { + 'key' : '' + }, + resource_version = '', ), + involved_object = flightctl.models.object_reference.ObjectReference( + kind = '', + name = '', ), + reason = 'ResourceCreated', + message = '', + details = flightctl.models.event_details.EventDetails(), + type = 'Normal', + source = flightctl.models.event_source.EventSource( + component = '', ), + actor = '', ), + ) + """ + + def testInternalTaskPermanentlyFailedDetails(self): + """Test InternalTaskPermanentlyFailedDetails""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()