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
<h3>My children </h3> | |
<div class="form-check"> | |
<label class="form-check-label"> | |
<input class="form-check-input" type="checkbox" [(ngModel)]="hasChildren" name="hasChildren"> I do not have any children | |
</label> | |
</div> | |
<div class="form-group"> | |
<label>Name</label> |
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 {ErrorHandler} from "@angular/core"; | |
import {UNAUTHORIZED, BAD_REQUEST, FORBIDDEN} from "http-status-codes"; | |
import {Router} from "@angular/router"; | |
import {ToastsManager, Toast, ToastOptions} from "ng2-toastr"; | |
@Injectable() | |
export class myAppErrorHandler implements ErrorHandler { | |
static readonly REFRESH_PAGE_ON_TOAST_CLICK_MESSAGE: string = "An error occurred: Please click this message to refresh"; | |
static readonly DEFAULT_ERROR_TITLE: string = "Something went wrong"; |
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
private removeItem(item: Item) { | |
let index = this.items.indexOf(item); | |
//remove the item | |
this.items.splice(index, 1); | |
//call back-end server to remove the item from the DB | |
this.itemService.deleteItem(item.id).subscribe( | |
//do some stuff | |
, |
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
private removeItem(item: Item) { | |
let index = this.items.indexOf(item); | |
//remove the item | |
this.items.splice(index, 1); | |
//call back-end server to remove the item from the DB | |
this.itemService.deleteItem(item.id,()=>this.items.splice(index, 0, item)).subscribe( | |
//do some stuff); | |
} |
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
public deleteItem(id: number, callback?: any): Observable<{}> { | |
//some prepartion of the http request... | |
return this.http.request(path, requestOptions) | |
.map((response: Response) => { | |
//some stuff... | |
}).catch((error: any) => { | |
error.callback=callback; | |
return Observable.throw(error); |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "lambda:InvokeFunction", | |
"Resource": "*" | |
} | |
] | |
} |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "", | |
"Effect": "Allow", | |
"Principal": { | |
"Service": [ | |
"lambda.amazonaws.com", | |
"apigateway.amazonaws.com" |
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
<dependency> | |
<artifactId>aws-java-sdk-api-gateway</artifactId> | |
<groupId>com.amazonaws</groupId> | |
</dependency> | |
<dependency> | |
<groupId>com.amazonaws</groupId> | |
<artifactId>aws-java-sdk</artifactId> | |
</dependency> |
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
BasicAWSCredentials awsCreds = new BasicAWSCredentials(AWS_ACCESS_KEY, AWS_SECRET_KEY); |
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
//prepare getway object | |
AmazonApiGateway gateway = AmazonApiGatewayClientBuilder.standard() | |
.withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withRegion(region).build(); | |
//find all rest apis | |
GetRestApisResult restApis = gateway.getRestApis(new GetRestApisRequest()); | |
//find our predefined api by name | |
RestApi targetRestApi = restApis.getItems().stream() | |
.filter(item -> item.getName().equals(targetRestApiName)).findFirst() |