Merge pull request #2207 from hashicorp/f-aws-fix-maps

provider/aws: Update SQS/SNS to work with upstream changes
This commit is contained in:
Clint 2015-06-03 08:56:36 -05:00
commit 926ff2ba10
8 changed files with 49 additions and 51 deletions

View File

@ -17,7 +17,6 @@ var SNSAttributeMap = map[string]string{
"delivery_policy": "DeliveryPolicy", "delivery_policy": "DeliveryPolicy",
} }
func resourceAwsSnsTopic() *schema.Resource { func resourceAwsSnsTopic() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
Create: resourceAwsSnsTopicCreate, Create: resourceAwsSnsTopicCreate,
@ -117,8 +116,8 @@ func resourceAwsSnsTopicRead(d *schema.ResourceData, meta interface{}) error {
return err return err
} }
if attributeOutput.Attributes != nil && len(*attributeOutput.Attributes) > 0 { if attributeOutput.Attributes != nil && len(attributeOutput.Attributes) > 0 {
attrmap := *attributeOutput.Attributes attrmap := attributeOutput.Attributes
resource := *resourceAwsSnsTopic() resource := *resourceAwsSnsTopic()
// iKey = internal struct key, oKey = AWS Attribute Map key // iKey = internal struct key, oKey = AWS Attribute Map key
for iKey, oKey := range SNSAttributeMap { for iKey, oKey := range SNSAttributeMap {

View File

@ -10,7 +10,6 @@ import (
"github.com/awslabs/aws-sdk-go/service/sns" "github.com/awslabs/aws-sdk-go/service/sns"
) )
func resourceAwsSnsTopicSubscription() *schema.Resource { func resourceAwsSnsTopicSubscription() *schema.Resource {
return &schema.Resource{ return &schema.Resource{
Create: resourceAwsSnsTopicSubscriptionCreate, Create: resourceAwsSnsTopicSubscriptionCreate,
@ -56,7 +55,7 @@ func resourceAwsSnsTopicSubscription() *schema.Resource {
func resourceAwsSnsTopicSubscriptionCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSnsTopicSubscriptionCreate(d *schema.ResourceData, meta interface{}) error {
snsconn := meta.(*AWSClient).snsconn snsconn := meta.(*AWSClient).snsconn
if(d.Get("protocol") == "email") { if d.Get("protocol") == "email" {
return fmt.Errorf("Email endpoints are not supported!") return fmt.Errorf("Email endpoints are not supported!")
} }
@ -132,8 +131,8 @@ func resourceAwsSnsTopicSubscriptionRead(d *schema.ResourceData, meta interface{
return err return err
} }
if attributeOutput.Attributes != nil && len(*attributeOutput.Attributes) > 0 { if attributeOutput.Attributes != nil && len(attributeOutput.Attributes) > 0 {
attrHash := *attributeOutput.Attributes attrHash := attributeOutput.Attributes
log.Printf("[DEBUG] raw message delivery: %s", *attrHash["RawMessageDelivery"]) log.Printf("[DEBUG] raw message delivery: %s", *attrHash["RawMessageDelivery"])
if *attrHash["RawMessageDelivery"] == "true" { if *attrHash["RawMessageDelivery"] == "true" {
d.Set("raw_message_delivery", true) d.Set("raw_message_delivery", true)

View File

@ -108,7 +108,7 @@ func resourceAwsSqsQueueCreate(d *schema.ResourceData, meta interface{}) error {
} }
if len(attributes) > 0 { if len(attributes) > 0 {
req.Attributes = &attributes req.Attributes = attributes
} }
output, err := sqsconn.CreateQueue(req) output, err := sqsconn.CreateQueue(req)
@ -144,7 +144,7 @@ func resourceAwsSqsQueueUpdate(d *schema.ResourceData, meta interface{}) error {
if len(attributes) > 0 { if len(attributes) > 0 {
req := &sqs.SetQueueAttributesInput{ req := &sqs.SetQueueAttributesInput{
QueueURL: aws.String(d.Id()), QueueURL: aws.String(d.Id()),
Attributes: &attributes, Attributes: attributes,
} }
sqsconn.SetQueueAttributes(req) sqsconn.SetQueueAttributes(req)
} }
@ -164,8 +164,8 @@ func resourceAwsSqsQueueRead(d *schema.ResourceData, meta interface{}) error {
return err return err
} }
if attributeOutput.Attributes != nil && len(*attributeOutput.Attributes) > 0 { if attributeOutput.Attributes != nil && len(attributeOutput.Attributes) > 0 {
attrmap := *attributeOutput.Attributes attrmap := attributeOutput.Attributes
resource := *resourceAwsSqsQueue() resource := *resourceAwsSqsQueue()
// iKey = internal struct key, oKey = AWS Attribute Map key // iKey = internal struct key, oKey = AWS Attribute Map key
for iKey, oKey := range AttributeMap { for iKey, oKey := range AttributeMap {

View File

@ -84,7 +84,7 @@ func testAccCheckAWSSQSExistsWithDefaults(n string) resource.TestCheckFunc {
} }
// checking if attributes are defaults // checking if attributes are defaults
for k, v := range *resp.Attributes { for k, v := range resp.Attributes {
if k == "VisibilityTimeout" && *v != "30" { if k == "VisibilityTimeout" && *v != "30" {
return fmt.Errorf("VisibilityTimeout (%s) was not set to 30", *v) return fmt.Errorf("VisibilityTimeout (%s) was not set to 30", *v)
} }
@ -134,7 +134,7 @@ func testAccCheckAWSSQSExistsWithOverrides(n string) resource.TestCheckFunc {
} }
// checking if attributes match our overrides // checking if attributes match our overrides
for k, v := range *resp.Attributes { for k, v := range resp.Attributes {
if k == "VisibilityTimeout" && *v != "60" { if k == "VisibilityTimeout" && *v != "60" {
return fmt.Errorf("VisibilityTimeout (%s) was not set to 60", *v) return fmt.Errorf("VisibilityTimeout (%s) was not set to 60", *v)
} }

View File

@ -9,7 +9,7 @@ const _ValueType_name = "TypeInvalidTypeBoolTypeIntTypeFloatTypeStringTypeListTy
var _ValueType_index = [...]uint8{0, 11, 19, 26, 35, 45, 53, 60, 67, 77} var _ValueType_index = [...]uint8{0, 11, 19, 26, 35, 45, 53, 60, 67, 77}
func (i ValueType) String() string { func (i ValueType) String() string {
if i < 0 || i+1 >= ValueType(len(_ValueType_index)) { if i < 0 || i >= ValueType(len(_ValueType_index)-1) {
return fmt.Sprintf("ValueType(%d)", i) return fmt.Sprintf("ValueType(%d)", i)
} }
return _ValueType_name[_ValueType_index[i]:_ValueType_index[i+1]] return _ValueType_name[_ValueType_index[i]:_ValueType_index[i+1]]

View File

@ -9,7 +9,7 @@ const _GraphNodeConfigType_name = "GraphNodeConfigTypeInvalidGraphNodeConfigType
var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157} var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157}
func (i GraphNodeConfigType) String() string { func (i GraphNodeConfigType) String() string {
if i < 0 || i+1 >= GraphNodeConfigType(len(_GraphNodeConfigType_index)) { if i < 0 || i >= GraphNodeConfigType(len(_GraphNodeConfigType_index)-1) {
return fmt.Sprintf("GraphNodeConfigType(%d)", i) return fmt.Sprintf("GraphNodeConfigType(%d)", i)
} }
return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]] return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]]

View File

@ -9,7 +9,7 @@ const _InstanceType_name = "TypeInvalidTypePrimaryTypeTaintedTypeDeposed"
var _InstanceType_index = [...]uint8{0, 11, 22, 33, 44} var _InstanceType_index = [...]uint8{0, 11, 22, 33, 44}
func (i InstanceType) String() string { func (i InstanceType) String() string {
if i < 0 || i+1 >= InstanceType(len(_InstanceType_index)) { if i < 0 || i >= InstanceType(len(_InstanceType_index)-1) {
return fmt.Sprintf("InstanceType(%d)", i) return fmt.Sprintf("InstanceType(%d)", i)
} }
return _InstanceType_name[_InstanceType_index[i]:_InstanceType_index[i+1]] return _InstanceType_name[_InstanceType_index[i]:_InstanceType_index[i+1]]

View File

@ -9,7 +9,7 @@ const _walkOperation_name = "walkInvalidwalkInputwalkApplywalkPlanwalkPlanDestro
var _walkOperation_index = [...]uint8{0, 11, 20, 29, 37, 52, 63, 75} var _walkOperation_index = [...]uint8{0, 11, 20, 29, 37, 52, 63, 75}
func (i walkOperation) String() string { func (i walkOperation) String() string {
if i+1 >= walkOperation(len(_walkOperation_index)) { if i >= walkOperation(len(_walkOperation_index)-1) {
return fmt.Sprintf("walkOperation(%d)", i) return fmt.Sprintf("walkOperation(%d)", i)
} }
return _walkOperation_name[_walkOperation_index[i]:_walkOperation_index[i+1]] return _walkOperation_name[_walkOperation_index[i]:_walkOperation_index[i+1]]