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
from __future__ import print_function | |
from datetime import datetime | |
import boto3, os, json | |
def lambda_handler(event, context): | |
print("Received event: " + json.dumps(event, indent=2)) | |
now = datetime.now() | |
s3 = boto3.resource('s3') |
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
# Webhook for Data Cloud Data Action | |
# Create a lambda function to take a request and store it in an S3 bucket | |
# Create the destination S3 bucket | |
# Assign roles and policies | |
# Output the new webhook endpoint | |
terraform { | |
required_version = ">= 1.0.0" | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" |
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
# Creates an S3 bucket | |
# Uploads a CSV data file into the S3 bucket | |
# Create a user with the necessary roles for Data Cloud to access the data | |
# Output the credentials to use in the Data Cloud config | |
# (Note the secret will only be visible by reading the .tfstate file) | |
terraform { | |
required_version = ">= 1.0.0" | |
required_providers { | |
aws = { |
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
/* APEX */ | |
public class AccountCount { | |
@AuraEnabled(cacheable=true) | |
public static Integer getCount() { | |
return [select count() from Account]; | |
} | |
} | |
/* LWC (JS) */ | |
import { LightningElement, wire } from "lwc"; |
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
const crypto = require("crypto"); | |
const algorithm = "aes-256-cbc"; | |
const ENCRYPTION_KEY = Buffer.from( | |
"b7zfYEKhkmVrl9P3yGN/p+3AOkjWK5D6s2JOJzW6lpo=", | |
"base64", | |
); | |
const IV_LENGTH = 16; | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); |
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
/* | |
Apex encryption | |
String clearText = 'A sample message'; | |
String key = 'b7zfYEKhkmVrl9P3yGN/p+3AOkjWK5D6s2JOJzW6lpo='; | |
Blob cipherText = Crypto.encryptWithManagedIV('AES256', EncodingUtil.base64Decode(key), Blob.valueOf(clearText)); | |
String encodedCipherText = EncodingUtil.base64Encode(cipherText); | |
System.debug(key); | |
System.debug(encodedCipherText); | |
*/ |
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
#!/bin/sh | |
mkdir pdfs | |
cd pdfs | |
curl -LO https://developer.salesforce.com/resource/pdfs/Lightning_Components_Cheatsheet.pdf | |
curl -LO https://resources.docs.salesforce.com/sfdc/pdf/actions_impl_guide.pdf | |
curl -LO https://resources.docs.salesforce.com/sfdc/pdf/analytics.pdf | |
curl -LO https://resources.docs.salesforce.com/sfdc/pdf/apex_ajax.pdf | |
curl -LO https://resources.docs.salesforce.com/sfdc/pdf/apex_api.pdf |
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
<apex:page id="PersistentLoginPage" | |
applyBodyTag="false" | |
applyHtmlTag="false" | |
showHeader="false" | |
showChat="false" | |
sidebar="false" | |
standardStylesheets="false" | |
action="{!persistentLogin}" | |
controller="PersistentLoginController"> |
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
/* | |
Run Client App Auth Flow - as follows | |
1. Request a JWT to be created for a Community user from an IDP org with a csid | |
2. Pass the JWT to the SP org for an access token using the Oauth JWT bearer flow | |
3. If we get an 'invalid_grant' then send the JWT to a registration service for Just In Time user provisioning | |
4. On success retry the Oauth JWT bearer flow (step 2) | |
5. On success verify it works with an example API call to query the user object | |
- Components | |
- NodeJS App to Simulate a Client App |
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
while getopts m:b:d:n: option | |
do | |
case "${option}" | |
in | |
m) MESSAGE=${OPTARG};; | |
b) BRANCH=${OPTARG};; | |
d) DEFAULTORG=${OPTARG};; | |
n) SCRATCHORGNAME=${OPTARG};; | |
esac | |
done |
NewerOlder