Skip to content

Instantly share code, notes, and snippets.

View gist:db9310ddd6ddb46fa3a9a046af118090
2020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: [DEBUG] AzureRM Request:
2020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: PUT /subscriptions/XXXXXXXX-0871-4889-9045-d554e72e0ef0/resourceGroups/smud-dev/providers/Microsoft.Web/sites/appwiflofbm?api-version=2019-08-01 HTTP/1.1
2020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: Host: management.azure.com
2020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: User-Agent: Go/go1.12.6 (amd64-windows) go-autorest/v13.3.0 Azure-SDK-For-Go/v38.1.0 web/2019-08-01 HashiCorp Terraform/0.12.24 (+https://www.terraform.io) Terraform Plugin SDK/1.6.0 terraform-provider-azurerm/2.2.0 pid-222c6c49-1b0a-5959-a213-6608f9eb88202020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: Content-Length: 1413
2020-03-25T11:21:10.221-0700 [DEBUG] plugin.terraform-provider-azurerm_v2.2.0_x5.exe: Content-Typ
View demo-python-journey.md

What I'm trying to do

Write a python program (Python 3.8.2, Visual Studio Code insiders + insiders plugin, Windows 10) to upload a python file to a new storage blob, then set up distributed tracing and logging.

Starting application

This should be fairly basic.

  • pip install --pre azure.identity
View amplify.yml
version: 0.1
frontend:
phases:
preBuild:
commands:
- bundle install
build:
commands:
- if [ "${AWS_BRANCH}" = "master" ]; then bundle exec jekyll b --baseurl /; else bundle exec jekyll b --baseurl / --future; fi
artifacts:
View getLocationForList-request.vtl
#if($ctx.prev.result.ids.size() == 0)
#set($result = {})
$util.qr($result.put("totalCount", $ctx.prev.result.totalCount))
$util.qr($result.put("nextToken",$ctx.prev.result.nextToken))
$util.qr($result.put("items", $ctx.prev.result.ids))
#return($result)
#end
#set($keys = [])
#foreach($id in ${ctx.prev.result.ids})
View getLocationForList-response.vtl
## Raise a GraphQL field error in case of a datasource invocation error
#if($ctx.error)
$util.error($ctx.error.message, $ctx.error.type)
#end
#set($result = {})
$util.qr($result.put("totalCount", $ctx.prev.result.totalCount))
$util.qr($result.put("nextToken",$ctx.prev.result.nextToken))
$util.qr($result.put("items", $ctx.result.data.devRestaurantReviews))
$util.toJson($result)
View getLocationForList.vtl
#set($keys = [])
#foreach($id in ${ctx.prev.result.ids})
#set($key = {})
$util.qr($key.put("typeName", $util.dynamodb.toString("LOCATION")))
$util.qr($key.put("id", $util.dynamodb.toString($id)))
$util.qr($keys.add($key))
#end
{
"version": "2018-05-29",
View UserBlock.tsx
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import * as React from 'react';
import UserBlockComponent from '../components/UserBlock';
const query = gql`
query me {
me { id name }
}
`;
View App.tsx
import gql from 'graphql-tag';
import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync';
import aws_config from './aws-exports';
import App from './src/App';
const client = new AWSAppSyncClient({
url: aws_config.aws_appsync_graphqlEndpoint,
region: aws_config.aws_appsync_region,
auth: {
type: aws_config.aws_appsync_authenticationType,
View App.tsx
const UserBlockFunction = () => {
return (
<Connect query={graphqlOperation('{ me { id name } }')}>
{(response) => {
if (response.loading) {
return (<LoadingIndicator loading={response.loading}/>);
} else if (response.data && response.data.me) {
return (<UserBlock name={response.data.me.name}/>);
} else {
return (<ErrorIndicator errors={response.errors}/>);
View App.tsx
public async componentWillMount() {
try {
const result = await API.graphql(graphqlOperation('{ me { id name } }'));
console.log('componentWillMount: result = ', result);
this.setState({ loading: false, data: result.data.me });
} catch (err) {
this.setState({ loading: false, errors: [ err.message ] });
}
}