# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines


def sshkey_create(client,
                  resource_group_name,
                  ssh_public_key_name,
                  location,
                  tags=None,
                  public_key=None):
    parameters = {
        'location': location,
        'tags': tags,
        'public_key': public_key
    }
    client.create(resource_group_name=resource_group_name,
                  ssh_public_key_name=ssh_public_key_name,
                  parameters=parameters)
    if public_key is None:  # Generate one if public key is None
        client.generate_key_pair(resource_group_name=resource_group_name,
                                 ssh_public_key_name=ssh_public_key_name)
    return client.get(resource_group_name=resource_group_name,
                      ssh_public_key_name=ssh_public_key_name)
