gitlab-deploy-key-present

Description

This is useful

Variables

Name Type Default Description

access_token

string --

The Gitlab access token. Required

gitlab_project

string --

The name of the Gitlab project. Required

gitlab_user

string --

The Gitlab user- or organization name. Required

path_to_key

string --

The path to the ssh key to create. Required

deploy_key_title

string deploy

The title of the deploy key on Gitlab.

key_type

string ed25519

The type of key to create.

user

string --

The (local) user.

Code

doc:
  short_help: Add a deploy key to a Gitlab server.
  help: |
    This is useful

args:
  _import: ssh-key-exists
  user:
    doc:
      short_help: The (local) user.
    type: string
    required: false
  access_token:
    doc:
      short_help: The Gitlab access token.
    type: string
    required: true
    secret: true
  path_to_key:
    doc:
      short_help: The path to the ssh key to create.
    type: string
    required: true
  gitlab_user:
    doc:
      short_help: The Gitlab user- or organization name.
    type: string
    required: true
  gitlab_project:
    doc:
      short_help: The name of the Gitlab project.
    type: string
    required: true
  deploy_key_title:
    doc:
      short_help: The title of the deploy key on Gitlab.
    type: string
    required: false
    default: deploy
frecklets:
- user-exists:
    frecklet::skip: '{{:: user | true_if_empty ::}}'
    name: '{{:: user ::}}'
- ssh-key-exists:
    user: '{{:: user ::}}'
    path: '{{:: path_to_key ::}}'
    key_type: '{{:: key_type ::}}'
- add-gitlab-deploy-key.at.yml:
    frecklet::type: ansible-tasklist
    frecklet::resources:
      ansible-tasklist:
      - add-gitlab-deploy-key.at.yml
      - internally-register-public-ssh-key.at.yml
    __path_to_key__: '{{:: path_to_key ::}}'
    __project_name__: '{{:: gitlab_user ::}}/{{:: gitlab_project ::}}'
    __gitlab_private_access_token__: '{{:: access_token ::}}'
    __deploy_key_title__: '{{:: deploy_key_title ::}}'
    __use_become__: '{{:: user | false_if_empty ::}}'
#      __become_user__: "{{:: user ::}}"
frecklecute gitlab-deploy-key-present --help

Usage: frecklecute gitlab-deploy-key-present [OPTIONS]

  This is useful

Options:
  --access-token ACCESS_TOKEN     The Gitlab access token.  [required]
  --gitlab-project GITLAB_PROJECT
                                  The name of the Gitlab project.  [required]
  --gitlab-user GITLAB_USER       The Gitlab user- or organization name.
                                  [required]
  --path-to-key PATH_TO_KEY       The path to the ssh key to create.
                                  [required]
  --deploy-key-title DEPLOY_KEY_TITLE
                                  The title of the deploy key on Gitlab.
  -t, --key-type KEY_TYPE         The type of key to create.
  --user USER                     The (local) user.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.gitlab_deploy_key_present.GitlabDeployKeyPresent
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class GitlabDeployKeyPresent(AutoPycklet):
    """This is useful

       Args:
         access_token: The Gitlab access token.
         deploy_key_title: The title of the deploy key on Gitlab.
         gitlab_project: The name of the Gitlab project.
         gitlab_user: The Gitlab user- or organization name.
         key_type: The type of key to create.
         path_to_key: The path to the ssh key to create.
         user: The (local) user.

    """

    FRECKLET_ID = "gitlab-deploy-key-present"

    access_token: str = None
    deploy_key_title: str = None
    gitlab_project: str = None
    gitlab_user: str = None
    key_type: str = None
    path_to_key: str = None
    user: str = None


    def __post_init__(self):
        super(GitlabDeployKeyPresent, self).__init__(var_names=["access_token", "deploy_key_title", "gitlab_project", "gitlab_user", "key_type", "path_to_key", "user"])


frecklet_class = GitlabDeployKeyPresent
# -*- coding: utf-8 -*-


#
# module path: pycklets.gitlab_deploy_key_present.GitlabDeployKeyPresent
#


from pyckles import AutoPycklet

class GitlabDeployKeyPresent(AutoPycklet):
    """This is useful

       Args:
         access_token: The Gitlab access token.
         deploy_key_title: The title of the deploy key on Gitlab.
         gitlab_project: The name of the Gitlab project.
         gitlab_user: The Gitlab user- or organization name.
         key_type: The type of key to create.
         path_to_key: The path to the ssh key to create.
         user: The (local) user.

    """

    FRECKLET_ID = "gitlab-deploy-key-present"

    def __init__(self, access_token=None, deploy_key_title="deploy", gitlab_project=None, gitlab_user=None, key_type="ed25519", path_to_key=None, user=None):

        super(GitlabDeployKeyPresent, self).__init__(var_names=["access_token", "deploy_key_title", "gitlab_project", "gitlab_user", "key_type", "path_to_key", "user"])
        self._access_token = access_token
        self._deploy_key_title = deploy_key_title
        self._gitlab_project = gitlab_project
        self._gitlab_user = gitlab_user
        self._key_type = key_type
        self._path_to_key = path_to_key
        self._user = user

    @property
    def access_token(self):
        return self._access_token

    @access_token.setter
    def access_token(self, access_token):
        self._access_token = access_token

    @property
    def deploy_key_title(self):
        return self._deploy_key_title

    @deploy_key_title.setter
    def deploy_key_title(self, deploy_key_title):
        self._deploy_key_title = deploy_key_title

    @property
    def gitlab_project(self):
        return self._gitlab_project

    @gitlab_project.setter
    def gitlab_project(self, gitlab_project):
        self._gitlab_project = gitlab_project

    @property
    def gitlab_user(self):
        return self._gitlab_user

    @gitlab_user.setter
    def gitlab_user(self, gitlab_user):
        self._gitlab_user = gitlab_user

    @property
    def key_type(self):
        return self._key_type

    @key_type.setter
    def key_type(self, key_type):
        self._key_type = key_type

    @property
    def path_to_key(self):
        return self._path_to_key

    @path_to_key.setter
    def path_to_key(self, path_to_key):
        self._path_to_key = path_to_key

    @property
    def user(self):
        return self._user

    @user.setter
    def user(self, user):
        self._user = user



frecklet_class = GitlabDeployKeyPresent