import flow_api

def handler(system: flow_api.System, this: flow_api.Execution):
    vault_config = 'my-vaultconfig'
    secret_path = 'my-git-secret'
    secret_key_user = 'username'
    secret_key_password = 'password'

    my_connector_name = 'git-example-connector'

    # Create connector of type GIT and link it with vault secrets
    system.connector(my_connector_name).save(
        connector_type='GIT',
        value={
            'username': f'vault.secret({secret_key_user})',
            'password': f'vault.secret({secret_key_password})',
        },
        vault_secrets=[{
            'vault_name': vault_config,
            'engine_path': 'kv',
            'secret_path': secret_path,
        }],
    )

    # Use the connector:
    git_metadata = this.connect(
        my_connector_name,
        name='get git-metadata',
        repository_url='https://mygitrepo.com/repo/',
        command='metadata',
    ).get('output_value')
    this.log(git_metadata)

    return this.success('all done')
