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
- uses: ricardochaves/python-lint@test | |
with: | |
python-root-list: 'python_alelo tests' | |
use-pylint: false | |
use-pycodestyle: false | |
use-flake8: false | |
use-black: false | |
use-mypy: false | |
use-isort: false |
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
name: Python Lint | |
on: [pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: |
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
name: Python application | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: |
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
imports: | |
- path: setup-k8s.py | |
- path: setup-ip.py | |
- path: setup-sql.py | |
resources: | |
- name: cluster | |
type: setup-k8s.py | |
properties: | |
CLUSTER_NAME: cluster-1 |
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
def GenerateConfig(context): | |
"""Generate YAML resource configuration.""" | |
ip_name = context.properties["IP_NAME"] | |
region = context.properties["REGION"] | |
resources = [] | |
resources.append( | |
{ | |
"name": ip_name, |
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
import uuid | |
def GenerateConfig(context): | |
"""Generate YAML resource configuration.""" | |
sql_zone = context.properties["SQL_ZONE"] | |
sql_name = str(uuid.uuid4().hex) | |
db_name = context.properties["DB_NAME"] | |
user_name = context.properties["USER_NAME"] |
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
def GenerateConfig(context): | |
"""Generate YAML resource configuration.""" | |
cluster_name = context.properties["CLUSTER_NAME"] | |
cluster_zone = context.properties["CLUSTER_ZONE"] | |
number_of_nodes = context.properties["NUM_NODES"] | |
resources = [] | |
resources.append( | |
{ |
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
@app.route("/privateurl") | |
def privateurl(): | |
if "access_token" not in flask.session: | |
return flask.redirect(flask.url_for("login")) | |
token = flask.session.get("access_token") | |
logging.info(f"Token: {token}") | |
return jsonify({"token": token}) |
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
@app.route("/getAToken") | |
def main_logic(): | |
code = flask.request.args["code"] | |
state = flask.request.args["state"] | |
if state != flask.session["state"]: | |
raise ValueError("State does not match") | |
auth_context = adal.AuthenticationContext(AUTHORITY_URL) | |
token_response = auth_context.acquire_token_with_authorization_code( | |
code, REDIRECT_URI, config.RESOURCE, config.CLIENT_ID, config.CLIENT_SECRET | |
) |
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
@app.route("/login") | |
def login(): | |
auth_state = str(uuid.uuid4()) | |
flask.session["state"] = auth_state | |
authorization_url = TEMPLATE_AUTHZ_URL.format( | |
config.TENANT, config.CLIENT_ID, REDIRECT_URI, auth_state, config.RESOURCE | |
) | |
resp = flask.Response(status=307) | |
resp.headers["location"] = authorization_url | |
return resp |
NewerOlder