diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bf36fbe..1cbdbf1 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -25,7 +25,6 @@ docs/ConditionStatus.md docs/ConditionType.md docs/ConfigProviderSpec.md docs/CpuResourceMonitorSpec.md -docs/CustomResourceMonitorSpec.md docs/Device.md docs/DeviceApi.md docs/DeviceApplicationStatus.md @@ -68,6 +67,11 @@ docs/EnrollmentService.md docs/EnrollmentServiceAuth.md docs/EnrollmentServiceService.md docs/EnrollmentrequestApi.md +docs/Event.md +docs/EventApi.md +docs/EventDetails.md +docs/EventList.md +docs/EventSource.md docs/FileContent.md docs/FileMetadata.md docs/FileOperation.md @@ -95,12 +99,13 @@ docs/InlineApplicationProviderSpec.md docs/InlineConfigProviderSpec.md docs/KubernetesSecretProviderSpec.md docs/KubernetesSecretProviderSpecSecretRef.md +docs/LabelApi.md docs/LabelSelector.md -docs/LabelsApi.md docs/ListMeta.md docs/MatchExpression.md docs/MemoryResourceMonitorSpec.md docs/ObjectMeta.md +docs/ObjectReference.md docs/PatchRequestInner.md docs/RelativePath.md docs/RepoSpecType.md @@ -111,12 +116,14 @@ docs/RepositorySpec.md docs/RepositoryStatus.md docs/ResourceAlertRule.md docs/ResourceAlertSeverityType.md +docs/ResourceKind.md docs/ResourceMonitor.md docs/ResourceMonitorSpec.md docs/ResourceSync.md docs/ResourceSyncList.md docs/ResourceSyncSpec.md docs/ResourceSyncStatus.md +docs/ResourceUpdatedDetails.md docs/ResourcesyncApi.md docs/RolloutDeviceSelection.md docs/RolloutPolicy.md @@ -137,8 +144,9 @@ flightctl/api/authentication_api.py flightctl/api/certificatesigningrequest_api.py flightctl/api/device_api.py flightctl/api/enrollmentrequest_api.py +flightctl/api/event_api.py flightctl/api/fleet_api.py -flightctl/api/labels_api.py +flightctl/api/label_api.py flightctl/api/repository_api.py flightctl/api/resourcesync_api.py flightctl/api/version_api.py @@ -167,7 +175,6 @@ flightctl/models/condition_status.py flightctl/models/condition_type.py flightctl/models/config_provider_spec.py flightctl/models/cpu_resource_monitor_spec.py -flightctl/models/custom_resource_monitor_spec.py flightctl/models/device.py flightctl/models/device_application_status.py flightctl/models/device_applications_summary_status.py @@ -208,6 +215,10 @@ flightctl/models/enrollment_request_status.py flightctl/models/enrollment_service.py flightctl/models/enrollment_service_auth.py flightctl/models/enrollment_service_service.py +flightctl/models/event.py +flightctl/models/event_details.py +flightctl/models/event_list.py +flightctl/models/event_source.py flightctl/models/file_content.py flightctl/models/file_metadata.py flightctl/models/file_operation.py @@ -239,6 +250,7 @@ flightctl/models/list_meta.py flightctl/models/match_expression.py flightctl/models/memory_resource_monitor_spec.py flightctl/models/object_meta.py +flightctl/models/object_reference.py flightctl/models/patch_request_inner.py flightctl/models/relative_path.py flightctl/models/repo_spec_type.py @@ -248,12 +260,14 @@ flightctl/models/repository_spec.py flightctl/models/repository_status.py flightctl/models/resource_alert_rule.py flightctl/models/resource_alert_severity_type.py +flightctl/models/resource_kind.py flightctl/models/resource_monitor.py flightctl/models/resource_monitor_spec.py flightctl/models/resource_sync.py flightctl/models/resource_sync_list.py flightctl/models/resource_sync_spec.py flightctl/models/resource_sync_status.py +flightctl/models/resource_updated_details.py flightctl/models/rollout_device_selection.py flightctl/models/rollout_policy.py flightctl/models/rollout_strategy.py @@ -297,7 +311,6 @@ test/test_condition_status.py test/test_condition_type.py test/test_config_provider_spec.py test/test_cpu_resource_monitor_spec.py -test/test_custom_resource_monitor_spec.py test/test_device.py test/test_device_api.py test/test_device_application_status.py @@ -340,6 +353,11 @@ test/test_enrollment_service.py test/test_enrollment_service_auth.py test/test_enrollment_service_service.py test/test_enrollmentrequest_api.py +test/test_event.py +test/test_event_api.py +test/test_event_details.py +test/test_event_list.py +test/test_event_source.py test/test_file_content.py test/test_file_metadata.py test/test_file_operation.py @@ -367,12 +385,13 @@ test/test_inline_application_provider_spec.py test/test_inline_config_provider_spec.py test/test_kubernetes_secret_provider_spec.py test/test_kubernetes_secret_provider_spec_secret_ref.py +test/test_label_api.py test/test_label_selector.py -test/test_labels_api.py test/test_list_meta.py test/test_match_expression.py test/test_memory_resource_monitor_spec.py test/test_object_meta.py +test/test_object_reference.py test/test_patch_request_inner.py test/test_relative_path.py test/test_repo_spec_type.py @@ -383,12 +402,14 @@ test/test_repository_spec.py test/test_repository_status.py test/test_resource_alert_rule.py test/test_resource_alert_severity_type.py +test/test_resource_kind.py test/test_resource_monitor.py test/test_resource_monitor_spec.py test/test_resource_sync.py test/test_resource_sync_list.py test/test_resource_sync_spec.py test/test_resource_sync_status.py +test/test_resource_updated_details.py test/test_resourcesync_api.py test/test_rollout_device_selection.py test/test_rollout_policy.py diff --git a/README.md b/README.md index d28d179..5ef5163 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ Class | Method | HTTP request | Description *EnrollmentrequestApi* | [**patch_enrollment_request_status**](docs/EnrollmentrequestApi.md#patch_enrollment_request_status) | **PATCH** /api/v1/enrollmentrequests/{name}/status | *EnrollmentrequestApi* | [**replace_enrollment_request**](docs/EnrollmentrequestApi.md#replace_enrollment_request) | **PUT** /api/v1/enrollmentrequests/{name} | *EnrollmentrequestApi* | [**replace_enrollment_request_status**](docs/EnrollmentrequestApi.md#replace_enrollment_request_status) | **PUT** /api/v1/enrollmentrequests/{name}/status | +*EventApi* | [**list_events**](docs/EventApi.md#list_events) | **GET** /api/v1/events | *FleetApi* | [**create_fleet**](docs/FleetApi.md#create_fleet) | **POST** /api/v1/fleets | *FleetApi* | [**delete_fleet**](docs/FleetApi.md#delete_fleet) | **DELETE** /api/v1/fleets/{name} | *FleetApi* | [**delete_fleets**](docs/FleetApi.md#delete_fleets) | **DELETE** /api/v1/fleets | @@ -133,7 +134,7 @@ Class | Method | HTTP request | Description *FleetApi* | [**patch_fleet_status**](docs/FleetApi.md#patch_fleet_status) | **PATCH** /api/v1/fleets/{name}/status | *FleetApi* | [**replace_fleet**](docs/FleetApi.md#replace_fleet) | **PUT** /api/v1/fleets/{name} | *FleetApi* | [**replace_fleet_status**](docs/FleetApi.md#replace_fleet_status) | **PUT** /api/v1/fleets/{name}/status | -*LabelsApi* | [**list_labels**](docs/LabelsApi.md#list_labels) | **GET** /api/v1/labels | +*LabelApi* | [**list_labels**](docs/LabelApi.md#list_labels) | **GET** /api/v1/labels | *RepositoryApi* | [**create_repository**](docs/RepositoryApi.md#create_repository) | **POST** /api/v1/repositories | *RepositoryApi* | [**delete_repositories**](docs/RepositoryApi.md#delete_repositories) | **DELETE** /api/v1/repositories | *RepositoryApi* | [**delete_repository**](docs/RepositoryApi.md#delete_repository) | **DELETE** /api/v1/repositories/{name} | @@ -173,7 +174,6 @@ Class | Method | HTTP request | Description - [ConditionType](docs/ConditionType.md) - [ConfigProviderSpec](docs/ConfigProviderSpec.md) - [CpuResourceMonitorSpec](docs/CpuResourceMonitorSpec.md) - - [CustomResourceMonitorSpec](docs/CustomResourceMonitorSpec.md) - [Device](docs/Device.md) - [DeviceApplicationStatus](docs/DeviceApplicationStatus.md) - [DeviceApplicationsSummaryStatus](docs/DeviceApplicationsSummaryStatus.md) @@ -214,6 +214,10 @@ Class | Method | HTTP request | Description - [EnrollmentService](docs/EnrollmentService.md) - [EnrollmentServiceAuth](docs/EnrollmentServiceAuth.md) - [EnrollmentServiceService](docs/EnrollmentServiceService.md) + - [Event](docs/Event.md) + - [EventDetails](docs/EventDetails.md) + - [EventList](docs/EventList.md) + - [EventSource](docs/EventSource.md) - [FileContent](docs/FileContent.md) - [FileMetadata](docs/FileMetadata.md) - [FileOperation](docs/FileOperation.md) @@ -245,6 +249,7 @@ Class | Method | HTTP request | Description - [MatchExpression](docs/MatchExpression.md) - [MemoryResourceMonitorSpec](docs/MemoryResourceMonitorSpec.md) - [ObjectMeta](docs/ObjectMeta.md) + - [ObjectReference](docs/ObjectReference.md) - [PatchRequestInner](docs/PatchRequestInner.md) - [RelativePath](docs/RelativePath.md) - [RepoSpecType](docs/RepoSpecType.md) @@ -254,12 +259,14 @@ Class | Method | HTTP request | Description - [RepositoryStatus](docs/RepositoryStatus.md) - [ResourceAlertRule](docs/ResourceAlertRule.md) - [ResourceAlertSeverityType](docs/ResourceAlertSeverityType.md) + - [ResourceKind](docs/ResourceKind.md) - [ResourceMonitor](docs/ResourceMonitor.md) - [ResourceMonitorSpec](docs/ResourceMonitorSpec.md) - [ResourceSync](docs/ResourceSync.md) - [ResourceSyncList](docs/ResourceSyncList.md) - [ResourceSyncSpec](docs/ResourceSyncSpec.md) - [ResourceSyncStatus](docs/ResourceSyncStatus.md) + - [ResourceUpdatedDetails](docs/ResourceUpdatedDetails.md) - [RolloutDeviceSelection](docs/RolloutDeviceSelection.md) - [RolloutPolicy](docs/RolloutPolicy.md) - [RolloutStrategy](docs/RolloutStrategy.md) diff --git a/api/v1alpha1/openapi.yml b/api/v1alpha1/openapi.yml index 517b5db..5405aa4 100644 --- a/api/v1alpha1/openapi.yml +++ b/api/v1alpha1/openapi.yml @@ -22,9 +22,11 @@ tags: description: Operations on Device resources. - name: enrollmentrequest description: Operations on EnrollmentRequest resources. + - name: event + description: Operations for retrieving events. - name: fleet description: Operations on Fleet resources. - - name: labels + - name: label description: Operations for retrieving labels across different resources. - name: repository description: Operations on Repository resources. @@ -3208,7 +3210,7 @@ paths: /api/v1/labels: get: tags: - - labels + - label description: | Retrieves a distinct list of labels for the specified resource type. operationId: listLabels @@ -3276,8 +3278,67 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/events: + get: + tags: + - event + description: | + Retrieves a list of events. + operationId: listEvents + parameters: + - name: fieldSelector + in: query + description: A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., "key1=value1,key2!=value2"). + schema: + type: string + - name: limit + in: query + description: The maximum number of events to return in the response. + schema: + type: integer + format: int32 + - name: continue + in: query + description: An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EventList' + "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: Not allowed + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + "503": + description: ServiceUnavailable + content: + application/json: + schema: + $ref: '#/components/schemas/Status' components: schemas: + ResourceKind: + type: string + enum: [CertificateSigningRequest, EnrollmentRequest, Device, Fleet, Repository, ResourceSync, TemplateVersion] + description: Resource types exposed via the API. DeviceDecommissionTargetType: type: string enum: @@ -3730,13 +3791,12 @@ components: CPU: '#/components/schemas/CpuResourceMonitorSpec' Memory: '#/components/schemas/MemoryResourceMonitorSpec' Disk: '#/components/schemas/DiskResourceMonitorSpec' + required: + - monitorType ResourceMonitorSpec: type: object description: Specification for monitoring a resource. properties: - monitorType: - type: string - description: The type of resource to monitor. alertRules: type: array items: @@ -3752,13 +3812,31 @@ components: - samplingInterval CpuResourceMonitorSpec: allOf: + - type: object + required: [ monitorType ] + properties: + monitorType: + type: string + description: The type of resource to monitor. - $ref: '#/components/schemas/ResourceMonitorSpec' MemoryResourceMonitorSpec: allOf: + - type: object + required: [ monitorType ] + properties: + monitorType: + type: string + description: The type of resource to monitor. - $ref: '#/components/schemas/ResourceMonitorSpec' DiskResourceMonitorSpec: allOf: - $ref: '#/components/schemas/ResourceMonitorSpec' + - type: object + required: [ monitorType ] + properties: + monitorType: + type: string + description: The type of resource to monitor. - type: object description: Specification for monitoring disk usage. required: @@ -3767,11 +3845,6 @@ components: path: type: string description: The directory path to monitor for disk usage. - CustomResourceMonitorSpec: - allOf: - - $ref: '#/components/schemas/ResourceMonitorSpec' - - type: object - description: "Specification for monitoring custom resources." ResourceAlertRule: type: object properties: @@ -4012,6 +4085,7 @@ components: - operatingSystem - agentVersion type: object + description: System information collected from the device. properties: architecture: type: string @@ -4025,7 +4099,19 @@ components: agentVersion: type: string description: The Agent version. - description: "DeviceSystemInfo is a set of ids/uuids to uniquely identify the device." + customInfo: + $ref: "#/components/schemas/CustomDeviceInfo" + additionalProperties: + type: string + description: | + Optional system attributes exposed by the agent. + Each key corresponds to a configurable internal capability. + CustomDeviceInfo: + type: object + description: User-defined information about the device. + additionalProperties: + type: string + description: A user-defined custom property value. DeviceApplicationStatus: type: object required: @@ -5098,4 +5184,121 @@ components: description: Git version of the service. type: string required: - - version \ No newline at end of file + - version + Event: + type: object + required: + - apiVersion + - kind + - metadata + - involvedObject + - reason + - message + - type + - source + - actor + properties: + apiVersion: + type: string + 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.' + kind: + type: string + 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.' + metadata: + $ref: '#/components/schemas/ObjectMeta' + involvedObject: + $ref: '#/components/schemas/ObjectReference' + reason: + type: string + description: A short, machine-readable string that describes the reason for the event. + enum: + - ResourceCreated + - ResourceCreationFailed + - ResourceUpdated + - ResourceUpdateFailed + - ResourceDeleted + - ResourceDeletionFailed + message: + type: string + description: A human-readable description of the status of this operation. + details: + $ref: '#/components/schemas/EventDetails' + type: + type: string + description: The type of the event. One of Normal, Warning. + enum: + - Normal + - Warning + source: + $ref: '#/components/schemas/EventSource' + actor: + type: string + description: 'The name of the user or service that triggered the event. The value will be prefixed by either user: (for human users) or service: (for automated services).' + EventSource: + type: object + description: The component that is responsible for the event. + required: + - component + properties: + component: + type: string + description: The name of the component that is responsible for the event. + ObjectReference: + type: object + description: A reference to a resource. + required: + - kind + - name + properties: + kind: + type: string + 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.' + name: + type: string + description: The name of the referenced object. + EventList: + type: object + properties: + apiVersion: + type: string + 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.' + kind: + type: string + 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.' + metadata: + $ref: '#/components/schemas/ListMeta' + items: + type: array + description: 'List of Events.' + items: + $ref: '#/components/schemas/Event' + required: + - apiVersion + - kind + - metadata + - items + description: EventList is a list of Events. + EventDetails: + type: object + description: Event-specific details, structured based on event type. + oneOf: + - $ref: "#/components/schemas/ResourceUpdatedDetails" + ResourceUpdatedDetails: + type: object + required: + - updatedFields + properties: + updatedFields: + type: array + items: + type: string + enum: [owner, labels, spec] + description: List of fields that were updated in the resource. + previousOwner: + type: string + nullable: true + description: The previous owner (if applicable). + newOwner: + type: string + nullable: true + description: The new owner (if applicable). \ No newline at end of file diff --git a/docs/CpuResourceMonitorSpec.md b/docs/CpuResourceMonitorSpec.md index 8548119..63faa90 100644 --- a/docs/CpuResourceMonitorSpec.md +++ b/docs/CpuResourceMonitorSpec.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**monitor_type** | **str** | The type of resource to monitor. | **alert_rules** | [**List[ResourceAlertRule]**](ResourceAlertRule.md) | Array of alert rules. Only one alert per severity is allowed. | **sampling_interval** | **str** | Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours. | +**monitor_type** | **str** | The type of resource to monitor. | ## Example diff --git a/docs/CustomResourceMonitorSpec.md b/docs/CustomResourceMonitorSpec.md deleted file mode 100644 index 07a512e..0000000 --- a/docs/CustomResourceMonitorSpec.md +++ /dev/null @@ -1,31 +0,0 @@ -# CustomResourceMonitorSpec - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**monitor_type** | **str** | The type of resource to monitor. | -**alert_rules** | [**List[ResourceAlertRule]**](ResourceAlertRule.md) | Array of alert rules. Only one alert per severity is allowed. | -**sampling_interval** | **str** | Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours. | - -## Example - -```python -from flightctl.models.custom_resource_monitor_spec import CustomResourceMonitorSpec - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomResourceMonitorSpec from a JSON string -custom_resource_monitor_spec_instance = CustomResourceMonitorSpec.from_json(json) -# print the JSON string representation of the object -print(CustomResourceMonitorSpec.to_json()) - -# convert the object into a dict -custom_resource_monitor_spec_dict = custom_resource_monitor_spec_instance.to_dict() -# create an instance of CustomResourceMonitorSpec from a dict -custom_resource_monitor_spec_from_dict = CustomResourceMonitorSpec.from_dict(custom_resource_monitor_spec_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/DeviceSystemInfo.md b/docs/DeviceSystemInfo.md index 78aa4a2..f94078a 100644 --- a/docs/DeviceSystemInfo.md +++ b/docs/DeviceSystemInfo.md @@ -1,6 +1,6 @@ # DeviceSystemInfo -DeviceSystemInfo is a set of ids/uuids to uniquely identify the device. +System information collected from the device. ## Properties @@ -10,6 +10,7 @@ Name | Type | Description | Notes **boot_id** | **str** | Boot ID reported by the device. | **operating_system** | **str** | The Operating System reported by the device. | **agent_version** | **str** | The Agent version. | +**custom_info** | **Dict[str, str]** | User-defined information about the device. | [optional] ## Example diff --git a/docs/DiskResourceMonitorSpec.md b/docs/DiskResourceMonitorSpec.md index 58da5fa..fced10f 100644 --- a/docs/DiskResourceMonitorSpec.md +++ b/docs/DiskResourceMonitorSpec.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**monitor_type** | **str** | The type of resource to monitor. | **alert_rules** | [**List[ResourceAlertRule]**](ResourceAlertRule.md) | Array of alert rules. Only one alert per severity is allowed. | **sampling_interval** | **str** | Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours. | +**monitor_type** | **str** | The type of resource to monitor. | **path** | **str** | The directory path to monitor for disk usage. | ## Example diff --git a/docs/Event.md b/docs/Event.md new file mode 100644 index 0000000..7045244 --- /dev/null +++ b/docs/Event.md @@ -0,0 +1,38 @@ +# Event + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**api_version** | **str** | 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. | +**kind** | **str** | 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. | +**metadata** | [**ObjectMeta**](ObjectMeta.md) | | +**involved_object** | [**ObjectReference**](ObjectReference.md) | | +**reason** | **str** | A short, machine-readable string that describes the reason for the event. | +**message** | **str** | A human-readable description of the status of this operation. | +**details** | [**EventDetails**](EventDetails.md) | | [optional] +**type** | **str** | The type of the event. One of Normal, Warning. | +**source** | [**EventSource**](EventSource.md) | | +**actor** | **str** | The name of the user or service that triggered the event. The value will be prefixed by either user: (for human users) or service: (for automated services). | + +## Example + +```python +from flightctl.models.event import Event + +# TODO update the JSON string below +json = "{}" +# create an instance of Event from a JSON string +event_instance = Event.from_json(json) +# print the JSON string representation of the object +print(Event.to_json()) + +# convert the object into a dict +event_dict = event_instance.to_dict() +# create an instance of Event from a dict +event_from_dict = Event.from_dict(event_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/EventApi.md b/docs/EventApi.md new file mode 100644 index 0000000..9545fb1 --- /dev/null +++ b/docs/EventApi.md @@ -0,0 +1,84 @@ +# flightctl.EventApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list_events**](EventApi.md#list_events) | **GET** /api/v1/events | + + +# **list_events** +> EventList list_events(field_selector=field_selector, limit=limit, var_continue=var_continue) + + + +Retrieves a list of events. + +### Example + + +```python +import flightctl +from flightctl.models.event_list import EventList +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.EventApi(api_client) + field_selector = 'field_selector_example' # str | A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\"). (optional) + limit = 56 # int | The maximum number of events to return in the response. (optional) + var_continue = 'var_continue_example' # str | An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. (optional) + + try: + api_response = api_instance.list_events(field_selector=field_selector, limit=limit, var_continue=var_continue) + print("The response of EventApi->list_events:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventApi->list_events: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **field_selector** | **str**| A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\"). | [optional] + **limit** | **int**| The maximum number of events to return in the response. | [optional] + **var_continue** | **str**| An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. | [optional] + +### Return type + +[**EventList**](EventList.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 | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Not allowed | - | +**503** | ServiceUnavailable | - | + +[[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/EventDetails.md b/docs/EventDetails.md new file mode 100644 index 0000000..ec87b42 --- /dev/null +++ b/docs/EventDetails.md @@ -0,0 +1,32 @@ +# EventDetails + +Event-specific details, structured based on event type. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**updated_fields** | **List[str]** | List of fields that were updated in the resource. | +**previous_owner** | **str** | The previous owner (if applicable). | [optional] +**new_owner** | **str** | The new owner (if applicable). | [optional] + +## Example + +```python +from flightctl.models.event_details import EventDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of EventDetails from a JSON string +event_details_instance = EventDetails.from_json(json) +# print the JSON string representation of the object +print(EventDetails.to_json()) + +# convert the object into a dict +event_details_dict = event_details_instance.to_dict() +# create an instance of EventDetails from a dict +event_details_from_dict = EventDetails.from_dict(event_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/docs/EventList.md b/docs/EventList.md new file mode 100644 index 0000000..ea44276 --- /dev/null +++ b/docs/EventList.md @@ -0,0 +1,33 @@ +# EventList + +EventList is a list of Events. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**api_version** | **str** | 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. | +**kind** | **str** | 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. | +**metadata** | [**ListMeta**](ListMeta.md) | | +**items** | [**List[Event]**](Event.md) | List of Events. | + +## Example + +```python +from flightctl.models.event_list import EventList + +# TODO update the JSON string below +json = "{}" +# create an instance of EventList from a JSON string +event_list_instance = EventList.from_json(json) +# print the JSON string representation of the object +print(EventList.to_json()) + +# convert the object into a dict +event_list_dict = event_list_instance.to_dict() +# create an instance of EventList from a dict +event_list_from_dict = EventList.from_dict(event_list_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/EventSource.md b/docs/EventSource.md new file mode 100644 index 0000000..fde9774 --- /dev/null +++ b/docs/EventSource.md @@ -0,0 +1,30 @@ +# EventSource + +The component that is responsible for the event. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**component** | **str** | The name of the component that is responsible for the event. | + +## Example + +```python +from flightctl.models.event_source import EventSource + +# TODO update the JSON string below +json = "{}" +# create an instance of EventSource from a JSON string +event_source_instance = EventSource.from_json(json) +# print the JSON string representation of the object +print(EventSource.to_json()) + +# convert the object into a dict +event_source_dict = event_source_instance.to_dict() +# create an instance of EventSource from a dict +event_source_from_dict = EventSource.from_dict(event_source_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/LabelsApi.md b/docs/LabelApi.md similarity index 90% rename from docs/LabelsApi.md rename to docs/LabelApi.md index 63a49e9..41c7315 100644 --- a/docs/LabelsApi.md +++ b/docs/LabelApi.md @@ -1,10 +1,10 @@ -# flightctl.LabelsApi +# flightctl.LabelApi All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**list_labels**](LabelsApi.md#list_labels) | **GET** /api/v1/labels | +[**list_labels**](LabelApi.md#list_labels) | **GET** /api/v1/labels | # **list_labels** @@ -32,7 +32,7 @@ configuration = flightctl.Configuration( # 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.LabelsApi(api_client) + api_instance = flightctl.LabelApi(api_client) kind = 'kind_example' # str | The type of resource to retrieve labels from. label_selector = 'label_selector_example' # str | A filter to retrieve labels only from resources that match the given label selector. (optional) field_selector = 'field_selector_example' # str | A filter to retrieve labels only from resources that match the given field selector. (optional) @@ -40,10 +40,10 @@ with flightctl.ApiClient(configuration) as api_client: try: api_response = api_instance.list_labels(kind, label_selector=label_selector, field_selector=field_selector, limit=limit) - print("The response of LabelsApi->list_labels:\n") + print("The response of LabelApi->list_labels:\n") pprint(api_response) except Exception as e: - print("Exception when calling LabelsApi->list_labels: %s\n" % e) + print("Exception when calling LabelApi->list_labels: %s\n" % e) ``` diff --git a/docs/MemoryResourceMonitorSpec.md b/docs/MemoryResourceMonitorSpec.md index 9f0f619..95553fb 100644 --- a/docs/MemoryResourceMonitorSpec.md +++ b/docs/MemoryResourceMonitorSpec.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**monitor_type** | **str** | The type of resource to monitor. | **alert_rules** | [**List[ResourceAlertRule]**](ResourceAlertRule.md) | Array of alert rules. Only one alert per severity is allowed. | **sampling_interval** | **str** | Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours. | +**monitor_type** | **str** | The type of resource to monitor. | ## Example diff --git a/docs/ObjectReference.md b/docs/ObjectReference.md new file mode 100644 index 0000000..b28a3ff --- /dev/null +++ b/docs/ObjectReference.md @@ -0,0 +1,31 @@ +# ObjectReference + +A reference to a resource. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **str** | 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. | +**name** | **str** | The name of the referenced object. | + +## Example + +```python +from flightctl.models.object_reference import ObjectReference + +# TODO update the JSON string below +json = "{}" +# create an instance of ObjectReference from a JSON string +object_reference_instance = ObjectReference.from_json(json) +# print the JSON string representation of the object +print(ObjectReference.to_json()) + +# convert the object into a dict +object_reference_dict = object_reference_instance.to_dict() +# create an instance of ObjectReference from a dict +object_reference_from_dict = ObjectReference.from_dict(object_reference_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/ResourceKind.md b/docs/ResourceKind.md new file mode 100644 index 0000000..75d3fbb --- /dev/null +++ b/docs/ResourceKind.md @@ -0,0 +1,23 @@ +# ResourceKind + +Resource types exposed via the API. + +## Enum + +* `CERTIFICATESIGNINGREQUEST` (value: `'CertificateSigningRequest'`) + +* `ENROLLMENTREQUEST` (value: `'EnrollmentRequest'`) + +* `DEVICE` (value: `'Device'`) + +* `FLEET` (value: `'Fleet'`) + +* `REPOSITORY` (value: `'Repository'`) + +* `RESOURCESYNC` (value: `'ResourceSync'`) + +* `TEMPLATEVERSION` (value: `'TemplateVersion'`) + +[[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/ResourceMonitorSpec.md b/docs/ResourceMonitorSpec.md index 7e028fd..444f4cd 100644 --- a/docs/ResourceMonitorSpec.md +++ b/docs/ResourceMonitorSpec.md @@ -6,7 +6,6 @@ Specification for monitoring a resource. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**monitor_type** | **str** | The type of resource to monitor. | **alert_rules** | [**List[ResourceAlertRule]**](ResourceAlertRule.md) | Array of alert rules. Only one alert per severity is allowed. | **sampling_interval** | **str** | Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours. | diff --git a/docs/ResourceUpdatedDetails.md b/docs/ResourceUpdatedDetails.md new file mode 100644 index 0000000..2e5a2ac --- /dev/null +++ b/docs/ResourceUpdatedDetails.md @@ -0,0 +1,31 @@ +# ResourceUpdatedDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**updated_fields** | **List[str]** | List of fields that were updated in the resource. | +**previous_owner** | **str** | The previous owner (if applicable). | [optional] +**new_owner** | **str** | The new owner (if applicable). | [optional] + +## Example + +```python +from flightctl.models.resource_updated_details import ResourceUpdatedDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of ResourceUpdatedDetails from a JSON string +resource_updated_details_instance = ResourceUpdatedDetails.from_json(json) +# print the JSON string representation of the object +print(ResourceUpdatedDetails.to_json()) + +# convert the object into a dict +resource_updated_details_dict = resource_updated_details_instance.to_dict() +# create an instance of ResourceUpdatedDetails from a dict +resource_updated_details_from_dict = ResourceUpdatedDetails.from_dict(resource_updated_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 937dbf7..7c9b374 100644 --- a/flightctl/__init__.py +++ b/flightctl/__init__.py @@ -22,8 +22,9 @@ from flightctl.api.certificatesigningrequest_api import CertificatesigningrequestApi from flightctl.api.device_api import DeviceApi from flightctl.api.enrollmentrequest_api import EnrollmentrequestApi +from flightctl.api.event_api import EventApi from flightctl.api.fleet_api import FleetApi -from flightctl.api.labels_api import LabelsApi +from flightctl.api.label_api import LabelApi from flightctl.api.repository_api import RepositoryApi from flightctl.api.resourcesync_api import ResourcesyncApi from flightctl.api.version_api import VersionApi @@ -60,7 +61,6 @@ from flightctl.models.condition_type import ConditionType from flightctl.models.config_provider_spec import ConfigProviderSpec from flightctl.models.cpu_resource_monitor_spec import CpuResourceMonitorSpec -from flightctl.models.custom_resource_monitor_spec import CustomResourceMonitorSpec from flightctl.models.device import Device from flightctl.models.device_application_status import DeviceApplicationStatus from flightctl.models.device_applications_summary_status import DeviceApplicationsSummaryStatus @@ -101,6 +101,10 @@ from flightctl.models.enrollment_service import EnrollmentService from flightctl.models.enrollment_service_auth import EnrollmentServiceAuth from flightctl.models.enrollment_service_service import EnrollmentServiceService +from flightctl.models.event import Event +from flightctl.models.event_details import EventDetails +from flightctl.models.event_list import EventList +from flightctl.models.event_source import EventSource from flightctl.models.file_content import FileContent from flightctl.models.file_metadata import FileMetadata from flightctl.models.file_operation import FileOperation @@ -132,6 +136,7 @@ from flightctl.models.match_expression import MatchExpression from flightctl.models.memory_resource_monitor_spec import MemoryResourceMonitorSpec from flightctl.models.object_meta import ObjectMeta +from flightctl.models.object_reference import ObjectReference from flightctl.models.patch_request_inner import PatchRequestInner from flightctl.models.relative_path import RelativePath from flightctl.models.repo_spec_type import RepoSpecType @@ -141,12 +146,14 @@ from flightctl.models.repository_status import RepositoryStatus from flightctl.models.resource_alert_rule import ResourceAlertRule from flightctl.models.resource_alert_severity_type import ResourceAlertSeverityType +from flightctl.models.resource_kind import ResourceKind from flightctl.models.resource_monitor import ResourceMonitor from flightctl.models.resource_monitor_spec import ResourceMonitorSpec from flightctl.models.resource_sync import ResourceSync from flightctl.models.resource_sync_list import ResourceSyncList from flightctl.models.resource_sync_spec import ResourceSyncSpec from flightctl.models.resource_sync_status import ResourceSyncStatus +from flightctl.models.resource_updated_details import ResourceUpdatedDetails from flightctl.models.rollout_device_selection import RolloutDeviceSelection from flightctl.models.rollout_policy import RolloutPolicy from flightctl.models.rollout_strategy import RolloutStrategy diff --git a/flightctl/api/__init__.py b/flightctl/api/__init__.py index c086957..26d1154 100644 --- a/flightctl/api/__init__.py +++ b/flightctl/api/__init__.py @@ -5,8 +5,9 @@ from flightctl.api.certificatesigningrequest_api import CertificatesigningrequestApi from flightctl.api.device_api import DeviceApi from flightctl.api.enrollmentrequest_api import EnrollmentrequestApi +from flightctl.api.event_api import EventApi from flightctl.api.fleet_api import FleetApi -from flightctl.api.labels_api import LabelsApi +from flightctl.api.label_api import LabelApi from flightctl.api.repository_api import RepositoryApi from flightctl.api.resourcesync_api import ResourcesyncApi from flightctl.api.version_api import VersionApi diff --git a/flightctl/api/event_api.py b/flightctl/api/event_api.py new file mode 100644 index 0000000..3a599c0 --- /dev/null +++ b/flightctl/api/event_api.py @@ -0,0 +1,348 @@ +# 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 pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from flightctl.models.event_list import EventList + +from flightctl.api_client import ApiClient, RequestSerialized +from flightctl.api_response import ApiResponse +from flightctl.rest import RESTResponseType + + +class EventApi: + """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 list_events( + self, + field_selector: Annotated[Optional[StrictStr], Field(description="A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\").")] = None, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of events to return in the response.")] = None, + var_continue: Annotated[Optional[StrictStr], Field(description="An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response.")] = None, + _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, + ) -> EventList: + """list_events + + Retrieves a list of events. + + :param field_selector: A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\"). + :type field_selector: str + :param limit: The maximum number of events to return in the response. + :type limit: int + :param var_continue: An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. + :type var_continue: 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._list_events_serialize( + field_selector=field_selector, + limit=limit, + var_continue=var_continue, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '400': "Status", + '401': "Status", + '403': "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 list_events_with_http_info( + self, + field_selector: Annotated[Optional[StrictStr], Field(description="A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\").")] = None, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of events to return in the response.")] = None, + var_continue: Annotated[Optional[StrictStr], Field(description="An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response.")] = None, + _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[EventList]: + """list_events + + Retrieves a list of events. + + :param field_selector: A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\"). + :type field_selector: str + :param limit: The maximum number of events to return in the response. + :type limit: int + :param var_continue: An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. + :type var_continue: 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._list_events_serialize( + field_selector=field_selector, + limit=limit, + var_continue=var_continue, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '400': "Status", + '401': "Status", + '403': "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 list_events_without_preload_content( + self, + field_selector: Annotated[Optional[StrictStr], Field(description="A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\").")] = None, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of events to return in the response.")] = None, + var_continue: Annotated[Optional[StrictStr], Field(description="An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response.")] = None, + _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: + """list_events + + Retrieves a list of events. + + :param field_selector: A selector to restrict the list of returned objects by their fields, supporting operators like '=', '==', and '!=' (e.g., \"key1=value1,key2!=value2\"). + :type field_selector: str + :param limit: The maximum number of events to return in the response. + :type limit: int + :param var_continue: An optional parameter to query more results from the server. The value of the paramter must match the value of the 'continue' field in the previous list response. + :type var_continue: 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._list_events_serialize( + field_selector=field_selector, + limit=limit, + var_continue=var_continue, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EventList", + '400': "Status", + '401': "Status", + '403': "Status", + '503': "Status", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_events_serialize( + self, + field_selector, + limit, + var_continue, + _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 + if field_selector is not None: + + _query_params.append(('fieldSelector', field_selector)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if var_continue is not None: + + _query_params.append(('continue', var_continue)) + + # 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/events', + 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/api/labels_api.py b/flightctl/api/label_api.py similarity index 99% rename from flightctl/api/labels_api.py rename to flightctl/api/label_api.py index 0392312..c295444 100644 --- a/flightctl/api/labels_api.py +++ b/flightctl/api/label_api.py @@ -26,7 +26,7 @@ from flightctl.rest import RESTResponseType -class LabelsApi: +class LabelApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech diff --git a/flightctl/models/__init__.py b/flightctl/models/__init__.py index 1138a81..cfe3e78 100644 --- a/flightctl/models/__init__.py +++ b/flightctl/models/__init__.py @@ -35,7 +35,6 @@ from flightctl.models.condition_type import ConditionType from flightctl.models.config_provider_spec import ConfigProviderSpec from flightctl.models.cpu_resource_monitor_spec import CpuResourceMonitorSpec -from flightctl.models.custom_resource_monitor_spec import CustomResourceMonitorSpec from flightctl.models.device import Device from flightctl.models.device_application_status import DeviceApplicationStatus from flightctl.models.device_applications_summary_status import DeviceApplicationsSummaryStatus @@ -76,6 +75,10 @@ from flightctl.models.enrollment_service import EnrollmentService from flightctl.models.enrollment_service_auth import EnrollmentServiceAuth from flightctl.models.enrollment_service_service import EnrollmentServiceService +from flightctl.models.event import Event +from flightctl.models.event_details import EventDetails +from flightctl.models.event_list import EventList +from flightctl.models.event_source import EventSource from flightctl.models.file_content import FileContent from flightctl.models.file_metadata import FileMetadata from flightctl.models.file_operation import FileOperation @@ -107,6 +110,7 @@ from flightctl.models.match_expression import MatchExpression from flightctl.models.memory_resource_monitor_spec import MemoryResourceMonitorSpec from flightctl.models.object_meta import ObjectMeta +from flightctl.models.object_reference import ObjectReference from flightctl.models.patch_request_inner import PatchRequestInner from flightctl.models.relative_path import RelativePath from flightctl.models.repo_spec_type import RepoSpecType @@ -116,12 +120,14 @@ from flightctl.models.repository_status import RepositoryStatus from flightctl.models.resource_alert_rule import ResourceAlertRule from flightctl.models.resource_alert_severity_type import ResourceAlertSeverityType +from flightctl.models.resource_kind import ResourceKind from flightctl.models.resource_monitor import ResourceMonitor from flightctl.models.resource_monitor_spec import ResourceMonitorSpec from flightctl.models.resource_sync import ResourceSync from flightctl.models.resource_sync_list import ResourceSyncList from flightctl.models.resource_sync_spec import ResourceSyncSpec from flightctl.models.resource_sync_status import ResourceSyncStatus +from flightctl.models.resource_updated_details import ResourceUpdatedDetails from flightctl.models.rollout_device_selection import RolloutDeviceSelection from flightctl.models.rollout_policy import RolloutPolicy from flightctl.models.rollout_strategy import RolloutStrategy diff --git a/flightctl/models/condition_type.py b/flightctl/models/condition_type.py index 9db971d..e4ef97e 100644 --- a/flightctl/models/condition_type.py +++ b/flightctl/models/condition_type.py @@ -28,11 +28,9 @@ class ConditionType(str, Enum): allowed enum values """ APPROVED = 'Approved' - APPROVED = 'Approved' DENIED = 'Denied' FAILED = 'Failed' ACCESSIBLE = 'Accessible' - ACCESSIBLE = 'Accessible' RESOURCEPARSED = 'ResourceParsed' SYNCED = 'Synced' OVERLAPPINGSELECTORS = 'OverlappingSelectors' diff --git a/flightctl/models/cpu_resource_monitor_spec.py b/flightctl/models/cpu_resource_monitor_spec.py index 72cdda7..0d2348b 100644 --- a/flightctl/models/cpu_resource_monitor_spec.py +++ b/flightctl/models/cpu_resource_monitor_spec.py @@ -29,10 +29,10 @@ class CpuResourceMonitorSpec(BaseModel): """ CpuResourceMonitorSpec """ # noqa: E501 - monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") alert_rules: List[ResourceAlertRule] = Field(description="Array of alert rules. Only one alert per severity is allowed.", alias="alertRules") sampling_interval: Annotated[str, Field(strict=True)] = Field(description="Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours.", alias="samplingInterval") - __properties: ClassVar[List[str]] = ["monitorType", "alertRules", "samplingInterval"] + monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") + __properties: ClassVar[List[str]] = ["alertRules", "samplingInterval", "monitorType"] @field_validator('sampling_interval') def sampling_interval_validate_regular_expression(cls, value): @@ -99,9 +99,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "monitorType": obj.get("monitorType"), "alertRules": [ResourceAlertRule.from_dict(_item) for _item in obj["alertRules"]] if obj.get("alertRules") is not None else None, - "samplingInterval": obj.get("samplingInterval") + "samplingInterval": obj.get("samplingInterval"), + "monitorType": obj.get("monitorType") }) return _obj diff --git a/flightctl/models/device_system_info.py b/flightctl/models/device_system_info.py index d9344f8..1abb827 100644 --- a/flightctl/models/device_system_info.py +++ b/flightctl/models/device_system_info.py @@ -19,19 +19,21 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self class DeviceSystemInfo(BaseModel): """ - DeviceSystemInfo is a set of ids/uuids to uniquely identify the device. + System information collected from the device. """ # noqa: E501 architecture: StrictStr = Field(description="The Architecture reported by the device.") boot_id: StrictStr = Field(description="Boot ID reported by the device.", alias="bootID") operating_system: StrictStr = Field(description="The Operating System reported by the device.", alias="operatingSystem") agent_version: StrictStr = Field(description="The Agent version.", alias="agentVersion") - __properties: ClassVar[List[str]] = ["architecture", "bootID", "operatingSystem", "agentVersion"] + custom_info: Optional[Dict[str, StrictStr]] = Field(default=None, description="User-defined information about the device.", alias="customInfo") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["architecture", "bootID", "operatingSystem", "agentVersion", "customInfo"] model_config = ConfigDict( populate_by_name=True, @@ -63,8 +65,10 @@ def to_dict(self) -> Dict[str, Any]: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. + * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ + "additional_properties", ]) _dict = self.model_dump( @@ -72,6 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict @classmethod @@ -87,8 +96,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "architecture": obj.get("architecture"), "bootID": obj.get("bootID"), "operatingSystem": obj.get("operatingSystem"), - "agentVersion": obj.get("agentVersion") + "agentVersion": obj.get("agentVersion"), + "customInfo": obj.get("customInfo") }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + return _obj diff --git a/flightctl/models/disk_resource_monitor_spec.py b/flightctl/models/disk_resource_monitor_spec.py index a096db6..61ebc5c 100644 --- a/flightctl/models/disk_resource_monitor_spec.py +++ b/flightctl/models/disk_resource_monitor_spec.py @@ -29,11 +29,11 @@ class DiskResourceMonitorSpec(BaseModel): """ DiskResourceMonitorSpec """ # noqa: E501 - monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") alert_rules: List[ResourceAlertRule] = Field(description="Array of alert rules. Only one alert per severity is allowed.", alias="alertRules") sampling_interval: Annotated[str, Field(strict=True)] = Field(description="Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours.", alias="samplingInterval") + monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") path: StrictStr = Field(description="The directory path to monitor for disk usage.") - __properties: ClassVar[List[str]] = ["monitorType", "alertRules", "samplingInterval", "path"] + __properties: ClassVar[List[str]] = ["alertRules", "samplingInterval", "monitorType", "path"] @field_validator('sampling_interval') def sampling_interval_validate_regular_expression(cls, value): @@ -100,9 +100,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "monitorType": obj.get("monitorType"), "alertRules": [ResourceAlertRule.from_dict(_item) for _item in obj["alertRules"]] if obj.get("alertRules") is not None else None, "samplingInterval": obj.get("samplingInterval"), + "monitorType": obj.get("monitorType"), "path": obj.get("path") }) return _obj diff --git a/flightctl/models/event.py b/flightctl/models/event.py new file mode 100644 index 0000000..21c3c64 --- /dev/null +++ b/flightctl/models/event.py @@ -0,0 +1,136 @@ +# 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, 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 +from typing import Optional, Set +from typing_extensions import Self + +class Event(BaseModel): + """ + Event + """ # 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.") + metadata: ObjectMeta + involved_object: ObjectReference = Field(alias="involvedObject") + reason: StrictStr = Field(description="A short, machine-readable string that describes the reason for the event.") + message: StrictStr = Field(description="A human-readable description of the status of this operation.") + details: Optional[EventDetails] = None + type: StrictStr = Field(description="The type of the event. One of Normal, Warning.") + source: EventSource + actor: StrictStr = Field(description="The name of the user or service that triggered the event. The value will be prefixed by either user: (for human users) or service: (for automated services).") + __properties: ClassVar[List[str]] = ["apiVersion", "kind", "metadata", "involvedObject", "reason", "message", "details", "type", "source", "actor"] + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed']): + raise ValueError("must be one of enum values ('ResourceCreated', 'ResourceCreationFailed', 'ResourceUpdated', 'ResourceUpdateFailed', 'ResourceDeleted', 'ResourceDeletionFailed')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Normal', 'Warning']): + raise ValueError("must be one of enum values ('Normal', 'Warning')") + 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 Event 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of involved_object + if self.involved_object: + _dict['involvedObject'] = self.involved_object.to_dict() + # override the default output from pydantic by calling `to_dict()` of details + if self.details: + _dict['details'] = self.details.to_dict() + # override the default output from pydantic by calling `to_dict()` of source + if self.source: + _dict['source'] = self.source.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Event from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "apiVersion": obj.get("apiVersion"), + "kind": obj.get("kind"), + "metadata": ObjectMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "involvedObject": ObjectReference.from_dict(obj["involvedObject"]) if obj.get("involvedObject") is not None else None, + "reason": obj.get("reason"), + "message": obj.get("message"), + "details": EventDetails.from_dict(obj["details"]) if obj.get("details") is not None else None, + "type": obj.get("type"), + "source": EventSource.from_dict(obj["source"]) if obj.get("source") is not None else None, + "actor": obj.get("actor") + }) + return _obj + + diff --git a/flightctl/models/event_details.py b/flightctl/models/event_details.py new file mode 100644 index 0000000..e668046 --- /dev/null +++ b/flightctl/models/event_details.py @@ -0,0 +1,124 @@ +# 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 json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from flightctl.models.resource_updated_details import ResourceUpdatedDetails +from pydantic import StrictStr, Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +EVENTDETAILS_ONE_OF_SCHEMAS = ["ResourceUpdatedDetails"] + +class EventDetails(BaseModel): + """ + Event-specific details, structured based on event type. + """ + # data type: ResourceUpdatedDetails + oneof_schema_1_validator: Optional[ResourceUpdatedDetails] = None + actual_instance: Optional[Union[ResourceUpdatedDetails]] = None + one_of_schemas: Set[str] = { "ResourceUpdatedDetails" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = EventDetails.model_construct() + error_messages = [] + match = 0 + # validate data type: ResourceUpdatedDetails + if not isinstance(v, ResourceUpdatedDetails): + error_messages.append(f"Error! Input type `{type(v)}` is not `ResourceUpdatedDetails`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in EventDetails with oneOf schemas: ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in EventDetails with oneOf schemas: ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ResourceUpdatedDetails + try: + instance.actual_instance = ResourceUpdatedDetails.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into EventDetails with oneOf schemas: 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: ResourceUpdatedDetails. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ResourceUpdatedDetails]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/flightctl/models/event_list.py b/flightctl/models/event_list.py new file mode 100644 index 0000000..8b0b892 --- /dev/null +++ b/flightctl/models/event_list.py @@ -0,0 +1,106 @@ +# 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 +from flightctl.models.event import Event +from flightctl.models.list_meta import ListMeta +from typing import Optional, Set +from typing_extensions import Self + +class EventList(BaseModel): + """ + EventList is a list of Events. + """ # 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.") + metadata: ListMeta + items: List[Event] = Field(description="List of Events.") + __properties: ClassVar[List[str]] = ["apiVersion", "kind", "metadata", "items"] + + 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 EventList 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 metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EventList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "apiVersion": obj.get("apiVersion"), + "kind": obj.get("kind"), + "metadata": ListMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "items": [Event.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None + }) + return _obj + + diff --git a/flightctl/models/event_source.py b/flightctl/models/event_source.py new file mode 100644 index 0000000..d19056f --- /dev/null +++ b/flightctl/models/event_source.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 +from typing import Optional, Set +from typing_extensions import Self + +class EventSource(BaseModel): + """ + The component that is responsible for the event. + """ # noqa: E501 + component: StrictStr = Field(description="The name of the component that is responsible for the event.") + __properties: ClassVar[List[str]] = ["component"] + + 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 EventSource 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 EventSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "component": obj.get("component") + }) + return _obj + + diff --git a/flightctl/models/memory_resource_monitor_spec.py b/flightctl/models/memory_resource_monitor_spec.py index 79710a6..ddb1ace 100644 --- a/flightctl/models/memory_resource_monitor_spec.py +++ b/flightctl/models/memory_resource_monitor_spec.py @@ -29,10 +29,10 @@ class MemoryResourceMonitorSpec(BaseModel): """ MemoryResourceMonitorSpec """ # noqa: E501 - monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") alert_rules: List[ResourceAlertRule] = Field(description="Array of alert rules. Only one alert per severity is allowed.", alias="alertRules") sampling_interval: Annotated[str, Field(strict=True)] = Field(description="Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours.", alias="samplingInterval") - __properties: ClassVar[List[str]] = ["monitorType", "alertRules", "samplingInterval"] + monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") + __properties: ClassVar[List[str]] = ["alertRules", "samplingInterval", "monitorType"] @field_validator('sampling_interval') def sampling_interval_validate_regular_expression(cls, value): @@ -99,9 +99,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "monitorType": obj.get("monitorType"), "alertRules": [ResourceAlertRule.from_dict(_item) for _item in obj["alertRules"]] if obj.get("alertRules") is not None else None, - "samplingInterval": obj.get("samplingInterval") + "samplingInterval": obj.get("samplingInterval"), + "monitorType": obj.get("monitorType") }) return _obj diff --git a/flightctl/models/object_reference.py b/flightctl/models/object_reference.py new file mode 100644 index 0000000..6964c09 --- /dev/null +++ b/flightctl/models/object_reference.py @@ -0,0 +1,90 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class ObjectReference(BaseModel): + """ + A reference to a resource. + """ # noqa: E501 + 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.") + name: StrictStr = Field(description="The name of the referenced object.") + __properties: ClassVar[List[str]] = ["kind", "name"] + + 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 ObjectReference 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 ObjectReference from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "kind": obj.get("kind"), + "name": obj.get("name") + }) + return _obj + + diff --git a/flightctl/models/resource_kind.py b/flightctl/models/resource_kind.py new file mode 100644 index 0000000..6271e81 --- /dev/null +++ b/flightctl/models/resource_kind.py @@ -0,0 +1,43 @@ +# 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 json +from enum import Enum +from typing_extensions import Self + + +class ResourceKind(str, Enum): + """ + Resource types exposed via the API. + """ + + """ + allowed enum values + """ + CERTIFICATESIGNINGREQUEST = 'CertificateSigningRequest' + ENROLLMENTREQUEST = 'EnrollmentRequest' + DEVICE = 'Device' + FLEET = 'Fleet' + REPOSITORY = 'Repository' + RESOURCESYNC = 'ResourceSync' + TEMPLATEVERSION = 'TemplateVersion' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ResourceKind from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/flightctl/models/resource_monitor_spec.py b/flightctl/models/resource_monitor_spec.py index 24b7bde..24c559d 100644 --- a/flightctl/models/resource_monitor_spec.py +++ b/flightctl/models/resource_monitor_spec.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field, field_validator from typing import Any, ClassVar, Dict, List from typing_extensions import Annotated from flightctl.models.resource_alert_rule import ResourceAlertRule @@ -29,10 +29,9 @@ class ResourceMonitorSpec(BaseModel): """ Specification for monitoring a resource. """ # noqa: E501 - monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") alert_rules: List[ResourceAlertRule] = Field(description="Array of alert rules. Only one alert per severity is allowed.", alias="alertRules") sampling_interval: Annotated[str, Field(strict=True)] = Field(description="Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours.", alias="samplingInterval") - __properties: ClassVar[List[str]] = ["monitorType", "alertRules", "samplingInterval"] + __properties: ClassVar[List[str]] = ["alertRules", "samplingInterval"] @field_validator('sampling_interval') def sampling_interval_validate_regular_expression(cls, value): @@ -99,7 +98,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "monitorType": obj.get("monitorType"), "alertRules": [ResourceAlertRule.from_dict(_item) for _item in obj["alertRules"]] if obj.get("alertRules") is not None else None, "samplingInterval": obj.get("samplingInterval") }) diff --git a/flightctl/models/custom_resource_monitor_spec.py b/flightctl/models/resource_updated_details.py similarity index 54% rename from flightctl/models/custom_resource_monitor_spec.py rename to flightctl/models/resource_updated_details.py index bd22ce2..1927e01 100644 --- a/flightctl/models/custom_resource_monitor_spec.py +++ b/flightctl/models/resource_updated_details.py @@ -19,26 +19,25 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List -from typing_extensions import Annotated -from flightctl.models.resource_alert_rule import ResourceAlertRule +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self -class CustomResourceMonitorSpec(BaseModel): +class ResourceUpdatedDetails(BaseModel): """ - CustomResourceMonitorSpec + ResourceUpdatedDetails """ # noqa: E501 - monitor_type: StrictStr = Field(description="The type of resource to monitor.", alias="monitorType") - alert_rules: List[ResourceAlertRule] = Field(description="Array of alert rules. Only one alert per severity is allowed.", alias="alertRules") - sampling_interval: Annotated[str, Field(strict=True)] = Field(description="Duration between monitor samples. Format: positive integer followed by 's' for seconds, 'm' for minutes, 'h' for hours.", alias="samplingInterval") - __properties: ClassVar[List[str]] = ["monitorType", "alertRules", "samplingInterval"] - - @field_validator('sampling_interval') - def sampling_interval_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[1-9]\d*[smh]$", value): - raise ValueError(r"must validate the regular expression /^[1-9]\d*[smh]$/") + updated_fields: List[StrictStr] = Field(description="List of fields that were updated in the resource.", alias="updatedFields") + previous_owner: Optional[StrictStr] = Field(default=None, description="The previous owner (if applicable).", alias="previousOwner") + new_owner: Optional[StrictStr] = Field(default=None, description="The new owner (if applicable).", alias="newOwner") + __properties: ClassVar[List[str]] = ["updatedFields", "previousOwner", "newOwner"] + + @field_validator('updated_fields') + def updated_fields_validate_enum(cls, value): + """Validates the enum""" + for i in value: + if i not in set(['owner', 'labels', 'spec']): + raise ValueError("each list item must be one of ('owner', 'labels', 'spec')") return value model_config = ConfigDict( @@ -59,7 +58,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomResourceMonitorSpec from a JSON string""" + """Create an instance of ResourceUpdatedDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,18 +79,21 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in alert_rules (list) - _items = [] - if self.alert_rules: - for _item_alert_rules in self.alert_rules: - if _item_alert_rules: - _items.append(_item_alert_rules.to_dict()) - _dict['alertRules'] = _items + # set to None if previous_owner (nullable) is None + # and model_fields_set contains the field + if self.previous_owner is None and "previous_owner" in self.model_fields_set: + _dict['previousOwner'] = None + + # set to None if new_owner (nullable) is None + # and model_fields_set contains the field + if self.new_owner is None and "new_owner" in self.model_fields_set: + _dict['newOwner'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomResourceMonitorSpec from a dict""" + """Create an instance of ResourceUpdatedDetails from a dict""" if obj is None: return None @@ -99,9 +101,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "monitorType": obj.get("monitorType"), - "alertRules": [ResourceAlertRule.from_dict(_item) for _item in obj["alertRules"]] if obj.get("alertRules") is not None else None, - "samplingInterval": obj.get("samplingInterval") + "updatedFields": obj.get("updatedFields"), + "previousOwner": obj.get("previousOwner"), + "newOwner": obj.get("newOwner") }) return _obj diff --git a/test/test_cpu_resource_monitor_spec.py b/test/test_cpu_resource_monitor_spec.py index 50f3aeb..60f62db 100644 --- a/test/test_cpu_resource_monitor_spec.py +++ b/test/test_cpu_resource_monitor_spec.py @@ -36,7 +36,6 @@ def make_instance(self, include_optional) -> CpuResourceMonitorSpec: model = CpuResourceMonitorSpec() if include_optional: return CpuResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -44,11 +43,11 @@ def make_instance(self, include_optional) -> CpuResourceMonitorSpec: percentage = 1.337, description = '', ) ], - sampling_interval = '68072888001528021798096225500h' + sampling_interval = '68072888001528021798096225500h', + monitor_type = '' ) else: return CpuResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -57,6 +56,7 @@ def make_instance(self, include_optional) -> CpuResourceMonitorSpec: description = '', ) ], sampling_interval = '68072888001528021798096225500h', + monitor_type = '', ) """ diff --git a/test/test_custom_resource_monitor_spec.py b/test/test_custom_resource_monitor_spec.py deleted file mode 100644 index c77a269..0000000 --- a/test/test_custom_resource_monitor_spec.py +++ /dev/null @@ -1,69 +0,0 @@ -# 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.custom_resource_monitor_spec import CustomResourceMonitorSpec - -class TestCustomResourceMonitorSpec(unittest.TestCase): - """CustomResourceMonitorSpec unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> CustomResourceMonitorSpec: - """Test CustomResourceMonitorSpec - 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 `CustomResourceMonitorSpec` - """ - model = CustomResourceMonitorSpec() - if include_optional: - return CustomResourceMonitorSpec( - monitor_type = '', - alert_rules = [ - flightctl.models.resource_alert_rule.ResourceAlertRule( - severity = 'Warning', - duration = '4s', - percentage = 1.337, - description = '', ) - ], - sampling_interval = '68072888001528021798096225500h' - ) - else: - return CustomResourceMonitorSpec( - monitor_type = '', - alert_rules = [ - flightctl.models.resource_alert_rule.ResourceAlertRule( - severity = 'Warning', - duration = '4s', - percentage = 1.337, - description = '', ) - ], - sampling_interval = '68072888001528021798096225500h', - ) - """ - - def testCustomResourceMonitorSpec(self): - """Test CustomResourceMonitorSpec""" - # 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.py b/test/test_device.py index 9d0ea1c..df90203 100644 --- a/test/test_device.py +++ b/test/test_device.py @@ -91,11 +91,9 @@ def make_instance(self, include_optional) -> Device: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_device_list.py b/test/test_device_list.py index d3bbfc9..10a09ac 100644 --- a/test/test_device_list.py +++ b/test/test_device_list.py @@ -100,11 +100,9 @@ def make_instance(self, include_optional) -> DeviceList: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', @@ -216,11 +214,9 @@ def make_instance(self, include_optional) -> DeviceList: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_device_status.py b/test/test_device_status.py index b10768d..b43015b 100644 --- a/test/test_device_status.py +++ b/test/test_device_status.py @@ -45,11 +45,9 @@ def make_instance(self, include_optional) -> DeviceStatus: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', @@ -94,11 +92,9 @@ def make_instance(self, include_optional) -> DeviceStatus: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_device_system_info.py b/test/test_device_system_info.py index f7ab180..9c88c03 100644 --- a/test/test_device_system_info.py +++ b/test/test_device_system_info.py @@ -39,7 +39,10 @@ def make_instance(self, include_optional) -> DeviceSystemInfo: architecture = '', boot_id = '', operating_system = '', - agent_version = '' + agent_version = '', + custom_info = { + 'key' : '' + } ) else: return DeviceSystemInfo( diff --git a/test/test_disk_resource_monitor_spec.py b/test/test_disk_resource_monitor_spec.py index d02047f..bbd50a3 100644 --- a/test/test_disk_resource_monitor_spec.py +++ b/test/test_disk_resource_monitor_spec.py @@ -36,7 +36,6 @@ def make_instance(self, include_optional) -> DiskResourceMonitorSpec: model = DiskResourceMonitorSpec() if include_optional: return DiskResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -45,11 +44,11 @@ def make_instance(self, include_optional) -> DiskResourceMonitorSpec: description = '', ) ], sampling_interval = '68072888001528021798096225500h', + monitor_type = '', path = '' ) else: return DiskResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -58,6 +57,7 @@ def make_instance(self, include_optional) -> DiskResourceMonitorSpec: description = '', ) ], sampling_interval = '68072888001528021798096225500h', + monitor_type = '', path = '', ) """ diff --git a/test/test_enrollment_request.py b/test/test_enrollment_request.py index 5470dff..80af1d4 100644 --- a/test/test_enrollment_request.py +++ b/test/test_enrollment_request.py @@ -63,11 +63,9 @@ def make_instance(self, include_optional) -> EnrollmentRequest: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', @@ -145,11 +143,9 @@ def make_instance(self, include_optional) -> EnrollmentRequest: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_enrollment_request_list.py b/test/test_enrollment_request_list.py index 16915a0..a8497ff 100644 --- a/test/test_enrollment_request_list.py +++ b/test/test_enrollment_request_list.py @@ -70,11 +70,9 @@ def make_instance(self, include_optional) -> EnrollmentRequestList: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', @@ -157,11 +155,9 @@ def make_instance(self, include_optional) -> EnrollmentRequestList: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_enrollment_request_spec.py b/test/test_enrollment_request_spec.py index e388e33..11ba03d 100644 --- a/test/test_enrollment_request_spec.py +++ b/test/test_enrollment_request_spec.py @@ -47,11 +47,9 @@ def make_instance(self, include_optional) -> EnrollmentRequestSpec: message = '', reason = '', ) ], - system_info = flightctl.models.device_system_info.DeviceSystemInfo( - architecture = '', - boot_id = '', - operating_system = '', - agent_version = '', ), + system_info = { + 'key' : '' + }, applications = [ flightctl.models.device_application_status.DeviceApplicationStatus( name = '', diff --git a/test/test_event.py b/test/test_event.py new file mode 100644 index 0000000..1cb83f6 --- /dev/null +++ b/test/test_event.py @@ -0,0 +1,100 @@ +# 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.event import Event + +class TestEvent(unittest.TestCase): + """Event unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Event: + """Test Event + 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 `Event` + """ + model = Event() + if include_optional: + return 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 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 = '', + type = 'Normal', + source = flightctl.models.event_source.EventSource( + component = '', ), + actor = '', + ) + """ + + def testEvent(self): + """Test Event""" + # 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_event_api.py b/test/test_event_api.py new file mode 100644 index 0000000..e74780c --- /dev/null +++ b/test/test_event_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.event_api import EventApi + + +class TestEventApi(unittest.TestCase): + """EventApi unit test stubs""" + + def setUp(self) -> None: + self.api = EventApi() + + def tearDown(self) -> None: + pass + + def test_list_events(self) -> None: + """Test case for list_events + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_event_details.py b/test/test_event_details.py new file mode 100644 index 0000000..f479e20 --- /dev/null +++ b/test/test_event_details.py @@ -0,0 +1,59 @@ +# 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.event_details import EventDetails + +class TestEventDetails(unittest.TestCase): + """EventDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EventDetails: + """Test EventDetails + 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 `EventDetails` + """ + model = EventDetails() + if include_optional: + return EventDetails( + updated_fields = [ + 'owner' + ], + previous_owner = '', + new_owner = '' + ) + else: + return EventDetails( + updated_fields = [ + 'owner' + ], + ) + """ + + def testEventDetails(self): + """Test EventDetails""" + # 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_event_list.py b/test/test_event_list.py new file mode 100644 index 0000000..341d135 --- /dev/null +++ b/test/test_event_list.py @@ -0,0 +1,117 @@ +# 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.event_list import EventList + +class TestEventList(unittest.TestCase): + """EventList unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EventList: + """Test EventList + 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 `EventList` + """ + model = EventList() + if include_optional: + return EventList( + api_version = '', + kind = '', + metadata = flightctl.models.list_meta.ListMeta( + continue = '', + remaining_item_count = 56, ), + items = [ + 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 EventList( + api_version = '', + kind = '', + metadata = flightctl.models.list_meta.ListMeta( + continue = '', + remaining_item_count = 56, ), + items = [ + 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 testEventList(self): + """Test EventList""" + # 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_event_source.py b/test/test_event_source.py new file mode 100644 index 0000000..2f06425 --- /dev/null +++ b/test/test_event_source.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.event_source import EventSource + +class TestEventSource(unittest.TestCase): + """EventSource unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EventSource: + """Test EventSource + 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 `EventSource` + """ + model = EventSource() + if include_optional: + return EventSource( + component = '' + ) + else: + return EventSource( + component = '', + ) + """ + + def testEventSource(self): + """Test EventSource""" + # 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_labels_api.py b/test/test_label_api.py similarity index 80% rename from test/test_labels_api.py rename to test/test_label_api.py index f0d5548..648521b 100644 --- a/test/test_labels_api.py +++ b/test/test_label_api.py @@ -15,14 +15,14 @@ import unittest -from flightctl.api.labels_api import LabelsApi +from flightctl.api.label_api import LabelApi -class TestLabelsApi(unittest.TestCase): - """LabelsApi unit test stubs""" +class TestLabelApi(unittest.TestCase): + """LabelApi unit test stubs""" def setUp(self) -> None: - self.api = LabelsApi() + self.api = LabelApi() def tearDown(self) -> None: pass diff --git a/test/test_memory_resource_monitor_spec.py b/test/test_memory_resource_monitor_spec.py index 0ee6a0a..a6ea65f 100644 --- a/test/test_memory_resource_monitor_spec.py +++ b/test/test_memory_resource_monitor_spec.py @@ -36,7 +36,6 @@ def make_instance(self, include_optional) -> MemoryResourceMonitorSpec: model = MemoryResourceMonitorSpec() if include_optional: return MemoryResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -44,11 +43,11 @@ def make_instance(self, include_optional) -> MemoryResourceMonitorSpec: percentage = 1.337, description = '', ) ], - sampling_interval = '68072888001528021798096225500h' + sampling_interval = '68072888001528021798096225500h', + monitor_type = '' ) else: return MemoryResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -57,6 +56,7 @@ def make_instance(self, include_optional) -> MemoryResourceMonitorSpec: description = '', ) ], sampling_interval = '68072888001528021798096225500h', + monitor_type = '', ) """ diff --git a/test/test_object_reference.py b/test/test_object_reference.py new file mode 100644 index 0000000..815b6ad --- /dev/null +++ b/test/test_object_reference.py @@ -0,0 +1,55 @@ +# 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.object_reference import ObjectReference + +class TestObjectReference(unittest.TestCase): + """ObjectReference unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ObjectReference: + """Test ObjectReference + 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 `ObjectReference` + """ + model = ObjectReference() + if include_optional: + return ObjectReference( + kind = '', + name = '' + ) + else: + return ObjectReference( + kind = '', + name = '', + ) + """ + + def testObjectReference(self): + """Test ObjectReference""" + # 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_resource_kind.py b/test/test_resource_kind.py new file mode 100644 index 0000000..63fd7db --- /dev/null +++ b/test/test_resource_kind.py @@ -0,0 +1,34 @@ +# 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.resource_kind import ResourceKind + +class TestResourceKind(unittest.TestCase): + """ResourceKind unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testResourceKind(self): + """Test ResourceKind""" + # inst = ResourceKind() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_resource_monitor_spec.py b/test/test_resource_monitor_spec.py index 388e2c6..5ffe06e 100644 --- a/test/test_resource_monitor_spec.py +++ b/test/test_resource_monitor_spec.py @@ -36,7 +36,6 @@ def make_instance(self, include_optional) -> ResourceMonitorSpec: model = ResourceMonitorSpec() if include_optional: return ResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', @@ -48,7 +47,6 @@ def make_instance(self, include_optional) -> ResourceMonitorSpec: ) else: return ResourceMonitorSpec( - monitor_type = '', alert_rules = [ flightctl.models.resource_alert_rule.ResourceAlertRule( severity = 'Warning', diff --git a/test/test_resource_updated_details.py b/test/test_resource_updated_details.py new file mode 100644 index 0000000..bd8d049 --- /dev/null +++ b/test/test_resource_updated_details.py @@ -0,0 +1,59 @@ +# 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.resource_updated_details import ResourceUpdatedDetails + +class TestResourceUpdatedDetails(unittest.TestCase): + """ResourceUpdatedDetails unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ResourceUpdatedDetails: + """Test ResourceUpdatedDetails + 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 `ResourceUpdatedDetails` + """ + model = ResourceUpdatedDetails() + if include_optional: + return ResourceUpdatedDetails( + updated_fields = [ + 'owner' + ], + previous_owner = '', + new_owner = '' + ) + else: + return ResourceUpdatedDetails( + updated_fields = [ + 'owner' + ], + ) + """ + + def testResourceUpdatedDetails(self): + """Test ResourceUpdatedDetails""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()