1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package apigatewaymanagementapi
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
const opPostToConnection = "PostToConnection"
// PostToConnectionRequest generates a "aws/request.Request" representing the
// client's request for the PostToConnection operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See PostToConnection for more information on using the PostToConnection
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the PostToConnectionRequest method.
// req, resp := client.PostToConnectionRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/apigatewaymanagementapi-2018-11-29/PostToConnection
func (c *ApiGatewayManagementApi) PostToConnectionRequest(input *PostToConnectionInput) (req *request.Request, output *PostToConnectionOutput) {
op := &request.Operation{
Name: opPostToConnection,
HTTPMethod: "POST",
HTTPPath: "/@connections/{connectionId}",
}
if input == nil {
input = &PostToConnectionInput{}
}
output = &PostToConnectionOutput{}
req = c.newRequest(op, input, output)
req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
return
}
// PostToConnection API operation for AmazonApiGatewayManagementApi.
//
// Sends the provided data to the specified connection.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for AmazonApiGatewayManagementApi's
// API operation PostToConnection for usage and error information.
//
// Returned Error Codes:
// * ErrCodeGoneException "GoneException"
// The connection with the provided id no longer exists.
//
// * ErrCodeLimitExceededException "LimitExceededException"
// The client is sending more than the allowed number of requests per unit of
// time.
//
// * ErrCodePayloadTooLargeException "PayloadTooLargeException"
// The data has exceeded the maximum size allowed.
//
// * ErrCodeForbiddenException "ForbiddenException"
// The caller is not authorized to invoke this operation.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/apigatewaymanagementapi-2018-11-29/PostToConnection
func (c *ApiGatewayManagementApi) PostToConnection(input *PostToConnectionInput) (*PostToConnectionOutput, error) {
req, out := c.PostToConnectionRequest(input)
return out, req.Send()
}
// PostToConnectionWithContext is the same as PostToConnection with the addition of
// the ability to pass a context and additional request options.
//
// See PostToConnection for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ApiGatewayManagementApi) PostToConnectionWithContext(ctx aws.Context, input *PostToConnectionInput, opts ...request.Option) (*PostToConnectionOutput, error) {
req, out := c.PostToConnectionRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
type PostToConnectionInput struct {
_ struct{} `type:"structure" payload:"Data"`
// ConnectionId is a required field
ConnectionId *string `location:"uri" locationName:"connectionId" type:"string" required:"true"`
// The data to be sent to the client specified by its connection id.
//
// Data is a required field
Data []byte `type:"blob" required:"true"`
}
// String returns the string representation
func (s PostToConnectionInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s PostToConnectionInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *PostToConnectionInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "PostToConnectionInput"}
if s.ConnectionId == nil {
invalidParams.Add(request.NewErrParamRequired("ConnectionId"))
}
if s.ConnectionId != nil && len(*s.ConnectionId) < 1 {
invalidParams.Add(request.NewErrParamMinLen("ConnectionId", 1))
}
if s.Data == nil {
invalidParams.Add(request.NewErrParamRequired("Data"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetConnectionId sets the ConnectionId field's value.
func (s *PostToConnectionInput) SetConnectionId(v string) *PostToConnectionInput {
s.ConnectionId = &v
return s
}
// SetData sets the Data field's value.
func (s *PostToConnectionInput) SetData(v []byte) *PostToConnectionInput {
s.Data = v
return s
}
type PostToConnectionOutput struct {
_ struct{} `type:"structure"`
}
// String returns the string representation
func (s PostToConnectionOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s PostToConnectionOutput) GoString() string {
return s.String()
}
|