class AwsSnsSubscription

def fetch_from_api

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  catch_aws_errors do
    aws_response = backend.get_subscription_attributes(subscription_arn: @subscription_arn).attributes
    @exists = true
    @owner = aws_response["Owner"]
    @raw_message_delivery = aws_response["RawMessageDelivery"].eql?("true")
    @topic_arn = aws_response["TopicArn"]
    @endpoint = aws_response["Endpoint"]
    @protocol = aws_response["Protocol"]
    @confirmation_was_authenticated = aws_response["ConfirmationWasAuthenticated"].eql?("true")
  rescue Aws::SNS::Errors::NotFound
    @exists = false
    return
  end
end

def has_raw_message_delivery?

def has_raw_message_delivery?
  raw_message_delivery
end

def to_s

def to_s
  "SNS Subscription #{@arn}"
end

def validate_params(raw_params)

def validate_params(raw_params)
  validated_params = check_resource_param_names(
    raw_params: raw_params,
    allowed_params: [:subscription_arn],
    allowed_scalar_name: :subscription_arn,
    allowed_scalar_type: String
  )
  if validated_params.empty?
    raise ArgumentError, "You must provide a subscription_arn to aws_sns_subscription."
  end
  validated_params
end