-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from coldbrewcloud/logging
Container logging support
- Loading branch information
Showing
13 changed files
with
228 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.0 | ||
1.3.0 |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package logs | ||
|
||
import ( | ||
_aws "github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
_logs "github.com/aws/aws-sdk-go/service/cloudwatchlogs" | ||
) | ||
|
||
type Client struct { | ||
svc *_logs.CloudWatchLogs | ||
awsRegion string | ||
} | ||
|
||
func New(session *session.Session, config *_aws.Config) *Client { | ||
return &Client{ | ||
awsRegion: *config.Region, | ||
svc: _logs.New(session, config), | ||
} | ||
} | ||
|
||
func (c *Client) CreateGroup(groupName string) error { | ||
params := &_logs.CreateLogGroupInput{ | ||
LogGroupName: _aws.String(groupName), | ||
} | ||
|
||
_, err := c.svc.CreateLogGroup(params) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (c *Client) ListGroups(groupNamePrefix string) ([]*_logs.LogGroup, error) { | ||
var nextToken *string | ||
groups := []*_logs.LogGroup{} | ||
|
||
for { | ||
params := &_logs.DescribeLogGroupsInput{ | ||
LogGroupNamePrefix: _aws.String(groupNamePrefix), | ||
NextToken: nextToken, | ||
} | ||
|
||
res, err := c.svc.DescribeLogGroups(params) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
groups = append(groups, res.LogGroups...) | ||
|
||
if res.NextToken == nil { | ||
break | ||
} else { | ||
nextToken = res.NextToken | ||
} | ||
} | ||
|
||
return groups, nil | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.