示例#1
0
def create_integration_account(gql, input, role):
    """
    Creates a New Relic Cloud integration account for the specified AWS IAM role.
    """
    assert isinstance(gql, NewRelicGQL)
    assert isinstance(input, IntegrationInstall)
    role_arn = role["Role"]["Arn"]
    external_id = parse_arn(role_arn)["account"]
    account = gql.get_linked_account_by_external_id(external_id)
    if account:
        success("Cloud integrations account [%s] already exists "
                "in New Relic account [%d] with IAM role [%s]." %
                (account["name"], input.nr_account_id, account["authLabel"]))
        return account
    account = account = gql.link_account(role_arn, input.linked_account_name)
    if account:
        success(
            "Cloud integrations account [%s] was created in New Relic account [%s] "
            "with IAM role [%s]." %
            (input.linked_account_name, input.nr_account_id, role_arn))
        return account
    failure(
        "Could not create Cloud integrations account [%s] in New Relic account [%s] "
        "with role [%s]. This may be due to a previously installed integration. "
        "Please contact New Relic support for assistance." %
        (input.linked_account_name, input.nr_account_id, role_arn))
示例#2
0
def create_integration_account(gql, nr_account_id, linked_account_name, role):
    """
    Creates a New Relic Cloud integration account for the specified AWS IAM role.
    """
    role_arn = role["Role"]["Arn"]
    account = gql.get_linked_account_by_name(linked_account_name)
    if account:
        success(
            "Cloud integrations account [%s] already exists "
            "in New Relic account [%d]." % (account["name"], nr_account_id)
        )
        return account
    account = account = gql.link_account(role_arn, linked_account_name)
    if account:
        success(
            "Cloud integrations account [%s] was created in New Relic account [%s] "
            "with role [%s]." % (linked_account_name, nr_account_id, role_arn)
        )
        return account
    failure(
        "Could not create Cloud integrations account [%s] in New Relic account [%s] "
        "with role [%s]. This may be due to a previously installed integration. "
        "Please contact New Relic support for assistance."
        % (linked_account_name, nr_account_id, role_arn)
    )
示例#3
0
def create_integration_account(gql, nr_account_id, linked_account_name, role):
    """
    Creates a New Relic Cloud integration account for the specified AWS IAM role.
    """
    role_arn = role["Role"]["Arn"]
    account = gql.get_linked_account_by_name(linked_account_name)
    if account is None:
        account = gql.link_account(role_arn, linked_account_name)
        success(
            "Cloud integrations account [%s] was created in New Relic account [%s]"
            "with role [%s]." % (linked_account_name, nr_account_id, role_arn))
    else:
        success("Cloud integrations account [%s] already exists "
                "in New Relic account [%d]." %
                (account["name"], nr_account_id))
    return account