-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b804923
commit 0bf64a3
Showing
7 changed files
with
54 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ecs | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/marketplacemetering" | ||
) | ||
|
||
// Marketplace struct | ||
type Marketplace struct { | ||
} | ||
|
||
func (a *Marketplace) RegisterMarketplace() error { | ||
sess, err := session.NewSession(&aws.Config{Region: aws.String(os.Getenv("AWS_REGION"))}) | ||
if err != nil { | ||
return fmt.Errorf("couldn't initialize S3: %s", err) | ||
} | ||
|
||
productCode := os.Getenv("PROD_CODE") | ||
|
||
// Create a MarketplaceMetering client from just a session. | ||
svc := marketplacemetering.New(sess) | ||
|
||
_, err = svc.RegisterUsage(&marketplacemetering.RegisterUsageInput{ | ||
ProductCode: aws.String(productCode), | ||
PublicKeyVersion: aws.Int64(1), | ||
}) | ||
|
||
if err != nil { | ||
return fmt.Errorf("RegisterUsage error: %s", err) | ||
} | ||
|
||
return nil | ||
} |