diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6bc9597abb6..65fad375253 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -20573,6 +20573,48 @@ components: - PIPELINES_FAILED_DESCENDING - PIPELINES_DURATION_LOST_ASCENDING - PIPELINES_DURATION_LOST_DESCENDING + FleetAgentVersion: + description: Represents an available Datadog Agent version. + properties: + attributes: + $ref: '#/components/schemas/FleetAgentVersionAttributes' + id: + description: Unique identifier for the Agent version (same as version). + example: 7.50.0 + type: string + type: + $ref: '#/components/schemas/FleetAgentVersionResourceType' + required: + - id + - type + type: object + FleetAgentVersionAttributes: + properties: + version: + description: The Agent version string. + example: 7.50.0 + type: string + type: object + FleetAgentVersionResourceType: + default: agent_version + description: The type of Agent version resource. + enum: + - agent_version + example: agent_version + type: string + x-enum-varnames: + - AGENT_VERSION + FleetAgentVersionsResponse: + description: Response containing a list of available Agent versions. + properties: + data: + description: Array of available Agent versions. + items: + $ref: '#/components/schemas/FleetAgentVersion' + type: array + required: + - data + type: object FleetDeployment: description: A deployment that defines automated configuration changes for a fleet of hosts. @@ -20611,10 +20653,30 @@ components: example: env:prod AND service:web type: string high_level_status: - description: Current high-level status of the deployment (for example, "pending", - "running", "completed", "failed"). + description: 'Current high-level status of the deployment (for example, + "pending", "running", + + "completed", "failed").' example: pending type: string + hosts: + description: 'Paginated list of hosts in this deployment with their individual + statuses. Only included + + when fetching a single deployment by ID. Use the `limit` and `page` query + parameters to + + navigate through pages. Pagination metadata is included in the response + `meta.hosts` field.' + items: + $ref: '#/components/schemas/FleetDeploymentHost' + type: array + packages: + description: List of packages to deploy to target hosts. Present only for + package upgrade deployments. + items: + $ref: '#/components/schemas/FleetDeploymentPackage' + type: array total_hosts: description: Total number of hosts targeted by this deployment. example: 42 @@ -20639,7 +20701,7 @@ components: - config_operations type: object FleetDeploymentConfigureCreate: - description: Data for creating a new deployment. + description: Data for creating a new configuration deployment. properties: attributes: $ref: '#/components/schemas/FleetDeploymentConfigureAttributes' @@ -20650,7 +20712,7 @@ components: - attributes type: object FleetDeploymentConfigureCreateRequest: - description: Request payload for creating a new deployment. + description: Request payload for creating a new configuration deployment. properties: data: $ref: '#/components/schemas/FleetDeploymentConfigureCreate' @@ -20670,6 +20732,76 @@ components: x-enum-varnames: - MERGE_PATCH - DELETE + FleetDeploymentHost: + description: A host that is part of a deployment with its current status. + properties: + error: + description: Error message if the deployment failed on this host. + example: '' + type: string + hostname: + description: The hostname of the agent. + example: web-server-01.example.com + type: string + status: + description: Current deployment status for this specific host. + example: succeeded + type: string + versions: + description: List of packages and their versions currently installed on + this host. + items: + $ref: '#/components/schemas/FleetDeploymentHostPackage' + type: array + type: object + FleetDeploymentHostPackage: + description: 'Package version information for a host, showing the initial version + before deployment, + + the target version to deploy, and the current version on the host.' + properties: + current_version: + description: The current version of the package on the host. + example: 7.51.0 + type: string + initial_version: + description: The initial version of the package on the host before the deployment + started. + example: 7.51.0 + type: string + package_name: + description: The name of the package. + example: datadog-agent + type: string + target_version: + description: The target version that the deployment is attempting to install. + example: 7.52.0 + type: string + type: object + FleetDeploymentHostsPage: + description: Pagination details for the list of hosts in a deployment. + properties: + current_page: + description: Current page index (zero-based). + example: 0 + format: int64 + type: integer + page_size: + description: Number of hosts returned per page. + example: 50 + format: int64 + type: integer + total_hosts: + description: Total number of hosts in this deployment. + example: 150 + format: int64 + type: integer + total_pages: + description: Total number of pages available. + example: 3 + format: int64 + type: integer + type: object FleetDeploymentOperation: description: A single configuration file operation to perform on the target hosts. @@ -20690,9 +20822,9 @@ components: the entire file. The structure must match the target configuration file format (for example, - YAML structure for Datadog Agent config). + YAML structure - Not applicable when using the `delete` operation.' + for Datadog Agent config). Not applicable when using the `delete` operation.' example: apm_config: enabled: true @@ -20703,6 +20835,57 @@ components: - file_op - file_path type: object + FleetDeploymentPackage: + description: A package and its target version for deployment. + properties: + name: + description: The name of the package to deploy. + example: datadog-agent + type: string + version: + description: The target version of the package to deploy. + example: 7.52.0 + type: string + required: + - name + - version + type: object + FleetDeploymentPackageUpgradeAttributes: + description: Attributes for creating a new package upgrade deployment. + properties: + filter_query: + description: Query used to filter and select target hosts for the deployment. + Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + target_packages: + description: List of packages and their target versions to deploy to the + selected hosts. + items: + $ref: '#/components/schemas/FleetDeploymentPackage' + type: array + required: + - target_packages + type: object + FleetDeploymentPackageUpgradeCreate: + description: Data for creating a new package upgrade deployment. + properties: + attributes: + $ref: '#/components/schemas/FleetDeploymentPackageUpgradeAttributes' + type: + $ref: '#/components/schemas/FleetDeploymentResourceType' + required: + - type + - attributes + type: object + FleetDeploymentPackageUpgradeCreateRequest: + description: Request payload for creating a new package upgrade deployment. + properties: + data: + $ref: '#/components/schemas/FleetDeploymentPackageUpgradeCreate' + required: + - data + type: object FleetDeploymentResourceType: default: deployment description: The type of deployment resource. @@ -20717,6 +20900,15 @@ components: properties: data: $ref: '#/components/schemas/FleetDeployment' + meta: + $ref: '#/components/schemas/FleetDeploymentResponseMeta' + type: object + FleetDeploymentResponseMeta: + description: Metadata for a single deployment response, including pagination + information for hosts. + properties: + hosts: + $ref: '#/components/schemas/FleetDeploymentHostsPage' type: object FleetDeploymentsPage: description: Pagination details for the list of deployments. @@ -20746,6 +20938,262 @@ components: page: $ref: '#/components/schemas/FleetDeploymentsPage' type: object + FleetSchedule: + description: A schedule that automatically creates deployments based on a recurrence + rule. + properties: + attributes: + $ref: '#/components/schemas/FleetScheduleAttributes' + id: + description: Unique identifier for the schedule. + example: abc-def-ghi-123 + type: string + type: + $ref: '#/components/schemas/FleetScheduleResourceType' + required: + - id + - type + - attributes + type: object + FleetScheduleAttributes: + description: Attributes of a schedule in the response. + properties: + created_at_unix: + description: Unix timestamp (seconds since epoch) when the schedule was + created. + example: 1699999999 + format: int64 + type: integer + created_by: + description: User handle of the person who created the schedule. + example: user@example.com + type: string + name: + description: Human-readable name for the schedule. + example: Weekly Production Agent Updates + type: string + query: + description: Query used to filter and select target hosts for scheduled + deployments. Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + rule: + $ref: '#/components/schemas/FleetScheduleRecurrenceRule' + status: + $ref: '#/components/schemas/FleetScheduleStatus' + updated_at_unix: + description: Unix timestamp (seconds since epoch) when the schedule was + last updated. + example: 1699999999 + format: int64 + type: integer + updated_by: + description: User handle of the person who last updated the schedule. + example: user@example.com + type: string + version_to_latest: + description: 'Number of major versions behind the latest to target for upgrades. + + - 0: Always upgrade to the latest version + + - 1: Upgrade to latest minus 1 major version + + - 2: Upgrade to latest minus 2 major versions + + Maximum value is 2.' + example: 0 + format: int64 + maximum: 2 + minimum: 0 + type: integer + type: object + FleetScheduleCreate: + description: Data for creating a new schedule. + properties: + attributes: + $ref: '#/components/schemas/FleetScheduleCreateAttributes' + type: + $ref: '#/components/schemas/FleetScheduleResourceType' + required: + - type + - attributes + type: object + FleetScheduleCreateAttributes: + description: Attributes for creating a new schedule. + properties: + name: + description: Human-readable name for the schedule. + example: Weekly Production Agent Updates + type: string + query: + description: Query used to filter and select target hosts for scheduled + deployments. Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + rule: + $ref: '#/components/schemas/FleetScheduleRecurrenceRule' + status: + $ref: '#/components/schemas/FleetScheduleStatus' + version_to_latest: + description: 'Number of major versions behind the latest to target for upgrades. + + - 0: Always upgrade to the latest version (default) + + - 1: Upgrade to latest minus 1 major version + + - 2: Upgrade to latest minus 2 major versions + + Maximum value is 2.' + example: 0 + format: int64 + maximum: 2 + minimum: 0 + type: integer + required: + - name + - query + - rule + type: object + FleetScheduleCreateRequest: + description: Request payload for creating a new schedule. + properties: + data: + $ref: '#/components/schemas/FleetScheduleCreate' + required: + - data + type: object + FleetSchedulePatch: + description: Data for partially updating a schedule. + properties: + attributes: + $ref: '#/components/schemas/FleetSchedulePatchAttributes' + type: + $ref: '#/components/schemas/FleetScheduleResourceType' + required: + - type + type: object + FleetSchedulePatchAttributes: + description: Attributes for partially updating a schedule. All fields are optional. + properties: + name: + description: Human-readable name for the schedule. + example: Weekly Production Agent Updates + type: string + query: + description: Query used to filter and select target hosts for scheduled + deployments. Uses the Datadog query syntax. + example: env:prod AND service:web + type: string + rule: + $ref: '#/components/schemas/FleetScheduleRecurrenceRule' + status: + $ref: '#/components/schemas/FleetScheduleStatus' + version_to_latest: + description: 'Number of major versions behind the latest to target for upgrades. + + - 0: Always upgrade to the latest version + + - 1: Upgrade to latest minus 1 major version + + - 2: Upgrade to latest minus 2 major versions + + Maximum value is 2.' + example: 0 + format: int64 + maximum: 2 + minimum: 0 + type: integer + type: object + FleetSchedulePatchRequest: + description: Request payload for partially updating a schedule. + properties: + data: + $ref: '#/components/schemas/FleetSchedulePatch' + required: + - data + type: object + FleetScheduleRecurrenceRule: + description: 'Defines the recurrence pattern for the schedule. Specifies when + deployments should be + + automatically triggered based on maintenance windows.' + properties: + days_of_week: + description: 'List of days of the week when the schedule should trigger. + Valid values are: + + "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun".' + example: + - Mon + - Wed + - Fri + items: + type: string + type: array + maintenance_window_duration: + description: Duration of the maintenance window in minutes. + example: 1200 + format: int64 + type: integer + start_maintenance_window: + description: 'Start time of the maintenance window in 24-hour clock format + (HH:MM). + + Deployments will be triggered at this time on the specified days.' + example: 02:00 + type: string + timezone: + description: Timezone for the schedule in IANA Time Zone Database format + (e.g., "America/New_York", "UTC"). + example: America/New_York + type: string + required: + - days_of_week + - start_maintenance_window + - maintenance_window_duration + - timezone + type: object + FleetScheduleResourceType: + default: schedule + description: The type of schedule resource. + enum: + - schedule + example: schedule + type: string + x-enum-varnames: + - SCHEDULE + FleetScheduleResponse: + description: Response containing a single schedule. + properties: + data: + $ref: '#/components/schemas/FleetSchedule' + type: object + FleetScheduleStatus: + description: 'The status of the schedule. + + - `active`: The schedule is active and will create deployments according to + its recurrence rule. + + - `inactive`: The schedule is inactive and will not create any deployments.' + enum: + - active + - inactive + example: active + type: string + x-enum-varnames: + - ACTIVE + - INACTIVE + FleetSchedulesResponse: + description: Response containing a list of schedules. + properties: + data: + description: Array of schedules. + items: + $ref: '#/components/schemas/FleetSchedule' + type: array + required: + - data + type: object FormulaLimit: description: 'Message for specifying limits to the number of values returned by a query. @@ -54359,6 +54807,49 @@ info: version: '1.0' openapi: 3.0.0 paths: + /api/unstable/fleet/agents: + get: + description: 'Retrieve a list of all available Datadog Agent versions. + + + This endpoint returns the available Agent versions that can be deployed to + your fleet. + + These versions are used when creating deployments or configuring schedules + for + + automated Agent upgrades.' + operationId: ListFleetAgentVersions + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetAgentVersionsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List all available Agent versions + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - hosts_read + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/unstable/fleet/deployments: get: description: 'Retrieve a list of all deployments for fleet automation. @@ -54414,9 +54905,15 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/unstable/fleet/deployments/configure: post: - description: 'Create a new deployment to apply configuration changes - - to a fleet of hosts matching the specified filter query.' + description: "Create a new deployment to apply configuration changes\nto a fleet + of hosts matching the specified filter query.\n\nThis endpoint supports two + types of configuration operations:\n- `merge-patch`: Merges the provided patch + data with the existing configuration file,\n creating the file if it doesn't + exist\n- `delete`: Removes the specified configuration file from the target + hosts\n\nThe deployment is created and started automatically. You can specify + multiple configuration\noperations that will be executed in order on each + target host. Use the filter query to target\nspecific hosts using the Datadog + query syntax." operationId: CreateFleetDeploymentConfigure requestBody: content: @@ -54505,7 +55002,88 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - summary: Create a deployment + summary: Create a configuration deployment + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + - fleet_policies_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/deployments/upgrade: + post: + description: 'Create and immediately start a new package upgrade + + on hosts matching the specified filter query. + + + This endpoint allows you to upgrade the Datadog Agent to a specific version + + on hosts matching the specified filter query. + + + The deployment is created and started automatically. The system will: + + 1. Identify all hosts matching the filter query + + 2. Validate that the specified version is available + + 3. Begin rolling out the package upgrade to the target hosts' + operationId: CreateFleetDeploymentUpgrade + requestBody: + content: + application/json: + examples: + upgrade_agent: + summary: Upgrade Datadog Agent to version 7.52.0 + value: + data: + attributes: + filter_query: env:prod AND service:web + target_packages: + - name: datadog-agent + version: 7.52.0 + type: deployment + upgrade_multiple_packages: + summary: Upgrade multiple packages + value: + data: + attributes: + filter_query: env:staging + target_packages: + - name: datadog-agent + version: 7.52.0-1 + - name: datadog-apm-inject + version: 0.10.0 + type: deployment + schema: + $ref: '#/components/schemas/FleetDeploymentPackageUpgradeCreateRequest' + description: Request payload containing the package upgrade details. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetDeploymentResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Upgrade hosts tags: - Fleet Automation x-permission: @@ -54518,8 +55096,22 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/unstable/fleet/deployments/{deployment_id}: get: - description: Retrieve the details of a specific deployment using its unique - identifier. + description: "Retrieve detailed information about a specific deployment using + its unique identifier.\nThis endpoint returns comprehensive information about + a deployment, including:\n- Deployment metadata (ID, type, filter query)\n- + Total number of target hosts\n- Current high-level status (pending, running, + succeeded, failed)\n- Estimated completion time\n- Configuration operations + that were or are being applied\n- Detailed host list: A paginated array of + hosts included in this deployment with individual\n host status, current + package versions, and any errors\n\nThe host list provides visibility into + the per-host execution status, allowing you to:\n- Monitor which hosts have + completed successfully\n- Identify hosts that are still in progress\n- Investigate + failures on specific hosts\n- View current package versions installed on each + host (including initial, target, and current\n versions for each package)\n\nPagination: + Use the `limit` and `page` query parameters to paginate through hosts. The + response\nincludes pagination metadata in the `meta.hosts` field with information + about the current page,\ntotal pages, and total host count. The default page + size is 50 hosts, with a maximum of 100." operationId: GetFleetDeployment parameters: - description: The unique identifier of the deployment to retrieve. @@ -54529,6 +55121,25 @@ paths: required: true schema: type: string + - description: Maximum number of hosts to return per page. Default is 50, maximum + is 100. + in: query + name: limit + required: false + schema: + default: 50 + format: int64 + maximum: 100 + type: integer + - description: Page index for pagination (zero-based). Use this to retrieve + subsequent pages of hosts. + in: query + name: page + required: false + schema: + default: 0 + format: int64 + type: integer responses: '200': content: @@ -54549,7 +55160,7 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - summary: Get a deployment by ID + summary: Get a configuration deployment by ID tags: - Fleet Automation x-permission: @@ -54561,11 +55172,23 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/unstable/fleet/deployments/{deployment_id}/cancel: post: - description: 'Cancel this deployment and stop all associated operations. + description: 'Cancel an active deployment and stop all pending operations. + + When you cancel a deployment: + + - All pending operations on hosts that haven''t started yet are stopped - If a workflow is currently running for this deployment, it is canceled immediately. + - Operations currently in progress on hosts may complete or be interrupted, + depending on their current state - Changes already applied to hosts are not rolled back.' + - Configuration changes or package upgrades already applied to hosts are not + rolled back + + + After cancellation, you can view the final state of the deployment using the + GET endpoint to see which hosts + + were successfully updated before the cancellation.' operationId: CancelFleetDeployment parameters: - description: The unique identifier of the deployment to cancel. @@ -54601,6 +55224,412 @@ paths: - fleet_policies_write x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/schedules: + get: + description: 'Retrieve a list of all schedules for automated fleet deployments. + + + Schedules allow you to automate package upgrades by defining maintenance windows + + and recurrence rules. Each schedule automatically creates deployments based + on its + + configuration.' + operationId: ListFleetSchedules + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetSchedulesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List all schedules + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - hosts_read + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Create a new schedule for automated package upgrades. + + + Schedules define when and how often to automatically deploy package upgrades + to a fleet + + of hosts. Each schedule includes: + + - A filter query to select target hosts + + - A recurrence rule defining maintenance windows + + - A version strategy (e.g., always latest, or N versions behind latest) + + + When the schedule triggers during a maintenance window, it automatically creates + a + + deployment that upgrades the Datadog Agent to the specified version on all + matching hosts.' + operationId: CreateFleetSchedule + requestBody: + content: + application/json: + examples: + conservative_staging: + summary: Conservative staging updates (N-1 version) + value: + data: + attributes: + name: Staging Environment - Conservative Updates + query: env:staging + rule: + days_of_week: + - Fri + maintenance_window_duration: 240 + start_maintenance_window: '22:00' + timezone: UTC + status: active + version_to_latest: 1 + type: schedule + weekly_production_update: + summary: Weekly production agent updates + value: + data: + attributes: + name: Weekly Production Agent Updates + query: env:prod + rule: + days_of_week: + - Mon + - Wed + maintenance_window_duration: 180 + start_maintenance_window: 02:00 + timezone: America/New_York + status: active + version_to_latest: 0 + type: schedule + schema: + $ref: '#/components/schemas/FleetScheduleCreateRequest' + description: Request payload containing the schedule details. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetScheduleResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a schedule + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/schedules/{id}: + delete: + description: 'Delete a schedule permanently. + + + When you delete a schedule: + + - The schedule is permanently removed and will no longer create deployments + + - Any deployments already created by this schedule are not affected + + - This action cannot be undone + + + If you want to temporarily stop a schedule from creating deployments, consider + + updating its status to "inactive" instead of deleting it.' + operationId: DeleteFleetSchedule + parameters: + - description: The unique identifier of the schedule to delete. + example: abc-def-ghi-123 + in: path + name: id + required: true + schema: + type: string + responses: + '204': + description: Schedule successfully deleted. + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a schedule + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: 'Retrieve detailed information about a specific schedule using + its unique identifier. + + + This endpoint returns comprehensive information about a schedule, including: + + - Schedule metadata (ID, name, creation/update timestamps) + + - Filter query for selecting target hosts + + - Recurrence rule defining when deployments are triggered + + - Version strategy for package upgrades + + - Current status (active or inactive)' + operationId: GetFleetSchedule + parameters: + - description: The unique identifier of the schedule to retrieve. + example: abc-def-ghi-123 + in: path + name: id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetScheduleResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a schedule by ID + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - hosts_read + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: 'Partially update a schedule by providing only the fields you want + to change. + + + This endpoint allows you to modify specific attributes of a schedule without + + affecting other fields. Common use cases include: + + - Changing the schedule status between active and inactive + + - Updating the maintenance window times + + - Modifying the filter query to target different hosts + + - Adjusting the version strategy + + + Only include the fields you want to update in the request body. All fields + + are optional in a PATCH request.' + operationId: UpdateFleetSchedule + parameters: + - description: The unique identifier of the schedule to update. + example: abc-def-ghi-123 + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + change_maintenance_window: + summary: Change maintenance window time + value: + data: + attributes: + rule: + days_of_week: + - Mon + - Wed + - Fri + maintenance_window_duration: 240 + start_maintenance_window: 03:00 + timezone: America/New_York + type: schedule + pause_schedule: + summary: Pause a schedule + value: + data: + attributes: + status: inactive + type: schedule + update_query: + summary: Update target hosts query + value: + data: + attributes: + query: env:prod AND service:api + type: schedule + schema: + $ref: '#/components/schemas/FleetSchedulePatchRequest' + description: Request payload containing the fields to update. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetScheduleResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a schedule + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/unstable/fleet/schedules/{id}/trigger: + post: + description: 'Manually trigger a schedule to immediately create and start a + deployment. + + + This endpoint allows you to manually initiate a deployment using the schedule''s + + configuration, without waiting for the next scheduled maintenance window. + This is + + useful for: + + - Testing a schedule before it runs automatically + + - Performing an emergency update outside the regular maintenance window + + - Creating an ad-hoc deployment with the same settings as a schedule + + + The deployment is created immediately with: + + - The same filter query as the schedule + + - The package version determined by the schedule''s version strategy + + - All matching hosts as targets + + + The manually triggered deployment is independent of the schedule and does + not + + affect the schedule''s normal recurrence pattern.' + operationId: TriggerFleetSchedule + parameters: + - description: The unique identifier of the schedule to trigger. + example: abc-def-ghi-123 + in: path + name: id + required: true + schema: + type: string + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FleetDeploymentResponse' + description: CREATED - Deployment successfully created and started. + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Trigger a schedule deployment + tags: + - Fleet Automation + x-permission: + operator: AND + permissions: + - agent_upgrade_write + x-unstable: 'This endpoint is in Preview and may introduce breaking changes. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/actions-datastores: get: @@ -81558,9 +82587,24 @@ tags: name: Fastly Integration - description: 'Manage automated deployments across your fleet of hosts. - Use these endpoints to create, retrieve, and cancel deployments - that apply configuration changes to multiple hosts at once.' + Fleet Automation provides two types of deployments: + + + Configuration Deployments (`/configure`): + + - Apply configuration file changes to target hosts + + - Support merge-patch operations to update specific configuration fields + + - Support delete operations to remove configuration files + + - Useful for updating Datadog Agent settings, integration configs, and more + + + Package Upgrade Deployments (`/upgrade`): + + - Upgrade the Datadog Agent to specific versions' name: Fleet Automation - description: 'Configure your Datadog-Google Cloud Platform (GCP) integration directly diff --git a/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.rb b/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.rb index 5767c0cf6c2..3cb060517cf 100644 --- a/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.rb +++ b/examples/v2/fleet-automation/CreateFleetDeploymentConfigure.rb @@ -1,4 +1,4 @@ -# Create a deployment returns "CREATED" response +# Create a configuration deployment returns "CREATED" response require "datadog_api_client" DatadogAPIClient.configure do |config| diff --git a/examples/v2/fleet-automation/CreateFleetDeploymentUpgrade.rb b/examples/v2/fleet-automation/CreateFleetDeploymentUpgrade.rb new file mode 100644 index 00000000000..d245b2e237a --- /dev/null +++ b/examples/v2/fleet-automation/CreateFleetDeploymentUpgrade.rb @@ -0,0 +1,23 @@ +# Upgrade hosts returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_fleet_deployment_upgrade".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new + +body = DatadogAPIClient::V2::FleetDeploymentPackageUpgradeCreateRequest.new({ + data: DatadogAPIClient::V2::FleetDeploymentPackageUpgradeCreate.new({ + attributes: DatadogAPIClient::V2::FleetDeploymentPackageUpgradeAttributes.new({ + filter_query: "env:prod AND service:web", + target_packages: [ + DatadogAPIClient::V2::FleetDeploymentPackage.new({ + name: "datadog-agent", + version: "7.52.0", + }), + ], + }), + type: DatadogAPIClient::V2::FleetDeploymentResourceType::DEPLOYMENT, + }), +}) +p api_instance.create_fleet_deployment_upgrade(body) diff --git a/examples/v2/fleet-automation/CreateFleetSchedule.rb b/examples/v2/fleet-automation/CreateFleetSchedule.rb new file mode 100644 index 00000000000..047db017406 --- /dev/null +++ b/examples/v2/fleet-automation/CreateFleetSchedule.rb @@ -0,0 +1,30 @@ +# Create a schedule returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_fleet_schedule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new + +body = DatadogAPIClient::V2::FleetScheduleCreateRequest.new({ + data: DatadogAPIClient::V2::FleetScheduleCreate.new({ + attributes: DatadogAPIClient::V2::FleetScheduleCreateAttributes.new({ + name: "Weekly Production Agent Updates", + query: "env:prod AND service:web", + rule: DatadogAPIClient::V2::FleetScheduleRecurrenceRule.new({ + days_of_week: [ + "Mon", + "Wed", + "Fri", + ], + maintenance_window_duration: 1200, + start_maintenance_window: "02:00", + timezone: "America/New_York", + }), + status: DatadogAPIClient::V2::FleetScheduleStatus::ACTIVE, + version_to_latest: 0, + }), + type: DatadogAPIClient::V2::FleetScheduleResourceType::SCHEDULE, + }), +}) +p api_instance.create_fleet_schedule(body) diff --git a/examples/v2/fleet-automation/DeleteFleetSchedule.rb b/examples/v2/fleet-automation/DeleteFleetSchedule.rb new file mode 100644 index 00000000000..e06d9999aee --- /dev/null +++ b/examples/v2/fleet-automation/DeleteFleetSchedule.rb @@ -0,0 +1,8 @@ +# Delete a schedule returns "Schedule successfully deleted." response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_fleet_schedule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new +api_instance.delete_fleet_schedule("id") diff --git a/examples/v2/fleet-automation/GetFleetDeployment.rb b/examples/v2/fleet-automation/GetFleetDeployment.rb index 19fa3f94565..0b294306dd8 100644 --- a/examples/v2/fleet-automation/GetFleetDeployment.rb +++ b/examples/v2/fleet-automation/GetFleetDeployment.rb @@ -1,11 +1,8 @@ -# Get a deployment by ID returns "OK" response +# Get a configuration deployment by ID returns "OK" response require "datadog_api_client" DatadogAPIClient.configure do |config| config.unstable_operations["v2.get_fleet_deployment".to_sym] = true end api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new - -# there is a valid "deployment" in the system -DEPLOYMENT_ID = ENV["DEPLOYMENT_ID"] -p api_instance.get_fleet_deployment(DEPLOYMENT_ID) +p api_instance.get_fleet_deployment("deployment_id") diff --git a/examples/v2/fleet-automation/GetFleetDeployment_1482493803.rb b/examples/v2/fleet-automation/GetFleetDeployment_1482493803.rb new file mode 100644 index 00000000000..19fa3f94565 --- /dev/null +++ b/examples/v2/fleet-automation/GetFleetDeployment_1482493803.rb @@ -0,0 +1,11 @@ +# Get a deployment by ID returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_fleet_deployment".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new + +# there is a valid "deployment" in the system +DEPLOYMENT_ID = ENV["DEPLOYMENT_ID"] +p api_instance.get_fleet_deployment(DEPLOYMENT_ID) diff --git a/examples/v2/fleet-automation/GetFleetSchedule.rb b/examples/v2/fleet-automation/GetFleetSchedule.rb new file mode 100644 index 00000000000..b630e14b0c9 --- /dev/null +++ b/examples/v2/fleet-automation/GetFleetSchedule.rb @@ -0,0 +1,8 @@ +# Get a schedule by ID returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_fleet_schedule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new +p api_instance.get_fleet_schedule("id") diff --git a/examples/v2/fleet-automation/ListFleetAgentVersions.rb b/examples/v2/fleet-automation/ListFleetAgentVersions.rb new file mode 100644 index 00000000000..9fde32f6934 --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetAgentVersions.rb @@ -0,0 +1,8 @@ +# List all available Agent versions returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_fleet_agent_versions".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new +p api_instance.list_fleet_agent_versions() diff --git a/examples/v2/fleet-automation/ListFleetSchedules.rb b/examples/v2/fleet-automation/ListFleetSchedules.rb new file mode 100644 index 00000000000..0cc7f849603 --- /dev/null +++ b/examples/v2/fleet-automation/ListFleetSchedules.rb @@ -0,0 +1,8 @@ +# List all schedules returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_fleet_schedules".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new +p api_instance.list_fleet_schedules() diff --git a/examples/v2/fleet-automation/TriggerFleetSchedule.rb b/examples/v2/fleet-automation/TriggerFleetSchedule.rb new file mode 100644 index 00000000000..75ef8d9cfac --- /dev/null +++ b/examples/v2/fleet-automation/TriggerFleetSchedule.rb @@ -0,0 +1,8 @@ +# Trigger a schedule deployment returns "CREATED - Deployment successfully created and started." response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.trigger_fleet_schedule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new +p api_instance.trigger_fleet_schedule("id") diff --git a/examples/v2/fleet-automation/UpdateFleetSchedule.rb b/examples/v2/fleet-automation/UpdateFleetSchedule.rb new file mode 100644 index 00000000000..a674f6c5dab --- /dev/null +++ b/examples/v2/fleet-automation/UpdateFleetSchedule.rb @@ -0,0 +1,30 @@ +# Update a schedule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_fleet_schedule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::FleetAutomationAPI.new + +body = DatadogAPIClient::V2::FleetSchedulePatchRequest.new({ + data: DatadogAPIClient::V2::FleetSchedulePatch.new({ + attributes: DatadogAPIClient::V2::FleetSchedulePatchAttributes.new({ + name: "Weekly Production Agent Updates", + query: "env:prod AND service:web", + rule: DatadogAPIClient::V2::FleetScheduleRecurrenceRule.new({ + days_of_week: [ + "Mon", + "Wed", + "Fri", + ], + maintenance_window_duration: 1200, + start_maintenance_window: "02:00", + timezone: "America/New_York", + }), + status: DatadogAPIClient::V2::FleetScheduleStatus::ACTIVE, + version_to_latest: 0, + }), + type: DatadogAPIClient::V2::FleetScheduleResourceType::SCHEDULE, + }), +}) +p api_instance.update_fleet_schedule("id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index c2363cbeaf4..c3300f2bac9 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -845,12 +845,33 @@ "v2.CreateFleetDeploymentConfigure" => { "body" => "FleetDeploymentConfigureCreateRequest", }, + "v2.CreateFleetDeploymentUpgrade" => { + "body" => "FleetDeploymentPackageUpgradeCreateRequest", + }, "v2.GetFleetDeployment" => { "deployment_id" => "String", + "limit" => "Integer", + "page" => "Integer", }, "v2.CancelFleetDeployment" => { "deployment_id" => "String", }, + "v2.CreateFleetSchedule" => { + "body" => "FleetScheduleCreateRequest", + }, + "v2.DeleteFleetSchedule" => { + "id" => "String", + }, + "v2.GetFleetSchedule" => { + "id" => "String", + }, + "v2.UpdateFleetSchedule" => { + "id" => "String", + "body" => "FleetSchedulePatchRequest", + }, + "v2.TriggerFleetSchedule" => { + "id" => "String", + }, "v2.CreateDatastore" => { "body" => "CreateAppsDatastoreRequest", }, diff --git a/features/v2/fleet_automation.feature b/features/v2/fleet_automation.feature index 2e91b6e0a85..0024399c745 100644 --- a/features/v2/fleet_automation.feature +++ b/features/v2/fleet_automation.feature @@ -1,8 +1,13 @@ @endpoint(fleet-automation) @endpoint(fleet-automation-v2) Feature: Fleet Automation - Manage automated deployments across your fleet of hosts. Use these - endpoints to create, retrieve, and cancel deployments that apply - configuration changes to multiple hosts at once. + Manage automated deployments across your fleet of hosts. Fleet Automation + provides two types of deployments: Configuration Deployments + (`/configure`): - Apply configuration file changes to target hosts - + Support merge-patch operations to update specific configuration fields - + Support delete operations to remove configuration files - Useful for + updating Datadog Agent settings, integration configs, and more Package + Upgrade Deployments (`/upgrade`): - Upgrade the Datadog Agent to specific + versions Background: Given a valid "apiKeyAuth" key in the system @@ -34,7 +39,7 @@ Feature: Fleet Automation Then the response status is 404 Not Found @generated @skip @team:DataDog/fleet-automation - Scenario: Create a deployment returns "Bad Request" response + Scenario: Create a configuration deployment returns "Bad Request" response Given operation "CreateFleetDeploymentConfigure" enabled And new "CreateFleetDeploymentConfigure" request And body with value {"data": {"attributes": {"config_operations": [{"file_op": "merge-patch", "file_path": "/datadog.yaml", "patch": {"apm_config": {"enabled": true}, "log_level": "debug", "logs_enabled": true}}], "filter_query": "env:prod AND service:web"}, "type": "deployment"}} @@ -42,7 +47,7 @@ Feature: Fleet Automation Then the response status is 400 Bad Request @generated @skip @team:DataDog/fleet-automation - Scenario: Create a deployment returns "CREATED" response + Scenario: Create a configuration deployment returns "CREATED" response Given operation "CreateFleetDeploymentConfigure" enabled And new "CreateFleetDeploymentConfigure" request And body with value {"data": {"attributes": {"config_operations": [{"file_op": "merge-patch", "file_path": "/datadog.yaml", "patch": {"apm_config": {"enabled": true}, "log_level": "debug", "logs_enabled": true}}], "filter_query": "env:prod AND service:web"}, "type": "deployment"}} @@ -50,7 +55,47 @@ Feature: Fleet Automation Then the response status is 201 CREATED @generated @skip @team:DataDog/fleet-automation - Scenario: Get a deployment by ID returns "Bad Request" response + Scenario: Create a schedule returns "Bad Request" response + Given operation "CreateFleetSchedule" enabled + And new "CreateFleetSchedule" request + And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Create a schedule returns "CREATED" response + Given operation "CreateFleetSchedule" enabled + And new "CreateFleetSchedule" request + And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/fleet-automation + Scenario: Delete a schedule returns "Bad Request" response + Given operation "DeleteFleetSchedule" enabled + And new "DeleteFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Delete a schedule returns "Not Found" response + Given operation "DeleteFleetSchedule" enabled + And new "DeleteFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: Delete a schedule returns "Schedule successfully deleted." response + Given operation "DeleteFleetSchedule" enabled + And new "DeleteFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 Schedule successfully deleted. + + @generated @skip @team:DataDog/fleet-automation + Scenario: Get a configuration deployment by ID returns "Bad Request" response Given operation "GetFleetDeployment" enabled And new "GetFleetDeployment" request And request contains "deployment_id" parameter from "REPLACE.ME" @@ -58,13 +103,21 @@ Feature: Fleet Automation Then the response status is 400 Bad Request @generated @skip @team:DataDog/fleet-automation - Scenario: Get a deployment by ID returns "Not Found" response + Scenario: Get a configuration deployment by ID returns "Not Found" response Given operation "GetFleetDeployment" enabled And new "GetFleetDeployment" request And request contains "deployment_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/fleet-automation + Scenario: Get a configuration deployment by ID returns "OK" response + Given operation "GetFleetDeployment" enabled + And new "GetFleetDeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/fleet-automation Scenario: Get a deployment by ID returns "OK" response Given operation "GetFleetDeployment" enabled @@ -74,6 +127,52 @@ Feature: Fleet Automation When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation + Scenario: Get a schedule by ID returns "Bad Request" response + Given operation "GetFleetSchedule" enabled + And new "GetFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Get a schedule by ID returns "Not Found" response + Given operation "GetFleetSchedule" enabled + And new "GetFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/fleet-automation + Scenario: Get a schedule by ID returns "OK" response + Given operation "GetFleetSchedule" enabled + And there is a valid "fleet_schedule" in the system + And new "GetFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all available Agent versions returns "Bad Request" response + Given operation "ListFleetAgentVersions" enabled + And new "ListFleetAgentVersions" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all available Agent versions returns "Not Found" response + Given operation "ListFleetAgentVersions" enabled + And new "ListFleetAgentVersions" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all available Agent versions returns "OK" response + Given operation "ListFleetAgentVersions" enabled + And new "ListFleetAgentVersions" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/fleet-automation Scenario: List all deployments returns "Bad Request" response Given operation "ListFleetDeployments" enabled @@ -87,3 +186,92 @@ Feature: Fleet Automation And new "ListFleetDeployments" request When the request is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all schedules returns "Bad Request" response + Given operation "ListFleetSchedules" enabled + And new "ListFleetSchedules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: List all schedules returns "OK" response + Given operation "ListFleetSchedules" enabled + And new "ListFleetSchedules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: Trigger a schedule deployment returns "Bad Request" response + Given operation "TriggerFleetSchedule" enabled + And new "TriggerFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Trigger a schedule deployment returns "CREATED - Deployment successfully created and started." response + Given operation "TriggerFleetSchedule" enabled + And new "TriggerFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 CREATED - Deployment successfully created and started. + + @generated @skip @team:DataDog/fleet-automation + Scenario: Trigger a schedule deployment returns "Not Found" response + Given operation "TriggerFleetSchedule" enabled + And new "TriggerFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: Update a schedule returns "Bad Request" response + Given operation "UpdateFleetSchedule" enabled + And new "UpdateFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Update a schedule returns "Not Found" response + Given operation "UpdateFleetSchedule" enabled + And new "UpdateFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/fleet-automation + Scenario: Update a schedule returns "OK" response + Given operation "UpdateFleetSchedule" enabled + And new "UpdateFleetSchedule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "Weekly Production Agent Updates", "query": "env:prod AND service:web", "rule": {"days_of_week": ["Mon", "Wed", "Fri"], "maintenance_window_duration": 1200, "start_maintenance_window": "02:00", "timezone": "America/New_York"}, "status": "active", "version_to_latest": 0}, "type": "schedule"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/fleet-automation + Scenario: Upgrade hosts returns "Bad Request" response + Given operation "CreateFleetDeploymentUpgrade" enabled + And new "CreateFleetDeploymentUpgrade" request + And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/fleet-automation + Scenario: Upgrade hosts returns "CREATED" response + Given operation "CreateFleetDeploymentUpgrade" enabled + And new "CreateFleetDeploymentUpgrade" request + And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/fleet-automation + Scenario: Upgrade hosts returns "Not Found" response + Given operation "CreateFleetDeploymentUpgrade" enabled + And new "CreateFleetDeploymentUpgrade" request + And body with value {"data": {"attributes": {"filter_query": "env:prod AND service:web", "target_packages": [{"name": "datadog-agent", "version": "7.52.0"}]}, "type": "deployment"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/features/v2/given.json b/features/v2/given.json index 7c9df160aad..12852be0f21 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -12,6 +12,32 @@ "tag": "Fleet Automation", "operationId": "CreateFleetDeploymentConfigure" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"deployment\",\n \"attributes\": {\n \"filter_query\": \"env:prod AND service:{{ unique_lower }}\",\n \"target_packages\": [\n {\n \"name\": \"datadog-agent\",\n \"version\": \"7.52.0\"\n }\n ]\n }\n }\n}" + } + ], + "source": "data", + "step": "there is a valid \"package_deployment\" in the system", + "key": "package_deployment", + "tag": "Fleet Automation", + "operationId": "CreateFleetDeploymentUpgrade" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"schedule\",\n \"attributes\": {\n \"name\": \"Weekly {{ unique }} Updates\",\n \"query\": \"env:prod AND service:{{ unique_lower }}\",\n \"status\": \"active\",\n \"version_to_latest\": 0,\n \"rule\": {\n \"days_of_week\": [\"Mon\"],\n \"start_maintenance_window\": \"02:00\",\n \"maintenance_window_duration\": 120,\n \"timezone\": \"America/New_York\"\n }\n }\n }\n}" + } + ], + "source": "data", + "step": "there is a valid \"fleet_schedule\" in the system", + "key": "schedule", + "tag": "Fleet Automation", + "operationId": "CreateFleetSchedule" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 1865379ddbe..07c8d427480 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1,4 +1,10 @@ { + "ListFleetAgentVersions": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, "ListFleetDeployments": { "tag": "Fleet Automation", "undo": { @@ -18,6 +24,19 @@ "type": "unsafe" } }, + "CreateFleetDeploymentUpgrade": { + "tag": "Fleet Automation", + "undo": { + "operationId": "CancelFleetDeployment", + "parameters": [ + { + "name": "deployment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "GetFleetDeployment": { "tag": "Fleet Automation", "undo": { @@ -30,6 +49,56 @@ "type": "idempotent" } }, + "ListFleetSchedules": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, + "CreateFleetSchedule": { + "tag": "Fleet Automation", + "undo": { + "operationId": "DeleteFleetSchedule", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteFleetSchedule": { + "tag": "Fleet Automation", + "undo": { + "type": "unsafe" + } + }, + "GetFleetSchedule": { + "tag": "Fleet Automation", + "undo": { + "type": "safe" + } + }, + "UpdateFleetSchedule": { + "tag": "Fleet Automation", + "undo": { + "type": "idempotent" + } + }, + "TriggerFleetSchedule": { + "tag": "Fleet Automation", + "undo": { + "operationId": "CancelFleetDeployment", + "parameters": [ + { + "name": "deployment_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, "ListDatastores": { "tag": "Actions Datastores", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index fdc24843a85..27982fb24d3 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -191,8 +191,16 @@ def initialize @unstable_operations = { "v2.cancel_fleet_deployment": false, "v2.create_fleet_deployment_configure": false, + "v2.create_fleet_deployment_upgrade": false, + "v2.create_fleet_schedule": false, + "v2.delete_fleet_schedule": false, "v2.get_fleet_deployment": false, + "v2.get_fleet_schedule": false, + "v2.list_fleet_agent_versions": false, "v2.list_fleet_deployments": false, + "v2.list_fleet_schedules": false, + "v2.trigger_fleet_schedule": false, + "v2.update_fleet_schedule": false, "v2.create_open_api": false, "v2.delete_open_api": false, "v2.get_open_api": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 820104ace4b..34978a4871d 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2169,18 +2169,43 @@ def overrides "v2.flaky_tests_search_sort" => "FlakyTestsSearchSort", "v2.flaky_test_stats" => "FlakyTestStats", "v2.flaky_test_type" => "FlakyTestType", + "v2.fleet_agent_version" => "FleetAgentVersion", + "v2.fleet_agent_version_attributes" => "FleetAgentVersionAttributes", + "v2.fleet_agent_version_resource_type" => "FleetAgentVersionResourceType", + "v2.fleet_agent_versions_response" => "FleetAgentVersionsResponse", "v2.fleet_deployment" => "FleetDeployment", "v2.fleet_deployment_attributes" => "FleetDeploymentAttributes", "v2.fleet_deployment_configure_attributes" => "FleetDeploymentConfigureAttributes", "v2.fleet_deployment_configure_create" => "FleetDeploymentConfigureCreate", "v2.fleet_deployment_configure_create_request" => "FleetDeploymentConfigureCreateRequest", "v2.fleet_deployment_file_op" => "FleetDeploymentFileOp", + "v2.fleet_deployment_host" => "FleetDeploymentHost", + "v2.fleet_deployment_host_package" => "FleetDeploymentHostPackage", + "v2.fleet_deployment_hosts_page" => "FleetDeploymentHostsPage", "v2.fleet_deployment_operation" => "FleetDeploymentOperation", + "v2.fleet_deployment_package" => "FleetDeploymentPackage", + "v2.fleet_deployment_package_upgrade_attributes" => "FleetDeploymentPackageUpgradeAttributes", + "v2.fleet_deployment_package_upgrade_create" => "FleetDeploymentPackageUpgradeCreate", + "v2.fleet_deployment_package_upgrade_create_request" => "FleetDeploymentPackageUpgradeCreateRequest", "v2.fleet_deployment_resource_type" => "FleetDeploymentResourceType", "v2.fleet_deployment_response" => "FleetDeploymentResponse", + "v2.fleet_deployment_response_meta" => "FleetDeploymentResponseMeta", "v2.fleet_deployments_page" => "FleetDeploymentsPage", "v2.fleet_deployments_response" => "FleetDeploymentsResponse", "v2.fleet_deployments_response_meta" => "FleetDeploymentsResponseMeta", + "v2.fleet_schedule" => "FleetSchedule", + "v2.fleet_schedule_attributes" => "FleetScheduleAttributes", + "v2.fleet_schedule_create" => "FleetScheduleCreate", + "v2.fleet_schedule_create_attributes" => "FleetScheduleCreateAttributes", + "v2.fleet_schedule_create_request" => "FleetScheduleCreateRequest", + "v2.fleet_schedule_patch" => "FleetSchedulePatch", + "v2.fleet_schedule_patch_attributes" => "FleetSchedulePatchAttributes", + "v2.fleet_schedule_patch_request" => "FleetSchedulePatchRequest", + "v2.fleet_schedule_recurrence_rule" => "FleetScheduleRecurrenceRule", + "v2.fleet_schedule_resource_type" => "FleetScheduleResourceType", + "v2.fleet_schedule_response" => "FleetScheduleResponse", + "v2.fleet_schedules_response" => "FleetSchedulesResponse", + "v2.fleet_schedule_status" => "FleetScheduleStatus", "v2.formula_limit" => "FormulaLimit", "v2.framework_handle_and_version_response_data" => "FrameworkHandleAndVersionResponseData", "v2.freshservice_api_key" => "FreshserviceAPIKey", diff --git a/lib/datadog_api_client/v2/api/fleet_automation_api.rb b/lib/datadog_api_client/v2/api/fleet_automation_api.rb index 36adfbc8e39..dfcd6881403 100644 --- a/lib/datadog_api_client/v2/api/fleet_automation_api.rb +++ b/lib/datadog_api_client/v2/api/fleet_automation_api.rb @@ -33,9 +33,14 @@ def cancel_fleet_deployment(deployment_id, opts = {}) # Cancel a deployment. # - # Cancel this deployment and stop all associated operations. - # If a workflow is currently running for this deployment, it is canceled immediately. - # Changes already applied to hosts are not rolled back. + # Cancel an active deployment and stop all pending operations. + # When you cancel a deployment: + # - All pending operations on hosts that haven't started yet are stopped + # - Operations currently in progress on hosts may complete or be interrupted, depending on their current state + # - Configuration changes or package upgrades already applied to hosts are not rolled back + # + # After cancellation, you can view the final state of the deployment using the GET endpoint to see which hosts + # were successfully updated before the cancellation. # # @param deployment_id [String] The unique identifier of the deployment to cancel. # @param opts [Hash] the optional parameters @@ -96,7 +101,7 @@ def cancel_fleet_deployment_with_http_info(deployment_id, opts = {}) return data, status_code, headers end - # Create a deployment. + # Create a configuration deployment. # # @see #create_fleet_deployment_configure_with_http_info def create_fleet_deployment_configure(body, opts = {}) @@ -104,11 +109,20 @@ def create_fleet_deployment_configure(body, opts = {}) data end - # Create a deployment. + # Create a configuration deployment. # # Create a new deployment to apply configuration changes # to a fleet of hosts matching the specified filter query. # + # This endpoint supports two types of configuration operations: + # - `merge-patch`: Merges the provided patch data with the existing configuration file, + # creating the file if it doesn't exist + # - `delete`: Removes the specified configuration file from the target hosts + # + # The deployment is created and started automatically. You can specify multiple configuration + # operations that will be executed in order on each target host. Use the filter query to target + # specific hosts using the Datadog query syntax. + # # @param body [FleetDeploymentConfigureCreateRequest] Request payload containing the deployment details. # @param opts [Hash] the optional parameters # @return [Array<(FleetDeploymentResponse, Integer, Hash)>] FleetDeploymentResponse data, response status code and response headers @@ -170,7 +184,250 @@ def create_fleet_deployment_configure_with_http_info(body, opts = {}) return data, status_code, headers end - # Get a deployment by ID. + # Upgrade hosts. + # + # @see #create_fleet_deployment_upgrade_with_http_info + def create_fleet_deployment_upgrade(body, opts = {}) + data, _status_code, _headers = create_fleet_deployment_upgrade_with_http_info(body, opts) + data + end + + # Upgrade hosts. + # + # Create and immediately start a new package upgrade + # on hosts matching the specified filter query. + # + # This endpoint allows you to upgrade the Datadog Agent to a specific version + # on hosts matching the specified filter query. + # + # The deployment is created and started automatically. The system will: + # 1. Identify all hosts matching the filter query + # 2. Validate that the specified version is available + # 3. Begin rolling out the package upgrade to the target hosts + # + # @param body [FleetDeploymentPackageUpgradeCreateRequest] Request payload containing the package upgrade details. + # @param opts [Hash] the optional parameters + # @return [Array<(FleetDeploymentResponse, Integer, Hash)>] FleetDeploymentResponse data, response status code and response headers + def create_fleet_deployment_upgrade_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_fleet_deployment_upgrade".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_fleet_deployment_upgrade") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_fleet_deployment_upgrade")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.create_fleet_deployment_upgrade ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FleetAutomationAPI.create_fleet_deployment_upgrade" + end + # resource path + local_var_path = '/api/unstable/fleet/deployments/upgrade' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FleetDeploymentResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_fleet_deployment_upgrade, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#create_fleet_deployment_upgrade\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a schedule. + # + # @see #create_fleet_schedule_with_http_info + def create_fleet_schedule(body, opts = {}) + data, _status_code, _headers = create_fleet_schedule_with_http_info(body, opts) + data + end + + # Create a schedule. + # + # Create a new schedule for automated package upgrades. + # + # Schedules define when and how often to automatically deploy package upgrades to a fleet + # of hosts. Each schedule includes: + # - A filter query to select target hosts + # - A recurrence rule defining maintenance windows + # - A version strategy (e.g., always latest, or N versions behind latest) + # + # When the schedule triggers during a maintenance window, it automatically creates a + # deployment that upgrades the Datadog Agent to the specified version on all matching hosts. + # + # @param body [FleetScheduleCreateRequest] Request payload containing the schedule details. + # @param opts [Hash] the optional parameters + # @return [Array<(FleetScheduleResponse, Integer, Hash)>] FleetScheduleResponse data, response status code and response headers + def create_fleet_schedule_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_fleet_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_fleet_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_fleet_schedule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.create_fleet_schedule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FleetAutomationAPI.create_fleet_schedule" + end + # resource path + local_var_path = '/api/unstable/fleet/schedules' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FleetScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_fleet_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#create_fleet_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a schedule. + # + # @see #delete_fleet_schedule_with_http_info + def delete_fleet_schedule(id, opts = {}) + delete_fleet_schedule_with_http_info(id, opts) + nil + end + + # Delete a schedule. + # + # Delete a schedule permanently. + # + # When you delete a schedule: + # - The schedule is permanently removed and will no longer create deployments + # - Any deployments already created by this schedule are not affected + # - This action cannot be undone + # + # If you want to temporarily stop a schedule from creating deployments, consider + # updating its status to "inactive" instead of deleting it. + # + # @param id [String] The unique identifier of the schedule to delete. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_fleet_schedule_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_fleet_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_fleet_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_fleet_schedule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.delete_fleet_schedule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling FleetAutomationAPI.delete_fleet_schedule" + end + # resource path + local_var_path = '/api/unstable/fleet/schedules/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_fleet_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#delete_fleet_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a configuration deployment by ID. # # @see #get_fleet_deployment_with_http_info def get_fleet_deployment(deployment_id, opts = {}) @@ -178,12 +435,33 @@ def get_fleet_deployment(deployment_id, opts = {}) data end - # Get a deployment by ID. + # Get a configuration deployment by ID. + # + # Retrieve detailed information about a specific deployment using its unique identifier. + # This endpoint returns comprehensive information about a deployment, including: + # - Deployment metadata (ID, type, filter query) + # - Total number of target hosts + # - Current high-level status (pending, running, succeeded, failed) + # - Estimated completion time + # - Configuration operations that were or are being applied + # - Detailed host list: A paginated array of hosts included in this deployment with individual + # host status, current package versions, and any errors # - # Retrieve the details of a specific deployment using its unique identifier. + # The host list provides visibility into the per-host execution status, allowing you to: + # - Monitor which hosts have completed successfully + # - Identify hosts that are still in progress + # - Investigate failures on specific hosts + # - View current package versions installed on each host (including initial, target, and current + # versions for each package) + # + # Pagination: Use the `limit` and `page` query parameters to paginate through hosts. The response + # includes pagination metadata in the `meta.hosts` field with information about the current page, + # total pages, and total host count. The default page size is 50 hosts, with a maximum of 100. # # @param deployment_id [String] The unique identifier of the deployment to retrieve. # @param opts [Hash] the optional parameters + # @option opts [Integer] :limit Maximum number of hosts to return per page. Default is 50, maximum is 100. + # @option opts [Integer] :page Page index for pagination (zero-based). Use this to retrieve subsequent pages of hosts. # @return [Array<(FleetDeploymentResponse, Integer, Hash)>] FleetDeploymentResponse data, response status code and response headers def get_fleet_deployment_with_http_info(deployment_id, opts = {}) unstable_enabled = @api_client.config.unstable_operations["v2.get_fleet_deployment".to_sym] @@ -200,11 +478,16 @@ def get_fleet_deployment_with_http_info(deployment_id, opts = {}) if @api_client.config.client_side_validation && deployment_id.nil? fail ArgumentError, "Missing the required parameter 'deployment_id' when calling FleetAutomationAPI.get_fleet_deployment" end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling FleetAutomationAPI.get_fleet_deployment, must be smaller than or equal to 100.' + end # resource path local_var_path = '/api/unstable/fleet/deployments/{deployment_id}'.sub('{deployment_id}', CGI.escape(deployment_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? # header parameters header_params = opts[:header_params] || {} @@ -241,6 +524,154 @@ def get_fleet_deployment_with_http_info(deployment_id, opts = {}) return data, status_code, headers end + # Get a schedule by ID. + # + # @see #get_fleet_schedule_with_http_info + def get_fleet_schedule(id, opts = {}) + data, _status_code, _headers = get_fleet_schedule_with_http_info(id, opts) + data + end + + # Get a schedule by ID. + # + # Retrieve detailed information about a specific schedule using its unique identifier. + # + # This endpoint returns comprehensive information about a schedule, including: + # - Schedule metadata (ID, name, creation/update timestamps) + # - Filter query for selecting target hosts + # - Recurrence rule defining when deployments are triggered + # - Version strategy for package upgrades + # - Current status (active or inactive) + # + # @param id [String] The unique identifier of the schedule to retrieve. + # @param opts [Hash] the optional parameters + # @return [Array<(FleetScheduleResponse, Integer, Hash)>] FleetScheduleResponse data, response status code and response headers + def get_fleet_schedule_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_fleet_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_fleet_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_fleet_schedule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.get_fleet_schedule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling FleetAutomationAPI.get_fleet_schedule" + end + # resource path + local_var_path = '/api/unstable/fleet/schedules/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FleetScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_fleet_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#get_fleet_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List all available Agent versions. + # + # @see #list_fleet_agent_versions_with_http_info + def list_fleet_agent_versions(opts = {}) + data, _status_code, _headers = list_fleet_agent_versions_with_http_info(opts) + data + end + + # List all available Agent versions. + # + # Retrieve a list of all available Datadog Agent versions. + # + # This endpoint returns the available Agent versions that can be deployed to your fleet. + # These versions are used when creating deployments or configuring schedules for + # automated Agent upgrades. + # + # @param opts [Hash] the optional parameters + # @return [Array<(FleetAgentVersionsResponse, Integer, Hash)>] FleetAgentVersionsResponse data, response status code and response headers + def list_fleet_agent_versions_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_fleet_agent_versions".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_fleet_agent_versions") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_fleet_agent_versions")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.list_fleet_agent_versions ...' + end + # resource path + local_var_path = '/api/unstable/fleet/agents' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FleetAgentVersionsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_fleet_agent_versions, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#list_fleet_agent_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List all deployments. # # @see #list_fleet_deployments_with_http_info @@ -314,5 +745,249 @@ def list_fleet_deployments_with_http_info(opts = {}) end return data, status_code, headers end + + # List all schedules. + # + # @see #list_fleet_schedules_with_http_info + def list_fleet_schedules(opts = {}) + data, _status_code, _headers = list_fleet_schedules_with_http_info(opts) + data + end + + # List all schedules. + # + # Retrieve a list of all schedules for automated fleet deployments. + # + # Schedules allow you to automate package upgrades by defining maintenance windows + # and recurrence rules. Each schedule automatically creates deployments based on its + # configuration. + # + # @param opts [Hash] the optional parameters + # @return [Array<(FleetSchedulesResponse, Integer, Hash)>] FleetSchedulesResponse data, response status code and response headers + def list_fleet_schedules_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_fleet_schedules".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_fleet_schedules") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_fleet_schedules")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.list_fleet_schedules ...' + end + # resource path + local_var_path = '/api/unstable/fleet/schedules' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FleetSchedulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_fleet_schedules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#list_fleet_schedules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Trigger a schedule deployment. + # + # @see #trigger_fleet_schedule_with_http_info + def trigger_fleet_schedule(id, opts = {}) + data, _status_code, _headers = trigger_fleet_schedule_with_http_info(id, opts) + data + end + + # Trigger a schedule deployment. + # + # Manually trigger a schedule to immediately create and start a deployment. + # + # This endpoint allows you to manually initiate a deployment using the schedule's + # configuration, without waiting for the next scheduled maintenance window. This is + # useful for: + # - Testing a schedule before it runs automatically + # - Performing an emergency update outside the regular maintenance window + # - Creating an ad-hoc deployment with the same settings as a schedule + # + # The deployment is created immediately with: + # - The same filter query as the schedule + # - The package version determined by the schedule's version strategy + # - All matching hosts as targets + # + # The manually triggered deployment is independent of the schedule and does not + # affect the schedule's normal recurrence pattern. + # + # @param id [String] The unique identifier of the schedule to trigger. + # @param opts [Hash] the optional parameters + # @return [Array<(FleetDeploymentResponse, Integer, Hash)>] FleetDeploymentResponse data, response status code and response headers + def trigger_fleet_schedule_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.trigger_fleet_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.trigger_fleet_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.trigger_fleet_schedule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.trigger_fleet_schedule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling FleetAutomationAPI.trigger_fleet_schedule" + end + # resource path + local_var_path = '/api/unstable/fleet/schedules/{id}/trigger'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FleetDeploymentResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :trigger_fleet_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#trigger_fleet_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a schedule. + # + # @see #update_fleet_schedule_with_http_info + def update_fleet_schedule(id, body, opts = {}) + data, _status_code, _headers = update_fleet_schedule_with_http_info(id, body, opts) + data + end + + # Update a schedule. + # + # Partially update a schedule by providing only the fields you want to change. + # + # This endpoint allows you to modify specific attributes of a schedule without + # affecting other fields. Common use cases include: + # - Changing the schedule status between active and inactive + # - Updating the maintenance window times + # - Modifying the filter query to target different hosts + # - Adjusting the version strategy + # + # Only include the fields you want to update in the request body. All fields + # are optional in a PATCH request. + # + # @param id [String] The unique identifier of the schedule to update. + # @param body [FleetSchedulePatchRequest] Request payload containing the fields to update. + # @param opts [Hash] the optional parameters + # @return [Array<(FleetScheduleResponse, Integer, Hash)>] FleetScheduleResponse data, response status code and response headers + def update_fleet_schedule_with_http_info(id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_fleet_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_fleet_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_fleet_schedule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FleetAutomationAPI.update_fleet_schedule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling FleetAutomationAPI.update_fleet_schedule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FleetAutomationAPI.update_fleet_schedule" + end + # resource path + local_var_path = '/api/unstable/fleet/schedules/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'FleetScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_fleet_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FleetAutomationAPI#update_fleet_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/fleet_agent_version.rb b/lib/datadog_api_client/v2/models/fleet_agent_version.rb new file mode 100644 index 00000000000..7fa0a96471d --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_agent_version.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Represents an available Datadog Agent version. + class FleetAgentVersion + include BaseGenericModel + + # + attr_accessor :attributes + + # Unique identifier for the Agent version (same as version). + attr_reader :id + + # The type of Agent version resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FleetAgentVersionAttributes', + :'id' => :'String', + :'type' => :'FleetAgentVersionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetAgentVersion` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_agent_version_attributes.rb b/lib/datadog_api_client/v2/models/fleet_agent_version_attributes.rb new file mode 100644 index 00000000000..f37fbb64201 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_agent_version_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # + class FleetAgentVersionAttributes + include BaseGenericModel + + # The Agent version string. + attr_accessor :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'version' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetAgentVersionAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_agent_version_resource_type.rb b/lib/datadog_api_client/v2/models/fleet_agent_version_resource_type.rb new file mode 100644 index 00000000000..fdf34b5b22e --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_agent_version_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of Agent version resource. + class FleetAgentVersionResourceType + include BaseEnumModel + + AGENT_VERSION = "agent_version".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_agent_versions_response.rb b/lib/datadog_api_client/v2/models/fleet_agent_versions_response.rb new file mode 100644 index 00000000000..6080758af45 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_agent_versions_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of available Agent versions. + class FleetAgentVersionsResponse + include BaseGenericModel + + # Array of available Agent versions. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetAgentVersionsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_attributes.rb b/lib/datadog_api_client/v2/models/fleet_deployment_attributes.rb index 205cf6fa108..99647641b52 100644 --- a/lib/datadog_api_client/v2/models/fleet_deployment_attributes.rb +++ b/lib/datadog_api_client/v2/models/fleet_deployment_attributes.rb @@ -30,9 +30,18 @@ class FleetDeploymentAttributes # Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. attr_accessor :filter_query - # Current high-level status of the deployment (for example, "pending", "running", "completed", "failed"). + # Current high-level status of the deployment (for example, "pending", "running", + # "completed", "failed"). attr_accessor :high_level_status + # Paginated list of hosts in this deployment with their individual statuses. Only included + # when fetching a single deployment by ID. Use the `limit` and `page` query parameters to + # navigate through pages. Pagination metadata is included in the response `meta.hosts` field. + attr_accessor :hosts + + # List of packages to deploy to target hosts. Present only for package upgrade deployments. + attr_accessor :packages + # Total number of hosts targeted by this deployment. attr_accessor :total_hosts @@ -46,6 +55,8 @@ def self.attribute_map :'estimated_end_time_unix' => :'estimated_end_time_unix', :'filter_query' => :'filter_query', :'high_level_status' => :'high_level_status', + :'hosts' => :'hosts', + :'packages' => :'packages', :'total_hosts' => :'total_hosts' } end @@ -58,6 +69,8 @@ def self.openapi_types :'estimated_end_time_unix' => :'Integer', :'filter_query' => :'String', :'high_level_status' => :'String', + :'hosts' => :'Array', + :'packages' => :'Array', :'total_hosts' => :'Integer' } end @@ -98,6 +111,18 @@ def initialize(attributes = {}) self.high_level_status = attributes[:'high_level_status'] end + if attributes.key?(:'hosts') + if (value = attributes[:'hosts']).is_a?(Array) + self.hosts = value + end + end + + if attributes.key?(:'packages') + if (value = attributes[:'packages']).is_a?(Array) + self.packages = value + end + end + if attributes.key?(:'total_hosts') self.total_hosts = attributes[:'total_hosts'] end @@ -133,6 +158,8 @@ def ==(o) estimated_end_time_unix == o.estimated_end_time_unix && filter_query == o.filter_query && high_level_status == o.high_level_status && + hosts == o.hosts && + packages == o.packages && total_hosts == o.total_hosts && additional_properties == o.additional_properties end @@ -141,7 +168,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [config_operations, estimated_end_time_unix, filter_query, high_level_status, total_hosts, additional_properties].hash + [config_operations, estimated_end_time_unix, filter_query, high_level_status, hosts, packages, total_hosts, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_configure_create.rb b/lib/datadog_api_client/v2/models/fleet_deployment_configure_create.rb index f761336321b..42c8585db33 100644 --- a/lib/datadog_api_client/v2/models/fleet_deployment_configure_create.rb +++ b/lib/datadog_api_client/v2/models/fleet_deployment_configure_create.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # Data for creating a new deployment. + # Data for creating a new configuration deployment. class FleetDeploymentConfigureCreate include BaseGenericModel diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_configure_create_request.rb b/lib/datadog_api_client/v2/models/fleet_deployment_configure_create_request.rb index 03104480079..1037ed3fbe9 100644 --- a/lib/datadog_api_client/v2/models/fleet_deployment_configure_create_request.rb +++ b/lib/datadog_api_client/v2/models/fleet_deployment_configure_create_request.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # Request payload for creating a new deployment. + # Request payload for creating a new configuration deployment. class FleetDeploymentConfigureCreateRequest include BaseGenericModel - # Data for creating a new deployment. + # Data for creating a new configuration deployment. attr_reader :data attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_host.rb b/lib/datadog_api_client/v2/models/fleet_deployment_host.rb new file mode 100644 index 00000000000..c0e9ecd6af7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_host.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A host that is part of a deployment with its current status. + class FleetDeploymentHost + include BaseGenericModel + + # Error message if the deployment failed on this host. + attr_accessor :error + + # The hostname of the agent. + attr_accessor :hostname + + # Current deployment status for this specific host. + attr_accessor :status + + # List of packages and their versions currently installed on this host. + attr_accessor :versions + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'error' => :'error', + :'hostname' => :'hostname', + :'status' => :'status', + :'versions' => :'versions' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'error' => :'String', + :'hostname' => :'String', + :'status' => :'String', + :'versions' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentHost` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'hostname') + self.hostname = attributes[:'hostname'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'versions') + if (value = attributes[:'versions']).is_a?(Array) + self.versions = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + hostname == o.hostname && + status == o.status && + versions == o.versions && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [error, hostname, status, versions, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_host_package.rb b/lib/datadog_api_client/v2/models/fleet_deployment_host_package.rb new file mode 100644 index 00000000000..b405804f4ce --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_host_package.rb @@ -0,0 +1,136 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Package version information for a host, showing the initial version before deployment, + # the target version to deploy, and the current version on the host. + class FleetDeploymentHostPackage + include BaseGenericModel + + # The current version of the package on the host. + attr_accessor :current_version + + # The initial version of the package on the host before the deployment started. + attr_accessor :initial_version + + # The name of the package. + attr_accessor :package_name + + # The target version that the deployment is attempting to install. + attr_accessor :target_version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'current_version' => :'current_version', + :'initial_version' => :'initial_version', + :'package_name' => :'package_name', + :'target_version' => :'target_version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'current_version' => :'String', + :'initial_version' => :'String', + :'package_name' => :'String', + :'target_version' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentHostPackage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'current_version') + self.current_version = attributes[:'current_version'] + end + + if attributes.key?(:'initial_version') + self.initial_version = attributes[:'initial_version'] + end + + if attributes.key?(:'package_name') + self.package_name = attributes[:'package_name'] + end + + if attributes.key?(:'target_version') + self.target_version = attributes[:'target_version'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + current_version == o.current_version && + initial_version == o.initial_version && + package_name == o.package_name && + target_version == o.target_version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [current_version, initial_version, package_name, target_version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_hosts_page.rb b/lib/datadog_api_client/v2/models/fleet_deployment_hosts_page.rb new file mode 100644 index 00000000000..04dd65ad01f --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_hosts_page.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Pagination details for the list of hosts in a deployment. + class FleetDeploymentHostsPage + include BaseGenericModel + + # Current page index (zero-based). + attr_accessor :current_page + + # Number of hosts returned per page. + attr_accessor :page_size + + # Total number of hosts in this deployment. + attr_accessor :total_hosts + + # Total number of pages available. + attr_accessor :total_pages + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'current_page' => :'current_page', + :'page_size' => :'page_size', + :'total_hosts' => :'total_hosts', + :'total_pages' => :'total_pages' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'current_page' => :'Integer', + :'page_size' => :'Integer', + :'total_hosts' => :'Integer', + :'total_pages' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentHostsPage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'current_page') + self.current_page = attributes[:'current_page'] + end + + if attributes.key?(:'page_size') + self.page_size = attributes[:'page_size'] + end + + if attributes.key?(:'total_hosts') + self.total_hosts = attributes[:'total_hosts'] + end + + if attributes.key?(:'total_pages') + self.total_pages = attributes[:'total_pages'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + current_page == o.current_page && + page_size == o.page_size && + total_hosts == o.total_hosts && + total_pages == o.total_pages && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [current_page, page_size, total_hosts, total_pages, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_operation.rb b/lib/datadog_api_client/v2/models/fleet_deployment_operation.rb index 415753c1784..ada2ec843c0 100644 --- a/lib/datadog_api_client/v2/models/fleet_deployment_operation.rb +++ b/lib/datadog_api_client/v2/models/fleet_deployment_operation.rb @@ -33,8 +33,8 @@ class FleetDeploymentOperation # Patch data in JSON format to apply to the configuration file. # When using `merge-patch`, this object is merged with the existing configuration, # allowing you to add, update, or override specific fields without replacing the entire file. - # The structure must match the target configuration file format (for example, YAML structure for Datadog Agent config). - # Not applicable when using the `delete` operation. + # The structure must match the target configuration file format (for example, YAML structure + # for Datadog Agent config). Not applicable when using the `delete` operation. attr_accessor :patch attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_package.rb b/lib/datadog_api_client/v2/models/fleet_deployment_package.rb new file mode 100644 index 00000000000..55596007eaf --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_package.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A package and its target version for deployment. + class FleetDeploymentPackage + include BaseGenericModel + + # The name of the package to deploy. + attr_reader :name + + # The target version of the package to deploy. + attr_reader :version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'version' => :'version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'version' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentPackage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @version.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param version [Object] Object to be assigned + # @!visibility private + def version=(version) + if version.nil? + fail ArgumentError, 'invalid value for "version", version cannot be nil.' + end + @version = version + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + version == o.version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_attributes.rb b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_attributes.rb new file mode 100644 index 00000000000..1f23d70d228 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_attributes.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a new package upgrade deployment. + class FleetDeploymentPackageUpgradeAttributes + include BaseGenericModel + + # Query used to filter and select target hosts for the deployment. Uses the Datadog query syntax. + attr_accessor :filter_query + + # List of packages and their target versions to deploy to the selected hosts. + attr_reader :target_packages + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filter_query' => :'filter_query', + :'target_packages' => :'target_packages' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filter_query' => :'String', + :'target_packages' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentPackageUpgradeAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'filter_query') + self.filter_query = attributes[:'filter_query'] + end + + if attributes.key?(:'target_packages') + if (value = attributes[:'target_packages']).is_a?(Array) + self.target_packages = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @target_packages.nil? + true + end + + # Custom attribute writer method with validation + # @param target_packages [Object] Object to be assigned + # @!visibility private + def target_packages=(target_packages) + if target_packages.nil? + fail ArgumentError, 'invalid value for "target_packages", target_packages cannot be nil.' + end + @target_packages = target_packages + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filter_query == o.filter_query && + target_packages == o.target_packages && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filter_query, target_packages, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create.rb b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create.rb new file mode 100644 index 00000000000..313caa32d61 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating a new package upgrade deployment. + class FleetDeploymentPackageUpgradeCreate + include BaseGenericModel + + # Attributes for creating a new package upgrade deployment. + attr_reader :attributes + + # The type of deployment resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FleetDeploymentPackageUpgradeAttributes', + :'type' => :'FleetDeploymentResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentPackageUpgradeCreate` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create_request.rb b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create_request.rb new file mode 100644 index 00000000000..e341ea9513b --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_package_upgrade_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for creating a new package upgrade deployment. + class FleetDeploymentPackageUpgradeCreateRequest + include BaseGenericModel + + # Data for creating a new package upgrade deployment. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FleetDeploymentPackageUpgradeCreate' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentPackageUpgradeCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_response.rb b/lib/datadog_api_client/v2/models/fleet_deployment_response.rb index b055ced273f..075d41392f0 100644 --- a/lib/datadog_api_client/v2/models/fleet_deployment_response.rb +++ b/lib/datadog_api_client/v2/models/fleet_deployment_response.rb @@ -24,13 +24,17 @@ class FleetDeploymentResponse # A deployment that defines automated configuration changes for a fleet of hosts. attr_accessor :data + # Metadata for a single deployment response, including pagination information for hosts. + attr_accessor :meta + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { - :'data' => :'data' + :'data' => :'data', + :'meta' => :'meta' } end @@ -38,7 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'FleetDeployment' + :'data' => :'FleetDeployment', + :'meta' => :'FleetDeploymentResponseMeta' } end @@ -63,6 +68,10 @@ def initialize(attributes = {}) if attributes.key?(:'data') self.data = attributes[:'data'] end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end end # Returns the object in the form of hash, with additionalProperties support. @@ -92,6 +101,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && data == o.data && + meta == o.meta && additional_properties == o.additional_properties end @@ -99,7 +109,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [data, additional_properties].hash + [data, meta, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/fleet_deployment_response_meta.rb b/lib/datadog_api_client/v2/models/fleet_deployment_response_meta.rb new file mode 100644 index 00000000000..4fa9964927f --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_deployment_response_meta.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata for a single deployment response, including pagination information for hosts. + class FleetDeploymentResponseMeta + include BaseGenericModel + + # Pagination details for the list of hosts in a deployment. + attr_accessor :hosts + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'hosts' => :'hosts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'hosts' => :'FleetDeploymentHostsPage' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetDeploymentResponseMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'hosts') + self.hosts = attributes[:'hosts'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + hosts == o.hosts && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [hosts, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule.rb b/lib/datadog_api_client/v2/models/fleet_schedule.rb new file mode 100644 index 00000000000..64eca8c3fda --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A schedule that automatically creates deployments based on a recurrence rule. + class FleetSchedule + include BaseGenericModel + + # Attributes of a schedule in the response. + attr_reader :attributes + + # Unique identifier for the schedule. + attr_reader :id + + # The type of schedule resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FleetScheduleAttributes', + :'id' => :'String', + :'type' => :'FleetScheduleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetSchedule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_attributes.rb b/lib/datadog_api_client/v2/models/fleet_schedule_attributes.rb new file mode 100644 index 00000000000..006b21714c3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_attributes.rb @@ -0,0 +1,214 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a schedule in the response. + class FleetScheduleAttributes + include BaseGenericModel + + # Unix timestamp (seconds since epoch) when the schedule was created. + attr_accessor :created_at_unix + + # User handle of the person who created the schedule. + attr_accessor :created_by + + # Human-readable name for the schedule. + attr_accessor :name + + # Query used to filter and select target hosts for scheduled deployments. Uses the Datadog query syntax. + attr_accessor :query + + # Defines the recurrence pattern for the schedule. Specifies when deployments should be + # automatically triggered based on maintenance windows. + attr_accessor :rule + + # The status of the schedule. + # - `active`: The schedule is active and will create deployments according to its recurrence rule. + # - `inactive`: The schedule is inactive and will not create any deployments. + attr_accessor :status + + # Unix timestamp (seconds since epoch) when the schedule was last updated. + attr_accessor :updated_at_unix + + # User handle of the person who last updated the schedule. + attr_accessor :updated_by + + # Number of major versions behind the latest to target for upgrades. + # - 0: Always upgrade to the latest version + # - 1: Upgrade to latest minus 1 major version + # - 2: Upgrade to latest minus 2 major versions + # Maximum value is 2. + attr_reader :version_to_latest + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at_unix' => :'created_at_unix', + :'created_by' => :'created_by', + :'name' => :'name', + :'query' => :'query', + :'rule' => :'rule', + :'status' => :'status', + :'updated_at_unix' => :'updated_at_unix', + :'updated_by' => :'updated_by', + :'version_to_latest' => :'version_to_latest' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at_unix' => :'Integer', + :'created_by' => :'String', + :'name' => :'String', + :'query' => :'String', + :'rule' => :'FleetScheduleRecurrenceRule', + :'status' => :'FleetScheduleStatus', + :'updated_at_unix' => :'Integer', + :'updated_by' => :'String', + :'version_to_latest' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at_unix') + self.created_at_unix = attributes[:'created_at_unix'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'updated_at_unix') + self.updated_at_unix = attributes[:'updated_at_unix'] + end + + if attributes.key?(:'updated_by') + self.updated_by = attributes[:'updated_by'] + end + + if attributes.key?(:'version_to_latest') + self.version_to_latest = attributes[:'version_to_latest'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@version_to_latest.nil? && @version_to_latest > 2 + return false if !@version_to_latest.nil? && @version_to_latest < 0 + true + end + + # Custom attribute writer method with validation + # @param version_to_latest [Object] Object to be assigned + # @!visibility private + def version_to_latest=(version_to_latest) + if !version_to_latest.nil? && version_to_latest > 2 + fail ArgumentError, 'invalid value for "version_to_latest", must be smaller than or equal to 2.' + end + if !version_to_latest.nil? && version_to_latest < 0 + fail ArgumentError, 'invalid value for "version_to_latest", must be greater than or equal to 0.' + end + @version_to_latest = version_to_latest + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at_unix == o.created_at_unix && + created_by == o.created_by && + name == o.name && + query == o.query && + rule == o.rule && + status == o.status && + updated_at_unix == o.updated_at_unix && + updated_by == o.updated_by && + version_to_latest == o.version_to_latest && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at_unix, created_by, name, query, rule, status, updated_at_unix, updated_by, version_to_latest, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_create.rb b/lib/datadog_api_client/v2/models/fleet_schedule_create.rb new file mode 100644 index 00000000000..5642f40a647 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_create.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating a new schedule. + class FleetScheduleCreate + include BaseGenericModel + + # Attributes for creating a new schedule. + attr_reader :attributes + + # The type of schedule resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FleetScheduleCreateAttributes', + :'type' => :'FleetScheduleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleCreate` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_create_attributes.rb b/lib/datadog_api_client/v2/models/fleet_schedule_create_attributes.rb new file mode 100644 index 00000000000..1fd2c7edd1d --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_create_attributes.rb @@ -0,0 +1,207 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a new schedule. + class FleetScheduleCreateAttributes + include BaseGenericModel + + # Human-readable name for the schedule. + attr_reader :name + + # Query used to filter and select target hosts for scheduled deployments. Uses the Datadog query syntax. + attr_reader :query + + # Defines the recurrence pattern for the schedule. Specifies when deployments should be + # automatically triggered based on maintenance windows. + attr_reader :rule + + # The status of the schedule. + # - `active`: The schedule is active and will create deployments according to its recurrence rule. + # - `inactive`: The schedule is inactive and will not create any deployments. + attr_accessor :status + + # Number of major versions behind the latest to target for upgrades. + # - 0: Always upgrade to the latest version (default) + # - 1: Upgrade to latest minus 1 major version + # - 2: Upgrade to latest minus 2 major versions + # Maximum value is 2. + attr_reader :version_to_latest + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'query' => :'query', + :'rule' => :'rule', + :'status' => :'status', + :'version_to_latest' => :'version_to_latest' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'query' => :'String', + :'rule' => :'FleetScheduleRecurrenceRule', + :'status' => :'FleetScheduleStatus', + :'version_to_latest' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'version_to_latest') + self.version_to_latest = attributes[:'version_to_latest'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @query.nil? + return false if @rule.nil? + return false if !@version_to_latest.nil? && @version_to_latest > 2 + return false if !@version_to_latest.nil? && @version_to_latest < 0 + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param query [Object] Object to be assigned + # @!visibility private + def query=(query) + if query.nil? + fail ArgumentError, 'invalid value for "query", query cannot be nil.' + end + @query = query + end + + # Custom attribute writer method with validation + # @param rule [Object] Object to be assigned + # @!visibility private + def rule=(rule) + if rule.nil? + fail ArgumentError, 'invalid value for "rule", rule cannot be nil.' + end + @rule = rule + end + + # Custom attribute writer method with validation + # @param version_to_latest [Object] Object to be assigned + # @!visibility private + def version_to_latest=(version_to_latest) + if !version_to_latest.nil? && version_to_latest > 2 + fail ArgumentError, 'invalid value for "version_to_latest", must be smaller than or equal to 2.' + end + if !version_to_latest.nil? && version_to_latest < 0 + fail ArgumentError, 'invalid value for "version_to_latest", must be greater than or equal to 0.' + end + @version_to_latest = version_to_latest + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + query == o.query && + rule == o.rule && + status == o.status && + version_to_latest == o.version_to_latest && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, query, rule, status, version_to_latest, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_create_request.rb b/lib/datadog_api_client/v2/models/fleet_schedule_create_request.rb new file mode 100644 index 00000000000..1d84fa497ea --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for creating a new schedule. + class FleetScheduleCreateRequest + include BaseGenericModel + + # Data for creating a new schedule. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FleetScheduleCreate' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_patch.rb b/lib/datadog_api_client/v2/models/fleet_schedule_patch.rb new file mode 100644 index 00000000000..5bde20a75b5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_patch.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for partially updating a schedule. + class FleetSchedulePatch + include BaseGenericModel + + # Attributes for partially updating a schedule. All fields are optional. + attr_accessor :attributes + + # The type of schedule resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'FleetSchedulePatchAttributes', + :'type' => :'FleetScheduleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetSchedulePatch` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_patch_attributes.rb b/lib/datadog_api_client/v2/models/fleet_schedule_patch_attributes.rb new file mode 100644 index 00000000000..6f14c36b871 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_patch_attributes.rb @@ -0,0 +1,174 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for partially updating a schedule. All fields are optional. + class FleetSchedulePatchAttributes + include BaseGenericModel + + # Human-readable name for the schedule. + attr_accessor :name + + # Query used to filter and select target hosts for scheduled deployments. Uses the Datadog query syntax. + attr_accessor :query + + # Defines the recurrence pattern for the schedule. Specifies when deployments should be + # automatically triggered based on maintenance windows. + attr_accessor :rule + + # The status of the schedule. + # - `active`: The schedule is active and will create deployments according to its recurrence rule. + # - `inactive`: The schedule is inactive and will not create any deployments. + attr_accessor :status + + # Number of major versions behind the latest to target for upgrades. + # - 0: Always upgrade to the latest version + # - 1: Upgrade to latest minus 1 major version + # - 2: Upgrade to latest minus 2 major versions + # Maximum value is 2. + attr_reader :version_to_latest + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'query' => :'query', + :'rule' => :'rule', + :'status' => :'status', + :'version_to_latest' => :'version_to_latest' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'query' => :'String', + :'rule' => :'FleetScheduleRecurrenceRule', + :'status' => :'FleetScheduleStatus', + :'version_to_latest' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetSchedulePatchAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'query') + self.query = attributes[:'query'] + end + + if attributes.key?(:'rule') + self.rule = attributes[:'rule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'version_to_latest') + self.version_to_latest = attributes[:'version_to_latest'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@version_to_latest.nil? && @version_to_latest > 2 + return false if !@version_to_latest.nil? && @version_to_latest < 0 + true + end + + # Custom attribute writer method with validation + # @param version_to_latest [Object] Object to be assigned + # @!visibility private + def version_to_latest=(version_to_latest) + if !version_to_latest.nil? && version_to_latest > 2 + fail ArgumentError, 'invalid value for "version_to_latest", must be smaller than or equal to 2.' + end + if !version_to_latest.nil? && version_to_latest < 0 + fail ArgumentError, 'invalid value for "version_to_latest", must be greater than or equal to 0.' + end + @version_to_latest = version_to_latest + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + query == o.query && + rule == o.rule && + status == o.status && + version_to_latest == o.version_to_latest && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, query, rule, status, version_to_latest, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_patch_request.rb b/lib/datadog_api_client/v2/models/fleet_schedule_patch_request.rb new file mode 100644 index 00000000000..b4dfcce63eb --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_patch_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request payload for partially updating a schedule. + class FleetSchedulePatchRequest + include BaseGenericModel + + # Data for partially updating a schedule. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FleetSchedulePatch' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetSchedulePatchRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_recurrence_rule.rb b/lib/datadog_api_client/v2/models/fleet_schedule_recurrence_rule.rb new file mode 100644 index 00000000000..2f7aa10fa32 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_recurrence_rule.rb @@ -0,0 +1,191 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Defines the recurrence pattern for the schedule. Specifies when deployments should be + # automatically triggered based on maintenance windows. + class FleetScheduleRecurrenceRule + include BaseGenericModel + + # List of days of the week when the schedule should trigger. Valid values are: + # "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun". + attr_reader :days_of_week + + # Duration of the maintenance window in minutes. + attr_reader :maintenance_window_duration + + # Start time of the maintenance window in 24-hour clock format (HH:MM). + # Deployments will be triggered at this time on the specified days. + attr_reader :start_maintenance_window + + # Timezone for the schedule in IANA Time Zone Database format (e.g., "America/New_York", "UTC"). + attr_reader :timezone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'days_of_week' => :'days_of_week', + :'maintenance_window_duration' => :'maintenance_window_duration', + :'start_maintenance_window' => :'start_maintenance_window', + :'timezone' => :'timezone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'days_of_week' => :'Array', + :'maintenance_window_duration' => :'Integer', + :'start_maintenance_window' => :'String', + :'timezone' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleRecurrenceRule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'days_of_week') + if (value = attributes[:'days_of_week']).is_a?(Array) + self.days_of_week = value + end + end + + if attributes.key?(:'maintenance_window_duration') + self.maintenance_window_duration = attributes[:'maintenance_window_duration'] + end + + if attributes.key?(:'start_maintenance_window') + self.start_maintenance_window = attributes[:'start_maintenance_window'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @days_of_week.nil? + return false if @maintenance_window_duration.nil? + return false if @start_maintenance_window.nil? + return false if @timezone.nil? + true + end + + # Custom attribute writer method with validation + # @param days_of_week [Object] Object to be assigned + # @!visibility private + def days_of_week=(days_of_week) + if days_of_week.nil? + fail ArgumentError, 'invalid value for "days_of_week", days_of_week cannot be nil.' + end + @days_of_week = days_of_week + end + + # Custom attribute writer method with validation + # @param maintenance_window_duration [Object] Object to be assigned + # @!visibility private + def maintenance_window_duration=(maintenance_window_duration) + if maintenance_window_duration.nil? + fail ArgumentError, 'invalid value for "maintenance_window_duration", maintenance_window_duration cannot be nil.' + end + @maintenance_window_duration = maintenance_window_duration + end + + # Custom attribute writer method with validation + # @param start_maintenance_window [Object] Object to be assigned + # @!visibility private + def start_maintenance_window=(start_maintenance_window) + if start_maintenance_window.nil? + fail ArgumentError, 'invalid value for "start_maintenance_window", start_maintenance_window cannot be nil.' + end + @start_maintenance_window = start_maintenance_window + end + + # Custom attribute writer method with validation + # @param timezone [Object] Object to be assigned + # @!visibility private + def timezone=(timezone) + if timezone.nil? + fail ArgumentError, 'invalid value for "timezone", timezone cannot be nil.' + end + @timezone = timezone + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + days_of_week == o.days_of_week && + maintenance_window_duration == o.maintenance_window_duration && + start_maintenance_window == o.start_maintenance_window && + timezone == o.timezone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [days_of_week, maintenance_window_duration, start_maintenance_window, timezone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_resource_type.rb b/lib/datadog_api_client/v2/models/fleet_schedule_resource_type.rb new file mode 100644 index 00000000000..ffcd66dbee9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of schedule resource. + class FleetScheduleResourceType + include BaseEnumModel + + SCHEDULE = "schedule".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_response.rb b/lib/datadog_api_client/v2/models/fleet_schedule_response.rb new file mode 100644 index 00000000000..8a3d3fc69ae --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single schedule. + class FleetScheduleResponse + include BaseGenericModel + + # A schedule that automatically creates deployments based on a recurrence rule. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'FleetSchedule' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetScheduleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedule_status.rb b/lib/datadog_api_client/v2/models/fleet_schedule_status.rb new file mode 100644 index 00000000000..82d1c725d19 --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedule_status.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status of the schedule. + # - `active`: The schedule is active and will create deployments according to its recurrence rule. + # - `inactive`: The schedule is inactive and will not create any deployments. + class FleetScheduleStatus + include BaseEnumModel + + ACTIVE = "active".freeze + INACTIVE = "inactive".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/fleet_schedules_response.rb b/lib/datadog_api_client/v2/models/fleet_schedules_response.rb new file mode 100644 index 00000000000..e24c9cda83c --- /dev/null +++ b/lib/datadog_api_client/v2/models/fleet_schedules_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of schedules. + class FleetSchedulesResponse + include BaseGenericModel + + # Array of schedules. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::FleetSchedulesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end