Skip to content

Commit 828fba1

Browse files
committed
Rename access_key_id to key in Access Keys API to be consistent with Keen API. Fix parameter name in README
1 parent 61643f9 commit 828fba1

File tree

4 files changed

+106
-106
lines changed

4 files changed

+106
-106
lines changed

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,48 +567,48 @@ The Python client enables the creation and manipulation of `Access Keys <https:/
567567
)
568568
569569
# Create an access key. See: https://keen.io/docs/access/access-keys/#customizing-your-access-key
570-
client.create_access_key(name="Dave_Barry_Key", is_enabled=True, permitted=["writes", "cached_queries"],
570+
client.create_access_key(name="Dave_Barry_Key", is_active=True, permitted=["writes", "cached_queries"],
571571
options={"cached_queries": {"allowed": ["dave_barry_in_cyberspace_sales"]}})
572572
573573
# Display all access keys associated with this client's project.
574574
client.list_access_keys()
575575
576576
# Get details on a particular access key.
577-
client.get_access_key(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
577+
client.get_access_key(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
578578
579579
# Revoke (disable) an access key.
580-
client.revoke_access_key(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
580+
client.revoke_access_key(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
581581
582582
# Unrevoke (re-enable) an access key.
583-
client.unrevoke_access_key(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
583+
client.unrevoke_access_key(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
584584
585585
# Delete an access key
586-
client.delete_access_key(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
586+
client.delete_access_key(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
587587
588588
# Change just the name of an access key.
589-
client.update_access_key_name(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", name="Some_New_Name")
589+
client.update_access_key_name(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", name="Some_New_Name")
590590
591591
# Add new access key permissions to existing permissions on a given key.
592592
# In this case the set of permissions currently contains "writes" and "cached_queries".
593593
# This function call keeps the old permissions and adds "queries" to that set.
594594
# ("writes", "cached_queries") + ("queries") = ("writes", "cached_queries", "queries")
595-
client.add_access_key_permissions(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["queries"])
595+
client.add_access_key_permissions(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["queries"])
596596
597597
# Remove one or more access key permissions from a given key.
598598
# In this case the set of permissions currently contains "writes", "cached_queries", and "queries".
599599
# This function call will keep the old permissions not explicitly removed here.
600600
# So we will remove both "writes" and "queries" from the set, leaving only "cached_queries".
601601
# ("writes", "cached_queries", "queries") - ("writes", "queries") = ("cached_queries")
602-
client.remove_access_key_permissions(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["writes", "queries"])
602+
client.remove_access_key_permissions(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["writes", "queries"])
603603
604604
# We can also perform a full update on the permissions, replacing all existing permissions with a new list.
605605
# In this case our existing permissions contains only "cached_queries".
606606
# We will replace this set with the "writes" permission with this function call.
607607
# ("cached_queries") REPLACE-WITH ("writes") = ("writes")
608-
client.update_access_key_permissions(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["writes"])
608+
client.update_access_key_permissions(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", permissions=["writes"])
609609
610610
# Replace all existing key options with this new options object.
611-
client.update_access_key_options(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", options={"writes": {
611+
client.update_access_key_options(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", options={"writes": {
612612
"autofill": {
613613
"customer": {
614614
"id": "93iskds39kd93id",
@@ -620,7 +620,7 @@ The Python client enables the creation and manipulation of `Access Keys <https:/
620620
# Replace everything but the key ID with what is supplied here.
621621
# If a field is not supplied here, it will be set to a blank value.
622622
# In this case, no options are supplied, so all options will be removed.
623-
client.update_access_key_full(access_key_id="ABCDEFGHIJKLMNOPQRSTUVWXYZ", name="Strong_Bad", is_active=True, permitted=["queries"])
623+
client.update_access_key_full(key="ABCDEFGHIJKLMNOPQRSTUVWXYZ", name="Strong_Bad", is_active=True, permitted=["queries"])
624624
625625
626626
Create Scoped Keys (**Deprecated**)

keen/__init__.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -519,112 +519,112 @@ def list_access_keys():
519519
_initialize_client_from_environment()
520520
return _client.list_access_keys()
521521

522-
def get_access_key(access_key_id):
522+
def get_access_key(key):
523523
"""
524524
Returns details on a particular access key. A master key must be set first.
525525
526-
:param access_key_id: the 'key' value of the access key to retreive data from
526+
:param key: the 'key' value of the access key to retreive data from
527527
"""
528528
_initialize_client_from_environment()
529-
return _client.get_access_key(access_key_id)
529+
return _client.get_access_key(key)
530530

531-
def update_access_key_name(access_key_id, name):
531+
def update_access_key_name(key, name):
532532
"""
533533
Updates only the name portion of an access key.
534534
535-
:param access_key_id: the 'key' value of the access key to change the name of
535+
:param key: the 'key' value of the access key to change the name of
536536
:param name: the new name to give this access key
537537
"""
538538
_initialize_client_from_environment()
539-
return _client.update_access_key_name(access_key_id, name)
539+
return _client.update_access_key_name(key, name)
540540

