From bec86cb8edc74cee0e892ea0061fa99c7463cdc7 Mon Sep 17 00:00:00 2001 From: dosas Date: Thu, 22 Aug 2024 13:58:17 +0200 Subject: [PATCH] Add AnsibleVariable to entities --- nailgun/entities.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/nailgun/entities.py b/nailgun/entities.py index 3f29b28f..bd55e1d3 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -9213,3 +9213,44 @@ def __init__(self, server_config=None, **kwargs): 'read_type': 'base', } super().__init__(server_config=server_config, **kwargs) + + +class AnsibleVariable( + Entity, + EntityCreateMixin, + EntityReadMixin, + EntityDeleteMixin, + EntitySearchMixin, + EntityUpdateMixin, +): + """A representation of a Ansible Variable entity.""" + + def __init__(self, server_config=None, **kwargs): + self._fields = { + 'variable': entity_fields.StringField(required=True), + 'ansible_role_id': entity_fields.IntegerField(required=True), + 'default_value': entity_fields.StringField(), + 'override_value_order': entity_fields.StringField(), + 'description': entity_fields.StringField(), + 'validator_type': entity_fields.ListField(), + 'validator_rule': entity_fields.StringField(), + 'variable_type': entity_fields.StringField( + default='string', + choices=( + 'string', + 'boolean', + 'integer', + 'real', + 'array', + 'hash', + 'yaml', + 'json', + ), + ), + 'merge_overrides': entity_fields.BooleanField(), + 'merge_default': entity_fields.BooleanField(), + 'avoid_duplicates': entity_fields.BooleanField(), + 'override': entity_fields.BooleanField(), + } + self._meta = {'api_path': 'ansible/api/ansible_variables'} + super().__init__(server_config=server_config, **kwargs)