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
// A golang example to work with the AWS VPCs using AWS SDK V2. | |
// By Arun Saha. | |
// | |
// This example demonstrates the following CRUD operations: | |
// - Creating VPC (with a primary CIDR) | |
// - Reading or getting VPCs | |
// - Getting all VPCs | |
// - Getting a specific VPC | |
// - Reading attributes in the VPC object | |
// - Update VPC |
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
# A python example to work with the AWS VPCs. This example | |
# demonstrates the following CRUD operations: | |
# - Creating VPC | |
# - Getting or retrieving VPC | |
# - Reading attributes in the VPC object | |
# - Update VPC | |
# - Update Tags | |
# - Update Secondary CIDRs | |
# - Deleting VPC |
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
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <string> | |
#include <memory> | |
using namespace std; | |
// An abstract (base) class to model a logging interface with two APIs. | |
class LoggerInterface { |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"os" | |
"reflect" | |
) |
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
var loggers []LoggerInterface | |
loggers = append(loggers, &InMemoryLogger{}) | |
loggers = append(loggers, makeLocalLogger(filename)) | |
// We can log the same messages in both loggers in the following way. | |
var testMessages = []string{ | |
"Hello, World!", | |
"abracadabra", | |
"Sayonara!", | |
} |
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
// LocalLogger saves the log messages in a file. | |
type LocalLogger struct { | |
LoggerInterface | |
filename string | |
file *os.File | |
} | |
func (this *LocalLogger) Log(mesg string) { | |
fmt.Fprintln(this.file, mesg) | |
} | |
func makeLocalLogger(filename string) *LocalLogger { |