541-
def add_access_key_permissions(access_key_id, permissions):
541+
def add_access_key_permissions(key, permissions):
542542
"""
543543
Adds to the existing list of permissions on this key with the contents of this list.
544544
Will not remove any existing permissions or modify the remainder of the key.
545545
546-
:param access_key_id: the 'key' value of the access key to add permissions to
546+
:param key: the 'key' value of the access key to add permissions to
547547
:param permissions: the new permissions to add to the existing list of permissions
548548
"""
549549
_initialize_client_from_environment()
550-
return _client.add_access_key_permissions(access_key_id, permissions)
550+
return _client.add_access_key_permissions(key, permissions)
551551

552-
def remove_access_key_permissions(access_key_id, permissions):
552+
def remove_access_key_permissions(key, permissions):
553553
"""
554554
Removes a list of permissions from the existing list of permissions.
555555
Will not remove all existing permissions unless all such permissions are included
556556
in this list. Not to be confused with key revocation.
557557
558558
See also: revoke_access_key()
559559
560-
:param access_key_id: the 'key' value of the access key to remove some permissions from
560+
:param key: the 'key' value of the access key to remove some permissions from
561561
:param permissions: the permissions you wish to remove from this access key
562562
"""
563563
_initialize_client_from_environment()
564-
return _client.remove_access_key_permissions(access_key_id, permissions)
564+
return _client.remove_access_key_permissions(key, permissions)
565565

566-
def update_access_key_permissions(access_key_id, permissions):
566+
def update_access_key_permissions(key, permissions):
567567
"""
568568
Replaces all of the permissions on the access key but does not change
569569
non-permission properties such as the key's name.
570570
571571
See also: add_access_key_permissions() and remove_access_key_permissions().
572572
573-
:param access_key_id: the 'key' value of the access key to change the permissions of
573+
:param key: the 'key' value of the access key to change the permissions of
574574
:param permissions: the new list of permissions for this key
575575
"""
576576
_initialize_client_from_environment()
577-
return _client.update_access_key_permissions(access_key_id, permissions)
577+
return _client.update_access_key_permissions(key, permissions)
578578

579-
def update_access_key_options(access_key_id, options):
579+
def update_access_key_options(key, options):
580580
"""
581581
Replaces all of the options on the access key but does not change
582582
non-option properties such as permissions or the key's name.
583583
584-
:param access_key_id: the 'key' value of the access key to change the options of
584+
:param key: the 'key' value of the access key to change the options of
585585
:param options: the new dictionary of options for this key
586586
"""
587587
_initialize_client_from_environment()
588-
return _client.update_access_key_options(access_key_id, options)
588+
return _client.update_access_key_options(key, options)
589589

590-
def update_access_key_full(access_key_id, name, is_active, permitted, options):
590+
def update_access_key_full(key, name, is_active, permitted, options):
591591
"""
592592
Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key.
593593
A master key must be set first.
594594
595-
:param access_key_id: the 'key' value of the access key for which the values will be replaced
595+
:param key: the 'key' value of the access key for which the values will be replaced
596596
:param name: the new name desired for this access key
597597
:param is_active: whether the key should become enabled (True) or revoked (False)
598598
:param permitted: the new list of permissions desired for this access key
599599
:param options: the new dictionary of options for this access key
600600
"""
601601
_initialize_client_from_environment()
602-
return _client.update_access_key_full(access_key_id, name, is_active, permitted, options)
602+
return _client.update_access_key_full(key, name, is_active, permitted, options)
603603

604-
def revoke_access_key(access_key_id):
604+
def revoke_access_key(key):
605605
"""
606606
Revokes an access key. "Bad dog! No biscuit!"
607607
608-
:param access_key_id: the 'key' value of the access key to revoke
608+
:param key: the 'key' value of the access key to revoke
609609
"""
610610
_initialize_client_from_environment()
611-
return _client.revoke_access_key(access_key_id)
611+
return _client.revoke_access_key(key)
612612

613-
def unrevoke_access_key(access_key_id):
613+
def unrevoke_access_key(key):
614614
"""
615615
Re-enables an access key.
616616
617-
:param access_key_id: the 'key' value of the access key to re-enable (unrevoke)
617+
:param key: the 'key' value of the access key to re-enable (unrevoke)
618618
"""
619619
_initialize_client_from_environment()
620-
return _client.unrevoke_access_key(access_key_id)
620+
return _client.unrevoke_access_key(key)
621621

622622

623-
def delete_access_key(access_key_id):
623+
def delete_access_key(key):
624624
"""
625625
Deletes an access key.
626626
627-
:param access_key_id: the 'key' value of the access key to delete
627+
:param key: the 'key' value of the access key to delete
628628
"""
629629
_initialize_client_from_environment()
630-
return _client.delete_access_key(access_key_id)
630+
return _client.delete_access_key(key)

0 commit comments

Comments
 (0)