-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add opt-in integration resource provision service
- Loading branch information
Showing
5 changed files
with
71 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List | ||
import httpx | ||
from loguru import logger | ||
from port_ocean.clients.port.authentication import PortAuthentication | ||
from port_ocean.clients.port.utils import handle_status_code | ||
|
||
|
||
class OrganizationClientMixin: | ||
def __init__( | ||
self, | ||
auth: PortAuthentication, | ||
client: httpx.AsyncClient, | ||
): | ||
self.auth = auth | ||
self.client = client | ||
|
||
async def _get_organization_feature_toggles(self) -> httpx.Response: | ||
logger.info("Fetching organization feature toggles") | ||
|
||
response = await self.client.get( | ||
f"{self.auth.api_url}/organization", | ||
headers=await self.auth.headers(), | ||
) | ||
return response | ||
|
||
async def get_organization_feature_toggles( | ||
self, should_raise: bool = True, should_log: bool = True | ||
) -> List[str]: | ||
response = await self._get_organization_feature_toggles() | ||
handle_status_code(response, should_raise, should_log) | ||
return response.json().get("organization", {}).get("featureFlags", []) |
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