awsnews

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 7 Imported by: 0

README

go-aws-news

Fetch what's new from AWS

Build Status Go Doc Go Report Card GitHub release (latest by date)

Install

go get "github.com/circa10a/go-aws-news"

Usage

Methods return a slice of structs which include the announcement title, a link, and the date it was posted as well an error. This allows you to manipulate the data in whichever way you please, or simply use Print() to print a nice ASCII table to the console.

package main

import (
	"log"
	awsNews "github.com/circa10a/go-aws-news"
)

func main() {
	// Today's news
	news, _ := awsNews.Today()
	news.Print()
	// Yesterday's news
	news, _:= awsNews.Yesterday()
	news.Print()
	// Current news
	news, _ := awsNews.ThisMonth()
	news.Print()
	// Custom timeframe(June 2019)
	news, err := awsNews.Fetch(2019, 06)
	// Handle errors as well
	if err != nil {
		log.Fatal(err)
	}
	news.Print()
	// Console output
	// +--------------------------------+--------------+
	// |          ANNOUNCEMENT          |     DATE     |
	// +--------------------------------+--------------+
	// | Amazon Cognito now supports    | Jan 10, 2020 |
	// | CloudWatch Usage Metrics       |              |
	// +--------------------------------+--------------+
	// | Introducing Workload Shares in | Jan 10, 2020 |
	// | AWS Well-Architected Tool      |              |
	// +--------------------------------+--------------+
	//
	// Loop slice of stucts of announcements
	// For your own data manipulation
	news, _ := awsNews.Fetch(time.Now().Year(), int(time.Now().Month()))
	for _, v := range news {
		fmt.Printf("Title: %v\n", v.Title)
		fmt.Printf("Link: %v\n", v.Link)
		fmt.Printf("Date: %v\n", v.PostDate)
	}
	// Even get all the Announcements as JSON
	news, err := Fetch(2019, 12)
	json, jsonErr := news.JSON()
}

Development

Test
# Unit/Integration tests
make
# Get code coverage
make coverage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcement added in v0.1.2

type Announcement struct {
	Title    string
	Link     string
	PostDate string
}

Announcement Represents a single AWS product/feature announcement.

type Announcements

type Announcements []Announcement

Announcements Represents a slice containing all of the AWS announcements for a given time period.

func Fetch

func Fetch(year int, month int) (Announcements, error)

Fetch Fetches all of the announcements for the specified year/month that was input.

func ThisMonth

func ThisMonth() (Announcements, error)

ThisMonth gets the current month's AWS announcements.

func Today

func Today() (Announcements, error)

Today gets today's AWS announcments.

func Yesterday

func Yesterday() (Announcements, error)

Yesterday gets yesterday's AWS announcments.

func (Announcements) JSON added in v0.1.1

func (a Announcements) JSON() ([]byte, error)

JSON Converts Announcements to JSON.

func (Announcements) Print

func (a Announcements) Print()

Print Prints out an ASCII table of your selection of AWS announcements.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL