-
Notifications
You must be signed in to change notification settings - Fork 5
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 #512 from 3cham/feature/gcp-config
Introduce google cloud config for logsmith
- Loading branch information
Showing
13 changed files
with
193 additions
and
18 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
import logging | ||
|
||
from app.shell import shell | ||
|
||
logger = logging.getLogger('logsmith') | ||
|
||
|
||
def set_default_project(project: str): | ||
logger.info(f'set default project to: {project}') | ||
return shell.run(f"gcloud config set project {project}", timeout=5) | ||
|
||
|
||
def set_default_quota_project(project: str): | ||
logger.info(f'set default quota-project to: {project}') | ||
return shell.run(f"gcloud auth application-default set-quota-project {project}", timeout=5) | ||
|
||
|
||
def set_default_region(region: str): | ||
|
||
logger.info(f'set default region to: {region}') | ||
return shell.run(f"gcloud config set compute/region {region}", timeout=5) | ||
|
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,15 @@ | ||
import logging | ||
|
||
from app.shell import shell | ||
|
||
logger = logging.getLogger('logsmith') | ||
|
||
|
||
def gcloud_auth_login(): | ||
logger.info(f'run gcloud auth login and wait for 60 seconds to complete login flow!') | ||
return shell.run("gcloud auth login", timeout=60) | ||
|
||
|
||
def gcloud_auth_application_login(): | ||
logger.info(f'run gcloud auth application-default login and wait for 60 seconds to complete login flow!') | ||
return shell.run("gcloud auth application-default login", timeout=60) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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