-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from cloudblue/support_ui_extensions
LITE-23828, LITE-23829, LITE-23830
- Loading branch information
Showing
15 changed files
with
791 additions
and
115 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
Empty file.
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,51 @@ | ||
import os | ||
|
||
from fastapi import Depends, Header | ||
|
||
from connect.client import AsyncConnectClient | ||
|
||
|
||
def get_installation_client( | ||
x_connect_installation_api_key: str = Header(), | ||
x_connect_api_gateway_url: str = Header(), | ||
x_connect_user_agent: str = Header(), | ||
): | ||
return AsyncConnectClient( | ||
x_connect_installation_api_key, | ||
endpoint=x_connect_api_gateway_url, | ||
use_specs=False, | ||
default_headers={'User-Agent': x_connect_user_agent}, | ||
) | ||
|
||
|
||
def get_extension_client( | ||
x_connect_api_gateway_url: str = Header(), | ||
x_connect_user_agent: str = Header(), | ||
): | ||
return AsyncConnectClient( | ||
os.getenv('API_KEY'), | ||
endpoint=x_connect_api_gateway_url, | ||
use_specs=False, | ||
default_headers={'User-Agent': x_connect_user_agent}, | ||
) | ||
|
||
|
||
async def get_installation( | ||
client: AsyncConnectClient = Depends(get_installation_client), | ||
x_connect_extension_id: str = Header(), | ||
x_connect_installation_id: str = Header(), | ||
): | ||
extension = client('devops').services[x_connect_extension_id] | ||
return await extension.installations[x_connect_installation_id].get() | ||
|
||
|
||
async def get_environment( | ||
client: AsyncConnectClient = Depends(get_installation_client), | ||
x_connect_extension_id: str = Header(), | ||
x_connect_environment_id: str = Header(), | ||
): | ||
extension = client('devops').services[x_connect_extension_id] | ||
return [ | ||
variable | ||
async for variable in extension.environments[x_connect_environment_id].variables.all() | ||
] |
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,49 @@ | ||
import os | ||
|
||
from fastapi import Depends, Header | ||
|
||
|
||
from connect.client import ConnectClient | ||
|
||
|
||
def get_installation_client( | ||
x_connect_installation_api_key: str = Header(), | ||
x_connect_api_gateway_url: str = Header(), | ||
x_connect_user_agent: str = Header(), | ||
): | ||
return ConnectClient( | ||
x_connect_installation_api_key, | ||
endpoint=x_connect_api_gateway_url, | ||
use_specs=False, | ||
default_headers={'User-Agent': x_connect_user_agent}, | ||
) | ||
|
||
|
||
def get_extension_client( | ||
x_connect_api_gateway_url: str = Header(), | ||
x_connect_user_agent: str = Header(), | ||
): | ||
return ConnectClient( | ||
os.getenv('API_KEY'), | ||
endpoint=x_connect_api_gateway_url, | ||
use_specs=False, | ||
default_headers={'User-Agent': x_connect_user_agent}, | ||
) | ||
|
||
|
||
def get_installation( | ||
client: ConnectClient = Depends(get_installation_client), | ||
x_connect_extension_id: str = Header(), | ||
x_connect_installation_id: str = Header(), | ||
): | ||
extension = client('devops').services[x_connect_extension_id] | ||
return extension.installations[x_connect_installation_id].get() | ||
|
||
|
||
def get_environment( | ||
client: ConnectClient = Depends(get_installation_client), | ||
x_connect_extension_id: str = Header(), | ||
x_connect_environment_id: str = Header(), | ||
): | ||
extension = client('devops').services[x_connect_extension_id] | ||
return list(extension.environments[x_connect_environment_id].variables.all()) |
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.