-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GET and DELETE method for managing api_key (#3410)
Add GET and DELETE methods to support API Key management --------- Co-authored-by: siddardh <sira@redhat27!>
- Loading branch information
1 parent
ddc3a81
commit 9509d23
Showing
11 changed files
with
521 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
lib/pbench/server/database/alembic/versions/1a91bc68d6de_update_api_key.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Update api_key table with "id" as primary_key | ||
Revision ID: 1a91bc68d6de | ||
Revises: 5679217a62bb | ||
Create Date: 2023-05-03 09:50:29.609672 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1a91bc68d6de" | ||
down_revision = "5679217a62bb" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.drop_constraint("api_keys_pkey", "api_keys", type_="primary") | ||
op.execute("ALTER TABLE api_keys ADD COLUMN id SERIAL PRIMARY KEY") | ||
op.add_column("api_keys", sa.Column("label", sa.String(length=128), nullable=True)) | ||
op.add_column("api_keys", sa.Column("key", sa.String(length=500), nullable=False)) | ||
op.create_unique_constraint("api_keys_key_unique", "api_keys", ["key"]) | ||
op.drop_column("api_keys", "api_key") | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_constraint("api_keys_pkey", "api_keys", type_="primary") | ||
op.drop_column("api_keys", "label") | ||
op.drop_column("api_keys", "id") | ||
op.drop_column("api_keys", "key") | ||
op.create_primary_key("api_keys_pkey", "api_keys", ["api_key"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.