Switch to using the dep tool and update all the dependencies
This commit is contained in:
+11149
File diff suppressed because it is too large
Load Diff
+86
@@ -0,0 +1,86 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package waf provides the client and types for making API
|
||||
// requests to AWS WAF.
|
||||
//
|
||||
// This is the AWS WAF API Reference for using AWS WAF with Amazon CloudFront.
|
||||
// The AWS WAF actions and data types listed in the reference are available
|
||||
// for protecting Amazon CloudFront distributions. You can use these actions
|
||||
// and data types via the endpoint waf.amazonaws.com. This guide is for developers
|
||||
// who need detailed information about the AWS WAF API actions, data types,
|
||||
// and errors. For detailed information about AWS WAF features and an overview
|
||||
// of how to use the AWS WAF API, see the AWS WAF Developer Guide (http://docs.aws.amazon.com/waf/latest/developerguide/).
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/waf-2015-08-24 for more information on this service.
|
||||
//
|
||||
// See waf package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/waf/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To use the client for AWS WAF you will first need
|
||||
// to create a new instance of it.
|
||||
//
|
||||
// When creating a client for an AWS service you'll first need to have a Session
|
||||
// already created. The Session provides configuration that can be shared
|
||||
// between multiple service clients. Additional configuration can be applied to
|
||||
// the Session and service's client when they are constructed. The aws package's
|
||||
// Config type contains several fields such as Region for the AWS Region the
|
||||
// client should make API requests too. The optional Config value can be provided
|
||||
// as the variadic argument for Sessions and client creation.
|
||||
//
|
||||
// Once the service's client is created you can use it to make API requests the
|
||||
// AWS service. These clients are safe to use concurrently.
|
||||
//
|
||||
// // Create a session to share configuration, and load external configuration.
|
||||
// sess := session.Must(session.NewSession())
|
||||
//
|
||||
// // Create the service's client with the session.
|
||||
// svc := waf.New(sess)
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use service clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws package's Config type for more information on configuration options.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the AWS WAF client WAF for more
|
||||
// information on creating the service's client.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/waf/#New
|
||||
//
|
||||
// Once the client is created you can make an API request to the service.
|
||||
// Each API method takes a input parameter, and returns the service response
|
||||
// and an error.
|
||||
//
|
||||
// The API method will document which error codes the service can be returned
|
||||
// by the operation if the service models the API operation's errors. These
|
||||
// errors will also be available as const strings prefixed with "ErrCode".
|
||||
//
|
||||
// result, err := svc.CreateByteMatchSet(params)
|
||||
// if err != nil {
|
||||
// // Cast err to awserr.Error to handle specific error codes.
|
||||
// aerr, ok := err.(awserr.Error)
|
||||
// if ok && aerr.Code() == <error code to check for> {
|
||||
// // Specific error code handling
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// fmt.Println("CreateByteMatchSet result:")
|
||||
// fmt.Println(result)
|
||||
//
|
||||
// Using the Client with Context
|
||||
//
|
||||
// The service's client also provides methods to make API requests with a Context
|
||||
// value. This allows you to control the timeout, and cancellation of pending
|
||||
// requests. These methods also take request Option as variadic parameter to apply
|
||||
// additional configuration to the API request.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
//
|
||||
// result, err := svc.CreateByteMatchSetWithContext(ctx, params)
|
||||
//
|
||||
// See the request package documentation for more information on using Context pattern
|
||||
// with the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
|
||||
package waf
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package waf
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeDisallowedNameException for service response error code
|
||||
// "DisallowedNameException".
|
||||
//
|
||||
// The name specified is invalid.
|
||||
ErrCodeDisallowedNameException = "DisallowedNameException"
|
||||
|
||||
// ErrCodeInternalErrorException for service response error code
|
||||
// "InternalErrorException".
|
||||
//
|
||||
// The operation failed because of a system problem, even though the request
|
||||
// was valid. Retry your request.
|
||||
ErrCodeInternalErrorException = "InternalErrorException"
|
||||
|
||||
// ErrCodeInvalidAccountException for service response error code
|
||||
// "InvalidAccountException".
|
||||
//
|
||||
// The operation failed because you tried to create, update, or delete an object
|
||||
// by using an invalid account identifier.
|
||||
ErrCodeInvalidAccountException = "InvalidAccountException"
|
||||
|
||||
// ErrCodeInvalidOperationException for service response error code
|
||||
// "InvalidOperationException".
|
||||
//
|
||||
// The operation failed because there was nothing to do. For example:
|
||||
//
|
||||
// * You tried to remove a Rule from a WebACL, but the Rule isn't in the
|
||||
// specified WebACL.
|
||||
//
|
||||
// * You tried to remove an IP address from an IPSet, but the IP address
|
||||
// isn't in the specified IPSet.
|
||||
//
|
||||
// * You tried to remove a ByteMatchTuple from a ByteMatchSet, but the ByteMatchTuple
|
||||
// isn't in the specified WebACL.
|
||||
//
|
||||
// * You tried to add a Rule to a WebACL, but the Rule already exists in
|
||||
// the specified WebACL.
|
||||
//
|
||||
// * You tried to add an IP address to an IPSet, but the IP address already
|
||||
// exists in the specified IPSet.
|
||||
//
|
||||
// * You tried to add a ByteMatchTuple to a ByteMatchSet, but the ByteMatchTuple
|
||||
// already exists in the specified WebACL.
|
||||
ErrCodeInvalidOperationException = "InvalidOperationException"
|
||||
|
||||
// ErrCodeInvalidParameterException for service response error code
|
||||
// "InvalidParameterException".
|
||||
//
|
||||
// The operation failed because AWS WAF didn't recognize a parameter in the
|
||||
// request. For example:
|
||||
//
|
||||
// * You specified an invalid parameter name.
|
||||
//
|
||||
// * You specified an invalid value.
|
||||
//
|
||||
// * You tried to update an object (ByteMatchSet, IPSet, Rule, or WebACL)
|
||||
// using an action other than INSERT or DELETE.
|
||||
//
|
||||
// * You tried to create a WebACL with a DefaultActionType other than ALLOW,
|
||||
// BLOCK, or COUNT.
|
||||
//
|
||||
// * You tried to update a WebACL with a WafActionType other than ALLOW,
|
||||
// BLOCK, or COUNT.
|
||||
//
|
||||
// * You tried to update a ByteMatchSet with a FieldToMatchType other than
|
||||
// HEADER, QUERY_STRING, or URI.
|
||||
//
|
||||
// * You tried to update a ByteMatchSet with a Field of HEADER but no value
|
||||
// for Data.
|
||||
//
|
||||
// * Your request references an ARN that is malformed, or corresponds to
|
||||
// a resource with which a web ACL cannot be associated.
|
||||
ErrCodeInvalidParameterException = "InvalidParameterException"
|
||||
|
||||
// ErrCodeLimitsExceededException for service response error code
|
||||
// "LimitsExceededException".
|
||||
//
|
||||
// The operation exceeds a resource limit, for example, the maximum number of
|
||||
// WebACL objects that you can create for an AWS account. For more information,
|
||||
// see Limits (http://docs.aws.amazon.com/waf/latest/developerguide/limits.html)
|
||||
// in the AWS WAF Developer Guide.
|
||||
ErrCodeLimitsExceededException = "LimitsExceededException"
|
||||
|
||||
// ErrCodeNonEmptyEntityException for service response error code
|
||||
// "NonEmptyEntityException".
|
||||
//
|
||||
// The operation failed because you tried to delete an object that isn't empty.
|
||||
// For example:
|
||||
//
|
||||
// * You tried to delete a WebACL that still contains one or more Rule objects.
|
||||
//
|
||||
// * You tried to delete a Rule that still contains one or more ByteMatchSet
|
||||
// objects or other predicates.
|
||||
//
|
||||
// * You tried to delete a ByteMatchSet that contains one or more ByteMatchTuple
|
||||
// objects.
|
||||
//
|
||||
// * You tried to delete an IPSet that references one or more IP addresses.
|
||||
ErrCodeNonEmptyEntityException = "NonEmptyEntityException"
|
||||
|
||||
// ErrCodeNonexistentContainerException for service response error code
|
||||
// "NonexistentContainerException".
|
||||
//
|
||||
// The operation failed because you tried to add an object to or delete an object
|
||||
// from another object that doesn't exist. For example:
|
||||
//
|
||||
// * You tried to add a Rule to or delete a Rule from a WebACL that doesn't
|
||||
// exist.
|
||||
//
|
||||
// * You tried to add a ByteMatchSet to or delete a ByteMatchSet from a Rule
|
||||
// that doesn't exist.
|
||||
//
|
||||
// * You tried to add an IP address to or delete an IP address from an IPSet
|
||||
// that doesn't exist.
|
||||
//
|
||||
// * You tried to add a ByteMatchTuple to or delete a ByteMatchTuple from
|
||||
// a ByteMatchSet that doesn't exist.
|
||||
ErrCodeNonexistentContainerException = "NonexistentContainerException"
|
||||
|
||||
// ErrCodeNonexistentItemException for service response error code
|
||||
// "NonexistentItemException".
|
||||
//
|
||||
// The operation failed because the referenced object doesn't exist.
|
||||
ErrCodeNonexistentItemException = "NonexistentItemException"
|
||||
|
||||
// ErrCodeReferencedItemException for service response error code
|
||||
// "ReferencedItemException".
|
||||
//
|
||||
// The operation failed because you tried to delete an object that is still
|
||||
// in use. For example:
|
||||
//
|
||||
// * You tried to delete a ByteMatchSet that is still referenced by a Rule.
|
||||
//
|
||||
// * You tried to delete a Rule that is still referenced by a WebACL.
|
||||
ErrCodeReferencedItemException = "ReferencedItemException"
|
||||
|
||||
// ErrCodeStaleDataException for service response error code
|
||||
// "StaleDataException".
|
||||
//
|
||||
// The operation failed because you tried to create, update, or delete an object
|
||||
// by using a change token that has already been used.
|
||||
ErrCodeStaleDataException = "StaleDataException"
|
||||
)
|
||||
+944
@@ -0,0 +1,944 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package waf_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/waf"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ bytes.Buffer
|
||||
|
||||
func ExampleWAF_CreateByteMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateByteMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateByteMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateIPSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateIPSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateIPSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateRuleInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
MetricName: aws.String("MetricName"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateSizeConstraintSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateSizeConstraintSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateSizeConstraintSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateSqlInjectionMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateSqlInjectionMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateSqlInjectionMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateWebACL() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateWebACLInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
DefaultAction: &waf.WafAction{ // Required
|
||||
Type: aws.String("WafActionType"), // Required
|
||||
},
|
||||
MetricName: aws.String("MetricName"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateWebACL(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_CreateXssMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.CreateXssMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Name: aws.String("ResourceName"), // Required
|
||||
}
|
||||
resp, err := svc.CreateXssMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteByteMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteByteMatchSetInput{
|
||||
ByteMatchSetId: aws.String("ResourceId"), // Required
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteByteMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteIPSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteIPSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
IPSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteIPSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteRuleInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
RuleId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteSizeConstraintSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteSizeConstraintSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
SizeConstraintSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteSizeConstraintSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteSqlInjectionMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteSqlInjectionMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
SqlInjectionMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteSqlInjectionMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteWebACL() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteWebACLInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
WebACLId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteWebACL(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_DeleteXssMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.DeleteXssMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
XssMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteXssMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetByteMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetByteMatchSetInput{
|
||||
ByteMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetByteMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetChangeToken() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
var params *waf.GetChangeTokenInput
|
||||
resp, err := svc.GetChangeToken(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetChangeTokenStatus() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetChangeTokenStatusInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
}
|
||||
resp, err := svc.GetChangeTokenStatus(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetIPSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetIPSetInput{
|
||||
IPSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetIPSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetRuleInput{
|
||||
RuleId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetSampledRequests() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetSampledRequestsInput{
|
||||
MaxItems: aws.Int64(1), // Required
|
||||
RuleId: aws.String("ResourceId"), // Required
|
||||
TimeWindow: &waf.TimeWindow{ // Required
|
||||
EndTime: aws.Time(time.Now()), // Required
|
||||
StartTime: aws.Time(time.Now()), // Required
|
||||
},
|
||||
WebAclId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetSampledRequests(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetSizeConstraintSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetSizeConstraintSetInput{
|
||||
SizeConstraintSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetSizeConstraintSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetSqlInjectionMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetSqlInjectionMatchSetInput{
|
||||
SqlInjectionMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetSqlInjectionMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetWebACL() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetWebACLInput{
|
||||
WebACLId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetWebACL(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_GetXssMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.GetXssMatchSetInput{
|
||||
XssMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.GetXssMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListByteMatchSets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListByteMatchSetsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListByteMatchSets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListIPSets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListIPSetsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListIPSets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListRules() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListRulesInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListRules(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListSizeConstraintSets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListSizeConstraintSetsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListSizeConstraintSets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListSqlInjectionMatchSets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListSqlInjectionMatchSetsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListSqlInjectionMatchSets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListWebACLs() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListWebACLsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListWebACLs(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_ListXssMatchSets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.ListXssMatchSetsInput{
|
||||
Limit: aws.Int64(1),
|
||||
NextMarker: aws.String("NextMarker"),
|
||||
}
|
||||
resp, err := svc.ListXssMatchSets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateByteMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateByteMatchSetInput{
|
||||
ByteMatchSetId: aws.String("ResourceId"), // Required
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Updates: []*waf.ByteMatchSetUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
ByteMatchTuple: &waf.ByteMatchTuple{ // Required
|
||||
FieldToMatch: &waf.FieldToMatch{ // Required
|
||||
Type: aws.String("MatchFieldType"), // Required
|
||||
Data: aws.String("MatchFieldData"),
|
||||
},
|
||||
PositionalConstraint: aws.String("PositionalConstraint"), // Required
|
||||
TargetString: []byte("PAYLOAD"), // Required
|
||||
TextTransformation: aws.String("TextTransformation"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateByteMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateIPSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateIPSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
IPSetId: aws.String("ResourceId"), // Required
|
||||
Updates: []*waf.IPSetUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
IPSetDescriptor: &waf.IPSetDescriptor{ // Required
|
||||
Type: aws.String("IPSetDescriptorType"), // Required
|
||||
Value: aws.String("IPSetDescriptorValue"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateIPSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateRuleInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
RuleId: aws.String("ResourceId"), // Required
|
||||
Updates: []*waf.RuleUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
Predicate: &waf.Predicate{ // Required
|
||||
DataId: aws.String("ResourceId"), // Required
|
||||
Negated: aws.Bool(true), // Required
|
||||
Type: aws.String("PredicateType"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateSizeConstraintSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateSizeConstraintSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
SizeConstraintSetId: aws.String("ResourceId"), // Required
|
||||
Updates: []*waf.SizeConstraintSetUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
SizeConstraint: &waf.SizeConstraint{ // Required
|
||||
ComparisonOperator: aws.String("ComparisonOperator"), // Required
|
||||
FieldToMatch: &waf.FieldToMatch{ // Required
|
||||
Type: aws.String("MatchFieldType"), // Required
|
||||
Data: aws.String("MatchFieldData"),
|
||||
},
|
||||
Size: aws.Int64(1), // Required
|
||||
TextTransformation: aws.String("TextTransformation"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateSizeConstraintSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateSqlInjectionMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateSqlInjectionMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
SqlInjectionMatchSetId: aws.String("ResourceId"), // Required
|
||||
Updates: []*waf.SqlInjectionMatchSetUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
SqlInjectionMatchTuple: &waf.SqlInjectionMatchTuple{ // Required
|
||||
FieldToMatch: &waf.FieldToMatch{ // Required
|
||||
Type: aws.String("MatchFieldType"), // Required
|
||||
Data: aws.String("MatchFieldData"),
|
||||
},
|
||||
TextTransformation: aws.String("TextTransformation"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateSqlInjectionMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateWebACL() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateWebACLInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
WebACLId: aws.String("ResourceId"), // Required
|
||||
DefaultAction: &waf.WafAction{
|
||||
Type: aws.String("WafActionType"), // Required
|
||||
},
|
||||
Updates: []*waf.WebACLUpdate{
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
ActivatedRule: &waf.ActivatedRule{ // Required
|
||||
Action: &waf.WafAction{ // Required
|
||||
Type: aws.String("WafActionType"), // Required
|
||||
},
|
||||
Priority: aws.Int64(1), // Required
|
||||
RuleId: aws.String("ResourceId"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.UpdateWebACL(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleWAF_UpdateXssMatchSet() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := waf.New(sess)
|
||||
|
||||
params := &waf.UpdateXssMatchSetInput{
|
||||
ChangeToken: aws.String("ChangeToken"), // Required
|
||||
Updates: []*waf.XssMatchSetUpdate{ // Required
|
||||
{ // Required
|
||||
Action: aws.String("ChangeAction"), // Required
|
||||
XssMatchTuple: &waf.XssMatchTuple{ // Required
|
||||
FieldToMatch: &waf.FieldToMatch{ // Required
|
||||
Type: aws.String("MatchFieldType"), // Required
|
||||
Data: aws.String("MatchFieldData"),
|
||||
},
|
||||
TextTransformation: aws.String("TextTransformation"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
XssMatchSetId: aws.String("ResourceId"), // Required
|
||||
}
|
||||
resp, err := svc.UpdateXssMatchSet(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package waf
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
// WAF provides the API operation methods for making requests to
|
||||
// AWS WAF. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// WAF methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type WAF struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "waf" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the WAF client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a WAF client from just a session.
|
||||
// svc := waf.New(mySession)
|
||||
//
|
||||
// // Create a WAF client with additional configuration
|
||||
// svc := waf.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *WAF {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *WAF {
|
||||
svc := &WAF{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2015-08-24",
|
||||
JSONVersion: "1.1",
|
||||
TargetPrefix: "AWSWAF_20150824",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a WAF operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *WAF) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package wafiface provides an interface to enable mocking the AWS WAF service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package wafiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/waf"
|
||||
)
|
||||
|
||||
// WAFAPI provides an interface to enable mocking the
|
||||
// waf.WAF service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // AWS WAF.
|
||||
// func myFunc(svc wafiface.WAFAPI) bool {
|
||||
// // Make svc.CreateByteMatchSet request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := waf.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockWAFClient struct {
|
||||
// wafiface.WAFAPI
|
||||
// }
|
||||
// func (m *mockWAFClient) CreateByteMatchSet(input *waf.CreateByteMatchSetInput) (*waf.CreateByteMatchSetOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockWAFClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type WAFAPI interface {
|
||||
CreateByteMatchSet(*waf.CreateByteMatchSetInput) (*waf.CreateByteMatchSetOutput, error)
|
||||
CreateByteMatchSetWithContext(aws.Context, *waf.CreateByteMatchSetInput, ...request.Option) (*waf.CreateByteMatchSetOutput, error)
|
||||
CreateByteMatchSetRequest(*waf.CreateByteMatchSetInput) (*request.Request, *waf.CreateByteMatchSetOutput)
|
||||
|
||||
CreateIPSet(*waf.CreateIPSetInput) (*waf.CreateIPSetOutput, error)
|
||||
CreateIPSetWithContext(aws.Context, *waf.CreateIPSetInput, ...request.Option) (*waf.CreateIPSetOutput, error)
|
||||
CreateIPSetRequest(*waf.CreateIPSetInput) (*request.Request, *waf.CreateIPSetOutput)
|
||||
|
||||
CreateRule(*waf.CreateRuleInput) (*waf.CreateRuleOutput, error)
|
||||
CreateRuleWithContext(aws.Context, *waf.CreateRuleInput, ...request.Option) (*waf.CreateRuleOutput, error)
|
||||
CreateRuleRequest(*waf.CreateRuleInput) (*request.Request, *waf.CreateRuleOutput)
|
||||
|
||||
CreateSizeConstraintSet(*waf.CreateSizeConstraintSetInput) (*waf.CreateSizeConstraintSetOutput, error)
|
||||
CreateSizeConstraintSetWithContext(aws.Context, *waf.CreateSizeConstraintSetInput, ...request.Option) (*waf.CreateSizeConstraintSetOutput, error)
|
||||
CreateSizeConstraintSetRequest(*waf.CreateSizeConstraintSetInput) (*request.Request, *waf.CreateSizeConstraintSetOutput)
|
||||
|
||||
CreateSqlInjectionMatchSet(*waf.CreateSqlInjectionMatchSetInput) (*waf.CreateSqlInjectionMatchSetOutput, error)
|
||||
CreateSqlInjectionMatchSetWithContext(aws.Context, *waf.CreateSqlInjectionMatchSetInput, ...request.Option) (*waf.CreateSqlInjectionMatchSetOutput, error)
|
||||
CreateSqlInjectionMatchSetRequest(*waf.CreateSqlInjectionMatchSetInput) (*request.Request, *waf.CreateSqlInjectionMatchSetOutput)
|
||||
|
||||
CreateWebACL(*waf.CreateWebACLInput) (*waf.CreateWebACLOutput, error)
|
||||
CreateWebACLWithContext(aws.Context, *waf.CreateWebACLInput, ...request.Option) (*waf.CreateWebACLOutput, error)
|
||||
CreateWebACLRequest(*waf.CreateWebACLInput) (*request.Request, *waf.CreateWebACLOutput)
|
||||
|
||||
CreateXssMatchSet(*waf.CreateXssMatchSetInput) (*waf.CreateXssMatchSetOutput, error)
|
||||
CreateXssMatchSetWithContext(aws.Context, *waf.CreateXssMatchSetInput, ...request.Option) (*waf.CreateXssMatchSetOutput, error)
|
||||
CreateXssMatchSetRequest(*waf.CreateXssMatchSetInput) (*request.Request, *waf.CreateXssMatchSetOutput)
|
||||
|
||||
DeleteByteMatchSet(*waf.DeleteByteMatchSetInput) (*waf.DeleteByteMatchSetOutput, error)
|
||||
DeleteByteMatchSetWithContext(aws.Context, *waf.DeleteByteMatchSetInput, ...request.Option) (*waf.DeleteByteMatchSetOutput, error)
|
||||
DeleteByteMatchSetRequest(*waf.DeleteByteMatchSetInput) (*request.Request, *waf.DeleteByteMatchSetOutput)
|
||||
|
||||
DeleteIPSet(*waf.DeleteIPSetInput) (*waf.DeleteIPSetOutput, error)
|
||||
DeleteIPSetWithContext(aws.Context, *waf.DeleteIPSetInput, ...request.Option) (*waf.DeleteIPSetOutput, error)
|
||||
DeleteIPSetRequest(*waf.DeleteIPSetInput) (*request.Request, *waf.DeleteIPSetOutput)
|
||||
|
||||
DeleteRule(*waf.DeleteRuleInput) (*waf.DeleteRuleOutput, error)
|
||||
DeleteRuleWithContext(aws.Context, *waf.DeleteRuleInput, ...request.Option) (*waf.DeleteRuleOutput, error)
|
||||
DeleteRuleRequest(*waf.DeleteRuleInput) (*request.Request, *waf.DeleteRuleOutput)
|
||||
|
||||
DeleteSizeConstraintSet(*waf.DeleteSizeConstraintSetInput) (*waf.DeleteSizeConstraintSetOutput, error)
|
||||
DeleteSizeConstraintSetWithContext(aws.Context, *waf.DeleteSizeConstraintSetInput, ...request.Option) (*waf.DeleteSizeConstraintSetOutput, error)
|
||||
DeleteSizeConstraintSetRequest(*waf.DeleteSizeConstraintSetInput) (*request.Request, *waf.DeleteSizeConstraintSetOutput)
|
||||
|
||||
DeleteSqlInjectionMatchSet(*waf.DeleteSqlInjectionMatchSetInput) (*waf.DeleteSqlInjectionMatchSetOutput, error)
|
||||
DeleteSqlInjectionMatchSetWithContext(aws.Context, *waf.DeleteSqlInjectionMatchSetInput, ...request.Option) (*waf.DeleteSqlInjectionMatchSetOutput, error)
|
||||
DeleteSqlInjectionMatchSetRequest(*waf.DeleteSqlInjectionMatchSetInput) (*request.Request, *waf.DeleteSqlInjectionMatchSetOutput)
|
||||
|
||||
DeleteWebACL(*waf.DeleteWebACLInput) (*waf.DeleteWebACLOutput, error)
|
||||
DeleteWebACLWithContext(aws.Context, *waf.DeleteWebACLInput, ...request.Option) (*waf.DeleteWebACLOutput, error)
|
||||
DeleteWebACLRequest(*waf.DeleteWebACLInput) (*request.Request, *waf.DeleteWebACLOutput)
|
||||
|
||||
DeleteXssMatchSet(*waf.DeleteXssMatchSetInput) (*waf.DeleteXssMatchSetOutput, error)
|
||||
DeleteXssMatchSetWithContext(aws.Context, *waf.DeleteXssMatchSetInput, ...request.Option) (*waf.DeleteXssMatchSetOutput, error)
|
||||
DeleteXssMatchSetRequest(*waf.DeleteXssMatchSetInput) (*request.Request, *waf.DeleteXssMatchSetOutput)
|
||||
|
||||
GetByteMatchSet(*waf.GetByteMatchSetInput) (*waf.GetByteMatchSetOutput, error)
|
||||
GetByteMatchSetWithContext(aws.Context, *waf.GetByteMatchSetInput, ...request.Option) (*waf.GetByteMatchSetOutput, error)
|
||||
GetByteMatchSetRequest(*waf.GetByteMatchSetInput) (*request.Request, *waf.GetByteMatchSetOutput)
|
||||
|
||||
GetChangeToken(*waf.GetChangeTokenInput) (*waf.GetChangeTokenOutput, error)
|
||||
GetChangeTokenWithContext(aws.Context, *waf.GetChangeTokenInput, ...request.Option) (*waf.GetChangeTokenOutput, error)
|
||||
GetChangeTokenRequest(*waf.GetChangeTokenInput) (*request.Request, *waf.GetChangeTokenOutput)
|
||||
|
||||
GetChangeTokenStatus(*waf.GetChangeTokenStatusInput) (*waf.GetChangeTokenStatusOutput, error)
|
||||
GetChangeTokenStatusWithContext(aws.Context, *waf.GetChangeTokenStatusInput, ...request.Option) (*waf.GetChangeTokenStatusOutput, error)
|
||||
GetChangeTokenStatusRequest(*waf.GetChangeTokenStatusInput) (*request.Request, *waf.GetChangeTokenStatusOutput)
|
||||
|
||||
GetIPSet(*waf.GetIPSetInput) (*waf.GetIPSetOutput, error)
|
||||
GetIPSetWithContext(aws.Context, *waf.GetIPSetInput, ...request.Option) (*waf.GetIPSetOutput, error)
|
||||
GetIPSetRequest(*waf.GetIPSetInput) (*request.Request, *waf.GetIPSetOutput)
|
||||
|
||||
GetRule(*waf.GetRuleInput) (*waf.GetRuleOutput, error)
|
||||
GetRuleWithContext(aws.Context, *waf.GetRuleInput, ...request.Option) (*waf.GetRuleOutput, error)
|
||||
GetRuleRequest(*waf.GetRuleInput) (*request.Request, *waf.GetRuleOutput)
|
||||
|
||||
GetSampledRequests(*waf.GetSampledRequestsInput) (*waf.GetSampledRequestsOutput, error)
|
||||
GetSampledRequestsWithContext(aws.Context, *waf.GetSampledRequestsInput, ...request.Option) (*waf.GetSampledRequestsOutput, error)
|
||||
GetSampledRequestsRequest(*waf.GetSampledRequestsInput) (*request.Request, *waf.GetSampledRequestsOutput)
|
||||
|
||||
GetSizeConstraintSet(*waf.GetSizeConstraintSetInput) (*waf.GetSizeConstraintSetOutput, error)
|
||||
GetSizeConstraintSetWithContext(aws.Context, *waf.GetSizeConstraintSetInput, ...request.Option) (*waf.GetSizeConstraintSetOutput, error)
|
||||
GetSizeConstraintSetRequest(*waf.GetSizeConstraintSetInput) (*request.Request, *waf.GetSizeConstraintSetOutput)
|
||||
|
||||
GetSqlInjectionMatchSet(*waf.GetSqlInjectionMatchSetInput) (*waf.GetSqlInjectionMatchSetOutput, error)
|
||||
GetSqlInjectionMatchSetWithContext(aws.Context, *waf.GetSqlInjectionMatchSetInput, ...request.Option) (*waf.GetSqlInjectionMatchSetOutput, error)
|
||||
GetSqlInjectionMatchSetRequest(*waf.GetSqlInjectionMatchSetInput) (*request.Request, *waf.GetSqlInjectionMatchSetOutput)
|
||||
|
||||
GetWebACL(*waf.GetWebACLInput) (*waf.GetWebACLOutput, error)
|
||||
GetWebACLWithContext(aws.Context, *waf.GetWebACLInput, ...request.Option) (*waf.GetWebACLOutput, error)
|
||||
GetWebACLRequest(*waf.GetWebACLInput) (*request.Request, *waf.GetWebACLOutput)
|
||||
|
||||
GetXssMatchSet(*waf.GetXssMatchSetInput) (*waf.GetXssMatchSetOutput, error)
|
||||
GetXssMatchSetWithContext(aws.Context, *waf.GetXssMatchSetInput, ...request.Option) (*waf.GetXssMatchSetOutput, error)
|
||||
GetXssMatchSetRequest(*waf.GetXssMatchSetInput) (*request.Request, *waf.GetXssMatchSetOutput)
|
||||
|
||||
ListByteMatchSets(*waf.ListByteMatchSetsInput) (*waf.ListByteMatchSetsOutput, error)
|
||||
ListByteMatchSetsWithContext(aws.Context, *waf.ListByteMatchSetsInput, ...request.Option) (*waf.ListByteMatchSetsOutput, error)
|
||||
ListByteMatchSetsRequest(*waf.ListByteMatchSetsInput) (*request.Request, *waf.ListByteMatchSetsOutput)
|
||||
|
||||
ListIPSets(*waf.ListIPSetsInput) (*waf.ListIPSetsOutput, error)
|
||||
ListIPSetsWithContext(aws.Context, *waf.ListIPSetsInput, ...request.Option) (*waf.ListIPSetsOutput, error)
|
||||
ListIPSetsRequest(*waf.ListIPSetsInput) (*request.Request, *waf.ListIPSetsOutput)
|
||||
|
||||
ListRules(*waf.ListRulesInput) (*waf.ListRulesOutput, error)
|
||||
ListRulesWithContext(aws.Context, *waf.ListRulesInput, ...request.Option) (*waf.ListRulesOutput, error)
|
||||
ListRulesRequest(*waf.ListRulesInput) (*request.Request, *waf.ListRulesOutput)
|
||||
|
||||
ListSizeConstraintSets(*waf.ListSizeConstraintSetsInput) (*waf.ListSizeConstraintSetsOutput, error)
|
||||
ListSizeConstraintSetsWithContext(aws.Context, *waf.ListSizeConstraintSetsInput, ...request.Option) (*waf.ListSizeConstraintSetsOutput, error)
|
||||
ListSizeConstraintSetsRequest(*waf.ListSizeConstraintSetsInput) (*request.Request, *waf.ListSizeConstraintSetsOutput)
|
||||
|
||||
ListSqlInjectionMatchSets(*waf.ListSqlInjectionMatchSetsInput) (*waf.ListSqlInjectionMatchSetsOutput, error)
|
||||
ListSqlInjectionMatchSetsWithContext(aws.Context, *waf.ListSqlInjectionMatchSetsInput, ...request.Option) (*waf.ListSqlInjectionMatchSetsOutput, error)
|
||||
ListSqlInjectionMatchSetsRequest(*waf.ListSqlInjectionMatchSetsInput) (*request.Request, *waf.ListSqlInjectionMatchSetsOutput)
|
||||
|
||||
ListWebACLs(*waf.ListWebACLsInput) (*waf.ListWebACLsOutput, error)
|
||||
ListWebACLsWithContext(aws.Context, *waf.ListWebACLsInput, ...request.Option) (*waf.ListWebACLsOutput, error)
|
||||
ListWebACLsRequest(*waf.ListWebACLsInput) (*request.Request, *waf.ListWebACLsOutput)
|
||||
|
||||
ListXssMatchSets(*waf.ListXssMatchSetsInput) (*waf.ListXssMatchSetsOutput, error)
|
||||
ListXssMatchSetsWithContext(aws.Context, *waf.ListXssMatchSetsInput, ...request.Option) (*waf.ListXssMatchSetsOutput, error)
|
||||
ListXssMatchSetsRequest(*waf.ListXssMatchSetsInput) (*request.Request, *waf.ListXssMatchSetsOutput)
|
||||
|
||||
UpdateByteMatchSet(*waf.UpdateByteMatchSetInput) (*waf.UpdateByteMatchSetOutput, error)
|
||||
UpdateByteMatchSetWithContext(aws.Context, *waf.UpdateByteMatchSetInput, ...request.Option) (*waf.UpdateByteMatchSetOutput, error)
|
||||
UpdateByteMatchSetRequest(*waf.UpdateByteMatchSetInput) (*request.Request, *waf.UpdateByteMatchSetOutput)
|
||||
|
||||
UpdateIPSet(*waf.UpdateIPSetInput) (*waf.UpdateIPSetOutput, error)
|
||||
UpdateIPSetWithContext(aws.Context, *waf.UpdateIPSetInput, ...request.Option) (*waf.UpdateIPSetOutput, error)
|
||||
UpdateIPSetRequest(*waf.UpdateIPSetInput) (*request.Request, *waf.UpdateIPSetOutput)
|
||||
|
||||
UpdateRule(*waf.UpdateRuleInput) (*waf.UpdateRuleOutput, error)
|
||||
UpdateRuleWithContext(aws.Context, *waf.UpdateRuleInput, ...request.Option) (*waf.UpdateRuleOutput, error)
|
||||
UpdateRuleRequest(*waf.UpdateRuleInput) (*request.Request, *waf.UpdateRuleOutput)
|
||||
|
||||
UpdateSizeConstraintSet(*waf.UpdateSizeConstraintSetInput) (*waf.UpdateSizeConstraintSetOutput, error)
|
||||
UpdateSizeConstraintSetWithContext(aws.Context, *waf.UpdateSizeConstraintSetInput, ...request.Option) (*waf.UpdateSizeConstraintSetOutput, error)
|
||||
UpdateSizeConstraintSetRequest(*waf.UpdateSizeConstraintSetInput) (*request.Request, *waf.UpdateSizeConstraintSetOutput)
|
||||
|
||||
UpdateSqlInjectionMatchSet(*waf.UpdateSqlInjectionMatchSetInput) (*waf.UpdateSqlInjectionMatchSetOutput, error)
|
||||
UpdateSqlInjectionMatchSetWithContext(aws.Context, *waf.UpdateSqlInjectionMatchSetInput, ...request.Option) (*waf.UpdateSqlInjectionMatchSetOutput, error)
|
||||
UpdateSqlInjectionMatchSetRequest(*waf.UpdateSqlInjectionMatchSetInput) (*request.Request, *waf.UpdateSqlInjectionMatchSetOutput)
|
||||
|
||||
UpdateWebACL(*waf.UpdateWebACLInput) (*waf.UpdateWebACLOutput, error)
|
||||
UpdateWebACLWithContext(aws.Context, *waf.UpdateWebACLInput, ...request.Option) (*waf.UpdateWebACLOutput, error)
|
||||
UpdateWebACLRequest(*waf.UpdateWebACLInput) (*request.Request, *waf.UpdateWebACLOutput)
|
||||
|
||||
UpdateXssMatchSet(*waf.UpdateXssMatchSetInput) (*waf.UpdateXssMatchSetOutput, error)
|
||||
UpdateXssMatchSetWithContext(aws.Context, *waf.UpdateXssMatchSetInput, ...request.Option) (*waf.UpdateXssMatchSetOutput, error)
|
||||
UpdateXssMatchSetRequest(*waf.UpdateXssMatchSetInput) (*request.Request, *waf.UpdateXssMatchSetOutput)
|
||||
}
|
||||
|
||||
var _ WAFAPI = (*waf.WAF)(nil)
|
||||
Reference in New Issue
Block a user