From 3353ca48a69e52a2626a3b7715332b1477056c7f 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 | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/nailgun/entities.py b/nailgun/entities.py index 188f2531..0073a262 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -9172,3 +9172,37 @@ def __init__(self, server_config=None, **kwargs): 'read_type': 'base', } super().__init__(server_config=server_config, **kwargs) + + +class AnsibleVariable(Entity, EntityCreateMixin, EntityReadMixin, EntityDeleteMixin): + """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)