This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Box.V2.Config; | |
using Box.V2.JWTAuth; | |
namespace BoxGetAllUsers | |
{ |
This file contains hidden or 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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"strings" | |
"time" |
This file contains hidden or 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 microsoft/dotnet | |
RUN apt-get update | |
RUN apt-get install -y curl unzip zip | |
RUN dotnet new -i Amazon.Lambda.Templates::* | |
RUN apt-get install -y groff-base | |
RUN wget https://bootstrap.pypa.io/get-pip.py |
This file contains hidden or 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
# Metadata commands | |
box files metadata create 278109288966 enterprise cli | |
box files metadata update 278109288966 enterprise cli --replace -p "/settings" -v "of" | |
box files metadata update 278109288966 enterprise cli --remove -p "/settings" | |
box files metadata update 278109288966 enterprise cli -a -p "/settings" -v "off" | |
# Metadata Date Value | |
box files metadata update 278109288966 enterprise cli -a -p "/home" -v "2002-10-02T10:00:00-05:00" | |
# Metadata Enum Value | |
box files metadata update 278109288966 enterprise cli -a -p "/env" -v "admin" |
This file contains hidden or 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
BoxFile file = new BoxFile(serviceAccountClient, source.get("id").asText().intern()); | |
OutputStream stream = new ByteArrayOutputStream(); | |
file.download(stream); | |
// Insert Epi. code | |
String metadataTemplate = "productClassification"; | |
String metadataField = "/partSku"; | |
String partSku = ""; // Replace with Epi return part SKU. | |
file.createMetadata(metadataTemplate, new Metadata().add(metadataField, partSku)); |
This file contains hidden or 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
box users list | ConvertFrom-Json | select -ExpandProperty "Entries" | select Name,Login,Id,Space_Used | where {($_.Login -Match "AppUser" -and $_.Space_Used -eq 0)} | select Id,Name,Space_Used | Tee-Object -Variable box_users | select Id | ConvertTo-Json; | |
$box_users | Format-Table |
This file contains hidden or 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
aws secretsmanager create-secret --name box_config --secre | |
t-string $(base64 -i ./boxConfig.json) |
This file contains hidden or 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
AWSTemplateFormatVersion: "2010-09-09" | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
devNull | |
/dev/null as a Service | |
Parameters: | |
KMSAliasName: | |
Type: String | |
Default: alias/devnull/share |
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ -z "$1" ] | |
then | |
read -p "Please enter text: " TEXT | |
else | |
TEXT=$1 | |
fi | |
if [ -z "$2" ] | |
then |
This file contains hidden or 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-Module AWSLambdaPSCore | |
Import-Module AWSPowerShell.NetCore | |
$region = 'eu-west-2' | |
New-AWSPowerShellLambdaPackage -ScriptPath ./rek/DetectLabels.ps1 -OutputPackage DetectLabels.zip | |
Write-S3Object -BucketName amsxbg-dotnet-eu -File ./DetectLabels.zip | |
New-CFNStack -StackName DetectLabelsPS -Capabilities @("CAPABILITY_IAM","CAPABILITY_AUTO_EXPAND") -TemplateBody $(Get-Content ./serverless.template.json | Out-String) -Region $region | |
Wait-CFNStack -StackName DetectLabelPS | |
Get-CFNStack -StackName DetectLabelsPS -Region $region | Select-Object -ExpandProperty Outputs | Select-Object -Property @{Name='BucketName'; Expression={$_.OutputValue}} | Write-S3Object -File /Users/amsg/Documents/laser.jpg | |
Get-CFNStack -StackName DetectLabelsPS -Region $region | Select-Object -ExpandProperty Outputs | Select-Object -Property @{Name='BucketName'; Expression={$_.OutputValue}} | Get-S3ObjectTagSet -Key laser.jpg |