vendor: bump github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs to v1.32.0

v1.33.0 is also available, but it would also cause
`github.com/aws/aws-sdk-go-v2` change from v1.24.1 to v1.25.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 70a4a9c969)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
This commit is contained in:
Paweł Gronowski 2024-02-14 17:23:31 +01:00 committed by Austin Vazquez
parent 71b8e0339c
commit 60605eb1da
No known key found for this signature in database
GPG key ID: F769BEB52D074D32
108 changed files with 22804 additions and 1246 deletions

View file

@ -21,7 +21,7 @@ require (
github.com/aws/aws-sdk-go-v2/config v1.26.6
github.com/aws/aws-sdk-go-v2/credentials v1.16.16
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.15.17
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.32.0
github.com/aws/smithy-go v1.19.0
github.com/cloudflare/cfssl v1.6.4
github.com/containerd/cgroups/v3 v3.0.3
@ -120,6 +120,7 @@ require (
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 // indirect
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 // indirect

View file

@ -182,25 +182,24 @@ github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/aws/aws-sdk-go v1.25.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go-v2 v1.16.13/go.mod h1:xSyvSnzh0KLs5H4HJGeIEsNYemUWdNIl0b/rP6SIsLU=
github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU=
github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo=
github.com/aws/aws-sdk-go-v2/config v1.26.6 h1:Z/7w9bUqlRI0FFQpetVuFYEsjzE3h7fpU6HuGmfPL/o=
github.com/aws/aws-sdk-go-v2/config v1.26.6/go.mod h1:uKU6cnDmYCvJ+pxO9S4cWDb2yWWIH5hra+32hVh1MI4=
github.com/aws/aws-sdk-go-v2/credentials v1.16.16 h1:8q6Rliyv0aUFAVtzaldUEcS+T5gbadPbWdV1WcAddK8=
github.com/aws/aws-sdk-go-v2/credentials v1.16.16/go.mod h1:UHVZrdUsv63hPXFo1H7c5fEneoVo9UXiz36QG1GEPi0=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.20/go.mod h1:gdZ5gRUaxThXIZyZQ8MTtgYBk2jbHgp05BO3GcD9Cwc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.14/go.mod h1:GEV9jaDPIgayiU+uevxwozcvUOjc+P4aHE2BeSjm2vE=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw=
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 h1:n3GDfwqF2tzEkXlv5cuy4iy7LpKDtqDMcNLfZDu9rls=
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.15.17 h1:cDudPvUMS1LzoXgwhAVqUoaOK3PY7oCSL4pGmQmxlSk=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.15.17/go.mod h1:60NdwPCecURV9rIq6Hg8U4kOsKsz1aXvAAYNKlhG9+E=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.32.0 h1:VdKYfVPIDzmfSQk5gOQ5uueKiuKMkJuB/KOXmQ9Ytag=
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.32.0/go.mod h1:jZNaJEtn9TLi3pfxycLz79HVkKxP8ZdYm92iaNFgBsA=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4=
@ -211,7 +210,6 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 h1:QPMJf+Jw8E1l7zqhZmMlFw6w
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8=
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0=
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U=
github.com/aws/smithy-go v1.13.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM=
github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE=
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
@ -624,7 +622,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
@ -790,8 +787,6 @@ github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht
github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jmoiron/sqlx v1.3.3 h1:j82X0bf7oQ27XeqxicSZsTU5suPwKElg3oyxNn43iTk=
github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=

View file

@ -0,0 +1,98 @@
# v1.5.4 (2023-12-07)
* No change notes available for this release.
# v1.5.3 (2023-11-30)
* No change notes available for this release.
# v1.5.2 (2023-11-29)
* No change notes available for this release.
# v1.5.1 (2023-11-15)
* No change notes available for this release.
# v1.5.0 (2023-10-31)
* **Feature**: **BREAKING CHANGE**: Bump minimum go version to 1.19 per the revised [go version support policy](https://aws.amazon.com/blogs/developer/aws-sdk-for-go-aligns-with-go-release-policy-on-supported-runtimes/).
# v1.4.14 (2023-10-06)
* No change notes available for this release.
# v1.4.13 (2023-08-18)
* No change notes available for this release.
# v1.4.12 (2023-08-07)
* No change notes available for this release.
# v1.4.11 (2023-07-31)
* No change notes available for this release.
# v1.4.10 (2022-12-02)
* No change notes available for this release.
# v1.4.9 (2022-10-24)
* No change notes available for this release.
# v1.4.8 (2022-09-14)
* No change notes available for this release.
# v1.4.7 (2022-09-02)
* No change notes available for this release.
# v1.4.6 (2022-08-31)
* No change notes available for this release.
# v1.4.5 (2022-08-29)
* No change notes available for this release.
# v1.4.4 (2022-08-09)
* No change notes available for this release.
# v1.4.3 (2022-06-29)
* No change notes available for this release.
# v1.4.2 (2022-06-07)
* No change notes available for this release.
# v1.4.1 (2022-03-24)
* No change notes available for this release.
# v1.4.0 (2022-03-08)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
# v1.3.0 (2022-02-24)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
# v1.2.0 (2022-01-14)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
# v1.1.0 (2022-01-07)
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
# v1.0.0 (2021-11-06)
* **Announcement**: Support has been added for AWS EventStream APIs for Kinesis, S3, and Transcribe Streaming. Support for the Lex Runtime V2 EventStream API will be added in a future release.
* **Release**: Protocol support has been added for AWS event stream.
* **Feature**: Updated `github.com/aws/smithy-go` to latest version

View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,144 @@
package eventstream
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"strconv"
)
type decodedMessage struct {
rawMessage
Headers decodedHeaders `json:"headers"`
}
type jsonMessage struct {
Length json.Number `json:"total_length"`
HeadersLen json.Number `json:"headers_length"`
PreludeCRC json.Number `json:"prelude_crc"`
Headers decodedHeaders `json:"headers"`
Payload []byte `json:"payload"`
CRC json.Number `json:"message_crc"`
}
func (d *decodedMessage) UnmarshalJSON(b []byte) (err error) {
var jsonMsg jsonMessage
if err = json.Unmarshal(b, &jsonMsg); err != nil {
return err
}
d.Length, err = numAsUint32(jsonMsg.Length)
if err != nil {
return err
}
d.HeadersLen, err = numAsUint32(jsonMsg.HeadersLen)
if err != nil {
return err
}
d.PreludeCRC, err = numAsUint32(jsonMsg.PreludeCRC)
if err != nil {
return err
}
d.Headers = jsonMsg.Headers
d.Payload = jsonMsg.Payload
d.CRC, err = numAsUint32(jsonMsg.CRC)
if err != nil {
return err
}
return nil
}
func (d *decodedMessage) MarshalJSON() ([]byte, error) {
jsonMsg := jsonMessage{
Length: json.Number(strconv.Itoa(int(d.Length))),
HeadersLen: json.Number(strconv.Itoa(int(d.HeadersLen))),
PreludeCRC: json.Number(strconv.Itoa(int(d.PreludeCRC))),
Headers: d.Headers,
Payload: d.Payload,
CRC: json.Number(strconv.Itoa(int(d.CRC))),
}
return json.Marshal(jsonMsg)
}
func numAsUint32(n json.Number) (uint32, error) {
v, err := n.Int64()
if err != nil {
return 0, fmt.Errorf("failed to get int64 json number, %v", err)
}
return uint32(v), nil
}
func (d decodedMessage) Message() Message {
return Message{
Headers: Headers(d.Headers),
Payload: d.Payload,
}
}
type decodedHeaders Headers
func (hs *decodedHeaders) UnmarshalJSON(b []byte) error {
var jsonHeaders []struct {
Name string `json:"name"`
Type valueType `json:"type"`
Value interface{} `json:"value"`
}
decoder := json.NewDecoder(bytes.NewReader(b))
decoder.UseNumber()
if err := decoder.Decode(&jsonHeaders); err != nil {
return err
}
var headers Headers
for _, h := range jsonHeaders {
value, err := valueFromType(h.Type, h.Value)
if err != nil {
return err
}
headers.Set(h.Name, value)
}
*hs = decodedHeaders(headers)
return nil
}
func valueFromType(typ valueType, val interface{}) (Value, error) {
switch typ {
case trueValueType:
return BoolValue(true), nil
case falseValueType:
return BoolValue(false), nil
case int8ValueType:
v, err := val.(json.Number).Int64()
return Int8Value(int8(v)), err
case int16ValueType:
v, err := val.(json.Number).Int64()
return Int16Value(int16(v)), err
case int32ValueType:
v, err := val.(json.Number).Int64()
return Int32Value(int32(v)), err
case int64ValueType:
v, err := val.(json.Number).Int64()
return Int64Value(v), err
case bytesValueType:
v, err := base64.StdEncoding.DecodeString(val.(string))
return BytesValue(v), err
case stringValueType:
v, err := base64.StdEncoding.DecodeString(val.(string))
return StringValue(string(v)), err
case timestampValueType:
v, err := val.(json.Number).Int64()
return TimestampValue(timeFromEpochMilli(v)), err
case uuidValueType:
v, err := base64.StdEncoding.DecodeString(val.(string))
var tv UUIDValue
copy(tv[:], v)
return tv, err
default:
panic(fmt.Sprintf("unknown type, %s, %T", typ.String(), val))
}
}

View file

@ -0,0 +1,218 @@
package eventstream
import (
"bytes"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/aws/smithy-go/logging"
"hash"
"hash/crc32"
"io"
)
// DecoderOptions is the Decoder configuration options.
type DecoderOptions struct {
Logger logging.Logger
LogMessages bool
}
// Decoder provides decoding of an Event Stream messages.
type Decoder struct {
options DecoderOptions
}
// NewDecoder initializes and returns a Decoder for decoding event
// stream messages from the reader provided.
func NewDecoder(optFns ...func(*DecoderOptions)) *Decoder {
options := DecoderOptions{}
for _, fn := range optFns {
fn(&options)
}
return &Decoder{
options: options,
}
}
// Decode attempts to decode a single message from the event stream reader.
// Will return the event stream message, or error if decodeMessage fails to read
// the message from the stream.
//
// payloadBuf is a byte slice that will be used in the returned Message.Payload. Callers
// must ensure that the Message.Payload from a previous decode has been consumed before passing in the same underlying
// payloadBuf byte slice.
func (d *Decoder) Decode(reader io.Reader, payloadBuf []byte) (m Message, err error) {
if d.options.Logger != nil && d.options.LogMessages {
debugMsgBuf := bytes.NewBuffer(nil)
reader = io.TeeReader(reader, debugMsgBuf)
defer func() {
logMessageDecode(d.options.Logger, debugMsgBuf, m, err)
}()
}
m, err = decodeMessage(reader, payloadBuf)
return m, err
}
// decodeMessage attempts to decode a single message from the event stream reader.
// Will return the event stream message, or error if decodeMessage fails to read
// the message from the reader.
func decodeMessage(reader io.Reader, payloadBuf []byte) (m Message, err error) {
crc := crc32.New(crc32IEEETable)
hashReader := io.TeeReader(reader, crc)
prelude, err := decodePrelude(hashReader, crc)
if err != nil {
return Message{}, err
}
if prelude.HeadersLen > 0 {
lr := io.LimitReader(hashReader, int64(prelude.HeadersLen))
m.Headers, err = decodeHeaders(lr)
if err != nil {
return Message{}, err
}
}
if payloadLen := prelude.PayloadLen(); payloadLen > 0 {
buf, err := decodePayload(payloadBuf, io.LimitReader(hashReader, int64(payloadLen)))
if err != nil {
return Message{}, err
}
m.Payload = buf
}
msgCRC := crc.Sum32()
if err := validateCRC(reader, msgCRC); err != nil {
return Message{}, err
}
return m, nil
}
func logMessageDecode(logger logging.Logger, msgBuf *bytes.Buffer, msg Message, decodeErr error) {
w := bytes.NewBuffer(nil)
defer func() { logger.Logf(logging.Debug, w.String()) }()
fmt.Fprintf(w, "Raw message:\n%s\n",
hex.Dump(msgBuf.Bytes()))
if decodeErr != nil {
fmt.Fprintf(w, "decodeMessage error: %v\n", decodeErr)
return
}
rawMsg, err := msg.rawMessage()
if err != nil {
fmt.Fprintf(w, "failed to create raw message, %v\n", err)
return
}
decodedMsg := decodedMessage{
rawMessage: rawMsg,
Headers: decodedHeaders(msg.Headers),
}
fmt.Fprintf(w, "Decoded message:\n")
encoder := json.NewEncoder(w)
if err := encoder.Encode(decodedMsg); err != nil {
fmt.Fprintf(w, "failed to generate decoded message, %v\n", err)
}
}
func decodePrelude(r io.Reader, crc hash.Hash32) (messagePrelude, error) {
var p messagePrelude
var err error
p.Length, err = decodeUint32(r)
if err != nil {
return messagePrelude{}, err
}
p.HeadersLen, err = decodeUint32(r)
if err != nil {
return messagePrelude{}, err
}
if err := p.ValidateLens(); err != nil {
return messagePrelude{}, err
}
preludeCRC := crc.Sum32()
if err := validateCRC(r, preludeCRC); err != nil {
return messagePrelude{}, err
}
p.PreludeCRC = preludeCRC
return p, nil
}
func decodePayload(buf []byte, r io.Reader) ([]byte, error) {
w := bytes.NewBuffer(buf[0:0])
_, err := io.Copy(w, r)
return w.Bytes(), err
}
func decodeUint8(r io.Reader) (uint8, error) {
type byteReader interface {
ReadByte() (byte, error)
}
if br, ok := r.(byteReader); ok {
v, err := br.ReadByte()
return v, err
}
var b [1]byte
_, err := io.ReadFull(r, b[:])
return b[0], err
}
func decodeUint16(r io.Reader) (uint16, error) {
var b [2]byte
bs := b[:]
_, err := io.ReadFull(r, bs)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint16(bs), nil
}
func decodeUint32(r io.Reader) (uint32, error) {
var b [4]byte
bs := b[:]
_, err := io.ReadFull(r, bs)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint32(bs), nil
}
func decodeUint64(r io.Reader) (uint64, error) {
var b [8]byte
bs := b[:]
_, err := io.ReadFull(r, bs)
if err != nil {
return 0, err
}
return binary.BigEndian.Uint64(bs), nil
}
func validateCRC(r io.Reader, expect uint32) error {
msgCRC, err := decodeUint32(r)
if err != nil {
return err
}
if msgCRC != expect {
return ChecksumError{}
}
return nil
}

View file

@ -0,0 +1,167 @@
package eventstream
import (
"bytes"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/aws/smithy-go/logging"
"hash"
"hash/crc32"
"io"
)
// EncoderOptions is the configuration options for Encoder.
type EncoderOptions struct {
Logger logging.Logger
LogMessages bool
}
// Encoder provides EventStream message encoding.
type Encoder struct {
options EncoderOptions
headersBuf *bytes.Buffer
messageBuf *bytes.Buffer
}
// NewEncoder initializes and returns an Encoder to encode Event Stream
// messages.
func NewEncoder(optFns ...func(*EncoderOptions)) *Encoder {
o := EncoderOptions{}
for _, fn := range optFns {
fn(&o)
}
return &Encoder{
options: o,
headersBuf: bytes.NewBuffer(nil),
messageBuf: bytes.NewBuffer(nil),
}
}
// Encode encodes a single EventStream message to the io.Writer the Encoder
// was created with. An error is returned if writing the message fails.
func (e *Encoder) Encode(w io.Writer, msg Message) (err error) {
e.headersBuf.Reset()
e.messageBuf.Reset()
var writer io.Writer = e.messageBuf
if e.options.Logger != nil && e.options.LogMessages {
encodeMsgBuf := bytes.NewBuffer(nil)
writer = io.MultiWriter(writer, encodeMsgBuf)
defer func() {
logMessageEncode(e.options.Logger, encodeMsgBuf, msg, err)
}()
}
if err = EncodeHeaders(e.headersBuf, msg.Headers); err != nil {
return err
}
crc := crc32.New(crc32IEEETable)
hashWriter := io.MultiWriter(writer, crc)
headersLen := uint32(e.headersBuf.Len())
payloadLen := uint32(len(msg.Payload))
if err = encodePrelude(hashWriter, crc, headersLen, payloadLen); err != nil {
return err
}
if headersLen > 0 {
if _, err = io.Copy(hashWriter, e.headersBuf); err != nil {
return err
}
}
if payloadLen > 0 {
if _, err = hashWriter.Write(msg.Payload); err != nil {
return err
}
}
msgCRC := crc.Sum32()
if err := binary.Write(writer, binary.BigEndian, msgCRC); err != nil {
return err
}
_, err = io.Copy(w, e.messageBuf)
return err
}
func logMessageEncode(logger logging.Logger, msgBuf *bytes.Buffer, msg Message, encodeErr error) {
w := bytes.NewBuffer(nil)
defer func() { logger.Logf(logging.Debug, w.String()) }()
fmt.Fprintf(w, "Message to encode:\n")
encoder := json.NewEncoder(w)
if err := encoder.Encode(msg); err != nil {
fmt.Fprintf(w, "Failed to get encoded message, %v\n", err)
}
if encodeErr != nil {
fmt.Fprintf(w, "Encode error: %v\n", encodeErr)
return
}
fmt.Fprintf(w, "Raw message:\n%s\n", hex.Dump(msgBuf.Bytes()))
}
func encodePrelude(w io.Writer, crc hash.Hash32, headersLen, payloadLen uint32) error {
p := messagePrelude{
Length: minMsgLen + headersLen + payloadLen,
HeadersLen: headersLen,
}
if err := p.ValidateLens(); err != nil {
return err
}
err := binaryWriteFields(w, binary.BigEndian,
p.Length,
p.HeadersLen,
)
if err != nil {
return err
}
p.PreludeCRC = crc.Sum32()
err = binary.Write(w, binary.BigEndian, p.PreludeCRC)
if err != nil {
return err
}
return nil
}
// EncodeHeaders writes the header values to the writer encoded in the event
// stream format. Returns an error if a header fails to encode.
func EncodeHeaders(w io.Writer, headers Headers) error {
for _, h := range headers {
hn := headerName{
Len: uint8(len(h.Name)),
}
copy(hn.Name[:hn.Len], h.Name)
if err := hn.encode(w); err != nil {
return err
}
if err := h.Value.encode(w); err != nil {
return err
}
}
return nil
}
func binaryWriteFields(w io.Writer, order binary.ByteOrder, vs ...interface{}) error {
for _, v := range vs {
if err := binary.Write(w, order, v); err != nil {
return err
}
}
return nil
}

View file

@ -0,0 +1,23 @@
package eventstream
import "fmt"
// LengthError provides the error for items being larger than a maximum length.
type LengthError struct {
Part string
Want int
Have int
Value interface{}
}
func (e LengthError) Error() string {
return fmt.Sprintf("%s length invalid, %d/%d, %v",
e.Part, e.Want, e.Have, e.Value)
}
// ChecksumError provides the error for message checksum invalidation errors.
type ChecksumError struct{}
func (e ChecksumError) Error() string {
return "message checksum mismatch"
}

View file

@ -0,0 +1,24 @@
package eventstreamapi
// EventStream headers with specific meaning to async API functionality.
const (
ChunkSignatureHeader = `:chunk-signature` // chunk signature for message
DateHeader = `:date` // Date header for signature
ContentTypeHeader = ":content-type" // message payload content-type
// Message header and values
MessageTypeHeader = `:message-type` // Identifies type of message.
EventMessageType = `event`
ErrorMessageType = `error`
ExceptionMessageType = `exception`
// Message Events
EventTypeHeader = `:event-type` // Identifies message event type e.g. "Stats".
// Message Error
ErrorCodeHeader = `:error-code`
ErrorMessageHeader = `:error-message`
// Message Exception
ExceptionTypeHeader = `:exception-type`
)

View file

@ -0,0 +1,71 @@
package eventstreamapi
import (
"context"
"fmt"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
)
type eventStreamWriterKey struct{}
// GetInputStreamWriter returns EventTypeHeader io.PipeWriter used for the operation's input event stream.
func GetInputStreamWriter(ctx context.Context) io.WriteCloser {
writeCloser, _ := middleware.GetStackValue(ctx, eventStreamWriterKey{}).(io.WriteCloser)
return writeCloser
}
func setInputStreamWriter(ctx context.Context, writeCloser io.WriteCloser) context.Context {
return middleware.WithStackValue(ctx, eventStreamWriterKey{}, writeCloser)
}
// InitializeStreamWriter is a Finalize middleware initializes an in-memory pipe for sending event stream messages
// via the HTTP request body.
type InitializeStreamWriter struct{}
// AddInitializeStreamWriter adds the InitializeStreamWriter middleware to the provided stack.
func AddInitializeStreamWriter(stack *middleware.Stack) error {
return stack.Finalize.Add(&InitializeStreamWriter{}, middleware.After)
}
// ID returns the identifier for the middleware.
func (i *InitializeStreamWriter) ID() string {
return "InitializeStreamWriter"
}
// HandleFinalize is the middleware implementation.
func (i *InitializeStreamWriter) HandleFinalize(
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler,
) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type: %T", in.Request)
}
inputReader, inputWriter := io.Pipe()
defer func() {
if err == nil {
return
}
_ = inputReader.Close()
_ = inputWriter.Close()
}()
request, err = request.SetStream(inputReader)
if err != nil {
return out, metadata, err
}
in.Request = request
ctx = setInputStreamWriter(ctx, inputWriter)
out, metadata, err = next.HandleFinalize(ctx, in)
if err != nil {
return out, metadata, err
}
return out, metadata, err
}

View file

@ -0,0 +1,13 @@
//go:build go1.18
// +build go1.18
package eventstreamapi
import smithyhttp "github.com/aws/smithy-go/transport/http"
// ApplyHTTPTransportFixes applies fixes to the HTTP request for proper event stream functionality.
//
// This operation is a no-op for Go 1.18 and above.
func ApplyHTTPTransportFixes(r *smithyhttp.Request) error {
return nil
}

View file

@ -0,0 +1,12 @@
//go:build !go1.18
// +build !go1.18
package eventstreamapi
import smithyhttp "github.com/aws/smithy-go/transport/http"
// ApplyHTTPTransportFixes applies fixes to the HTTP request for proper event stream functionality.
func ApplyHTTPTransportFixes(r *smithyhttp.Request) error {
r.Header.Set("Expect", "100-continue")
return nil
}

View file

@ -0,0 +1,6 @@
// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
package eventstream
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.5.4"

View file

@ -0,0 +1,175 @@
package eventstream
import (
"encoding/binary"
"fmt"
"io"
)
// Headers are a collection of EventStream header values.
type Headers []Header
// Header is a single EventStream Key Value header pair.
type Header struct {
Name string
Value Value
}
// Set associates the name with a value. If the header name already exists in
// the Headers the value will be replaced with the new one.
func (hs *Headers) Set(name string, value Value) {
var i int
for ; i < len(*hs); i++ {
if (*hs)[i].Name == name {
(*hs)[i].Value = value
return
}
}
*hs = append(*hs, Header{
Name: name, Value: value,
})
}
// Get returns the Value associated with the header. Nil is returned if the
// value does not exist.
func (hs Headers) Get(name string) Value {
for i := 0; i < len(hs); i++ {
if h := hs[i]; h.Name == name {
return h.Value
}
}
return nil
}
// Del deletes the value in the Headers if it exists.
func (hs *Headers) Del(name string) {
for i := 0; i < len(*hs); i++ {
if (*hs)[i].Name == name {
copy((*hs)[i:], (*hs)[i+1:])
(*hs) = (*hs)[:len(*hs)-1]
}
}
}
// Clone returns a deep copy of the headers
func (hs Headers) Clone() Headers {
o := make(Headers, 0, len(hs))
for _, h := range hs {
o.Set(h.Name, h.Value)
}
return o
}
func decodeHeaders(r io.Reader) (Headers, error) {
hs := Headers{}
for {
name, err := decodeHeaderName(r)
if err != nil {
if err == io.EOF {
// EOF while getting header name means no more headers
break
}
return nil, err
}
value, err := decodeHeaderValue(r)
if err != nil {
return nil, err
}
hs.Set(name, value)
}
return hs, nil
}
func decodeHeaderName(r io.Reader) (string, error) {
var n headerName
var err error
n.Len, err = decodeUint8(r)
if err != nil {
return "", err
}
name := n.Name[:n.Len]
if _, err := io.ReadFull(r, name); err != nil {
return "", err
}
return string(name), nil
}
func decodeHeaderValue(r io.Reader) (Value, error) {
var raw rawValue
typ, err := decodeUint8(r)
if err != nil {
return nil, err
}
raw.Type = valueType(typ)
var v Value
switch raw.Type {
case trueValueType:
v = BoolValue(true)
case falseValueType:
v = BoolValue(false)
case int8ValueType:
var tv Int8Value
err = tv.decode(r)
v = tv
case int16ValueType:
var tv Int16Value
err = tv.decode(r)
v = tv
case int32ValueType:
var tv Int32Value
err = tv.decode(r)
v = tv
case int64ValueType:
var tv Int64Value
err = tv.decode(r)
v = tv
case bytesValueType:
var tv BytesValue
err = tv.decode(r)
v = tv
case stringValueType:
var tv StringValue
err = tv.decode(r)
v = tv
case timestampValueType:
var tv TimestampValue
err = tv.decode(r)
v = tv
case uuidValueType:
var tv UUIDValue
err = tv.decode(r)
v = tv
default:
panic(fmt.Sprintf("unknown value type %d", raw.Type))
}
// Error could be EOF, let caller deal with it
return v, err
}
const maxHeaderNameLen = 255
type headerName struct {
Len uint8
Name [maxHeaderNameLen]byte
}
func (v headerName) encode(w io.Writer) error {
if err := binary.Write(w, binary.BigEndian, v.Len); err != nil {
return err
}
_, err := w.Write(v.Name[:v.Len])
return err
}

View file

@ -0,0 +1,521 @@
package eventstream
import (
"encoding/base64"
"encoding/binary"
"encoding/hex"
"fmt"
"io"
"strconv"
"time"
)
const maxHeaderValueLen = 1<<15 - 1 // 2^15-1 or 32KB - 1
// valueType is the EventStream header value type.
type valueType uint8
// Header value types
const (
trueValueType valueType = iota
falseValueType
int8ValueType // Byte
int16ValueType // Short
int32ValueType // Integer
int64ValueType // Long
bytesValueType
stringValueType
timestampValueType
uuidValueType
)
func (t valueType) String() string {
switch t {
case trueValueType:
return "bool"
case falseValueType:
return "bool"
case int8ValueType:
return "int8"
case int16ValueType:
return "int16"
case int32ValueType:
return "int32"
case int64ValueType:
return "int64"
case bytesValueType:
return "byte_array"
case stringValueType:
return "string"
case timestampValueType:
return "timestamp"
case uuidValueType:
return "uuid"
default:
return fmt.Sprintf("unknown value type %d", uint8(t))
}
}
type rawValue struct {
Type valueType
Len uint16 // Only set for variable length slices
Value []byte // byte representation of value, BigEndian encoding.
}
func (r rawValue) encodeScalar(w io.Writer, v interface{}) error {
return binaryWriteFields(w, binary.BigEndian,
r.Type,
v,
)
}
func (r rawValue) encodeFixedSlice(w io.Writer, v []byte) error {
binary.Write(w, binary.BigEndian, r.Type)
_, err := w.Write(v)
return err
}
func (r rawValue) encodeBytes(w io.Writer, v []byte) error {
if len(v) > maxHeaderValueLen {
return LengthError{
Part: "header value",
Want: maxHeaderValueLen, Have: len(v),
Value: v,
}
}
r.Len = uint16(len(v))
err := binaryWriteFields(w, binary.BigEndian,
r.Type,
r.Len,
)
if err != nil {
return err
}
_, err = w.Write(v)
return err
}
func (r rawValue) encodeString(w io.Writer, v string) error {
if len(v) > maxHeaderValueLen {
return LengthError{
Part: "header value",
Want: maxHeaderValueLen, Have: len(v),
Value: v,
}
}
r.Len = uint16(len(v))
type stringWriter interface {
WriteString(string) (int, error)
}
err := binaryWriteFields(w, binary.BigEndian,
r.Type,
r.Len,
)
if err != nil {
return err
}
if sw, ok := w.(stringWriter); ok {
_, err = sw.WriteString(v)
} else {
_, err = w.Write([]byte(v))
}
return err
}
func decodeFixedBytesValue(r io.Reader, buf []byte) error {
_, err := io.ReadFull(r, buf)
return err
}
func decodeBytesValue(r io.Reader) ([]byte, error) {
var raw rawValue
var err error
raw.Len, err = decodeUint16(r)
if err != nil {
return nil, err
}
buf := make([]byte, raw.Len)
_, err = io.ReadFull(r, buf)
if err != nil {
return nil, err
}
return buf, nil
}
func decodeStringValue(r io.Reader) (string, error) {
v, err := decodeBytesValue(r)
return string(v), err
}
// Value represents the abstract header value.
type Value interface {
Get() interface{}
String() string
valueType() valueType
encode(io.Writer) error
}
// An BoolValue provides eventstream encoding, and representation
// of a Go bool value.
type BoolValue bool
// Get returns the underlying type
func (v BoolValue) Get() interface{} {
return bool(v)
}
// valueType returns the EventStream header value type value.
func (v BoolValue) valueType() valueType {
if v {
return trueValueType
}
return falseValueType
}
func (v BoolValue) String() string {
return strconv.FormatBool(bool(v))
}
// encode encodes the BoolValue into an eventstream binary value
// representation.
func (v BoolValue) encode(w io.Writer) error {
return binary.Write(w, binary.BigEndian, v.valueType())
}
// An Int8Value provides eventstream encoding, and representation of a Go
// int8 value.
type Int8Value int8
// Get returns the underlying value.
func (v Int8Value) Get() interface{} {
return int8(v)
}
// valueType returns the EventStream header value type value.
func (Int8Value) valueType() valueType {
return int8ValueType
}
func (v Int8Value) String() string {
return fmt.Sprintf("0x%02x", int8(v))
}
// encode encodes the Int8Value into an eventstream binary value
// representation.
func (v Int8Value) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeScalar(w, v)
}
func (v *Int8Value) decode(r io.Reader) error {
n, err := decodeUint8(r)
if err != nil {
return err
}
*v = Int8Value(n)
return nil
}
// An Int16Value provides eventstream encoding, and representation of a Go
// int16 value.
type Int16Value int16
// Get returns the underlying value.
func (v Int16Value) Get() interface{} {
return int16(v)
}
// valueType returns the EventStream header value type value.
func (Int16Value) valueType() valueType {
return int16ValueType
}
func (v Int16Value) String() string {
return fmt.Sprintf("0x%04x", int16(v))
}
// encode encodes the Int16Value into an eventstream binary value
// representation.
func (v Int16Value) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeScalar(w, v)
}
func (v *Int16Value) decode(r io.Reader) error {
n, err := decodeUint16(r)
if err != nil {
return err
}
*v = Int16Value(n)
return nil
}
// An Int32Value provides eventstream encoding, and representation of a Go
// int32 value.
type Int32Value int32
// Get returns the underlying value.
func (v Int32Value) Get() interface{} {
return int32(v)
}
// valueType returns the EventStream header value type value.
func (Int32Value) valueType() valueType {
return int32ValueType
}
func (v Int32Value) String() string {
return fmt.Sprintf("0x%08x", int32(v))
}
// encode encodes the Int32Value into an eventstream binary value
// representation.
func (v Int32Value) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeScalar(w, v)
}
func (v *Int32Value) decode(r io.Reader) error {
n, err := decodeUint32(r)
if err != nil {
return err
}
*v = Int32Value(n)
return nil
}
// An Int64Value provides eventstream encoding, and representation of a Go
// int64 value.
type Int64Value int64
// Get returns the underlying value.
func (v Int64Value) Get() interface{} {
return int64(v)
}
// valueType returns the EventStream header value type value.
func (Int64Value) valueType() valueType {
return int64ValueType
}
func (v Int64Value) String() string {
return fmt.Sprintf("0x%016x", int64(v))
}
// encode encodes the Int64Value into an eventstream binary value
// representation.
func (v Int64Value) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeScalar(w, v)
}
func (v *Int64Value) decode(r io.Reader) error {
n, err := decodeUint64(r)
if err != nil {
return err
}
*v = Int64Value(n)
return nil
}
// An BytesValue provides eventstream encoding, and representation of a Go
// byte slice.
type BytesValue []byte
// Get returns the underlying value.
func (v BytesValue) Get() interface{} {
return []byte(v)
}
// valueType returns the EventStream header value type value.
func (BytesValue) valueType() valueType {
return bytesValueType
}
func (v BytesValue) String() string {
return base64.StdEncoding.EncodeToString([]byte(v))
}
// encode encodes the BytesValue into an eventstream binary value
// representation.
func (v BytesValue) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeBytes(w, []byte(v))
}
func (v *BytesValue) decode(r io.Reader) error {
buf, err := decodeBytesValue(r)
if err != nil {
return err
}
*v = BytesValue(buf)
return nil
}
// An StringValue provides eventstream encoding, and representation of a Go
// string.
type StringValue string
// Get returns the underlying value.
func (v StringValue) Get() interface{} {
return string(v)
}
// valueType returns the EventStream header value type value.
func (StringValue) valueType() valueType {
return stringValueType
}
func (v StringValue) String() string {
return string(v)
}
// encode encodes the StringValue into an eventstream binary value
// representation.
func (v StringValue) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeString(w, string(v))
}
func (v *StringValue) decode(r io.Reader) error {
s, err := decodeStringValue(r)
if err != nil {
return err
}
*v = StringValue(s)
return nil
}
// An TimestampValue provides eventstream encoding, and representation of a Go
// timestamp.
type TimestampValue time.Time
// Get returns the underlying value.
func (v TimestampValue) Get() interface{} {
return time.Time(v)
}
// valueType returns the EventStream header value type value.
func (TimestampValue) valueType() valueType {
return timestampValueType
}
func (v TimestampValue) epochMilli() int64 {
nano := time.Time(v).UnixNano()
msec := nano / int64(time.Millisecond)
return msec
}
func (v TimestampValue) String() string {
msec := v.epochMilli()
return strconv.FormatInt(msec, 10)
}
// encode encodes the TimestampValue into an eventstream binary value
// representation.
func (v TimestampValue) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
msec := v.epochMilli()
return raw.encodeScalar(w, msec)
}
func (v *TimestampValue) decode(r io.Reader) error {
n, err := decodeUint64(r)
if err != nil {
return err
}
*v = TimestampValue(timeFromEpochMilli(int64(n)))
return nil
}
// MarshalJSON implements the json.Marshaler interface
func (v TimestampValue) MarshalJSON() ([]byte, error) {
return []byte(v.String()), nil
}
func timeFromEpochMilli(t int64) time.Time {
secs := t / 1e3
msec := t % 1e3
return time.Unix(secs, msec*int64(time.Millisecond)).UTC()
}
// An UUIDValue provides eventstream encoding, and representation of a UUID
// value.
type UUIDValue [16]byte
// Get returns the underlying value.
func (v UUIDValue) Get() interface{} {
return v[:]
}
// valueType returns the EventStream header value type value.
func (UUIDValue) valueType() valueType {
return uuidValueType
}
func (v UUIDValue) String() string {
var scratch [36]byte
const dash = '-'
hex.Encode(scratch[:8], v[0:4])
scratch[8] = dash
hex.Encode(scratch[9:13], v[4:6])
scratch[13] = dash
hex.Encode(scratch[14:18], v[6:8])
scratch[18] = dash
hex.Encode(scratch[19:23], v[8:10])
scratch[23] = dash
hex.Encode(scratch[24:], v[10:])
return string(scratch[:])
}
// encode encodes the UUIDValue into an eventstream binary value
// representation.
func (v UUIDValue) encode(w io.Writer) error {
raw := rawValue{
Type: v.valueType(),
}
return raw.encodeFixedSlice(w, v[:])
}
func (v *UUIDValue) decode(r io.Reader) error {
tv := (*v)[:]
return decodeFixedBytesValue(r, tv)
}

View file

@ -0,0 +1,117 @@
package eventstream
import (
"bytes"
"encoding/binary"
"hash/crc32"
)
const preludeLen = 8
const preludeCRCLen = 4
const msgCRCLen = 4
const minMsgLen = preludeLen + preludeCRCLen + msgCRCLen
const maxPayloadLen = 1024 * 1024 * 16 // 16MB
const maxHeadersLen = 1024 * 128 // 128KB
const maxMsgLen = minMsgLen + maxHeadersLen + maxPayloadLen
var crc32IEEETable = crc32.MakeTable(crc32.IEEE)
// A Message provides the eventstream message representation.
type Message struct {
Headers Headers
Payload []byte
}
func (m *Message) rawMessage() (rawMessage, error) {
var raw rawMessage
if len(m.Headers) > 0 {
var headers bytes.Buffer
if err := EncodeHeaders(&headers, m.Headers); err != nil {
return rawMessage{}, err
}
raw.Headers = headers.Bytes()
raw.HeadersLen = uint32(len(raw.Headers))
}
raw.Length = raw.HeadersLen + uint32(len(m.Payload)) + minMsgLen
hash := crc32.New(crc32IEEETable)
binaryWriteFields(hash, binary.BigEndian, raw.Length, raw.HeadersLen)
raw.PreludeCRC = hash.Sum32()
binaryWriteFields(hash, binary.BigEndian, raw.PreludeCRC)
if raw.HeadersLen > 0 {
hash.Write(raw.Headers)
}
// Read payload bytes and update hash for it as well.
if len(m.Payload) > 0 {
raw.Payload = m.Payload
hash.Write(raw.Payload)
}
raw.CRC = hash.Sum32()
return raw, nil
}
// Clone returns a deep copy of the message.
func (m Message) Clone() Message {
var payload []byte
if m.Payload != nil {
payload = make([]byte, len(m.Payload))
copy(payload, m.Payload)
}
return Message{
Headers: m.Headers.Clone(),
Payload: payload,
}
}
type messagePrelude struct {
Length uint32
HeadersLen uint32
PreludeCRC uint32
}
func (p messagePrelude) PayloadLen() uint32 {
return p.Length - p.HeadersLen - minMsgLen
}
func (p messagePrelude) ValidateLens() error {
if p.Length == 0 || p.Length > maxMsgLen {
return LengthError{
Part: "message prelude",
Want: maxMsgLen,
Have: int(p.Length),
}
}
if p.HeadersLen > maxHeadersLen {
return LengthError{
Part: "message headers",
Want: maxHeadersLen,
Have: int(p.HeadersLen),
}
}
if payloadLen := p.PayloadLen(); payloadLen > maxPayloadLen {
return LengthError{
Part: "message payload",
Want: maxPayloadLen,
Have: int(payloadLen),
}
}
return nil
}
type rawMessage struct {
messagePrelude
Headers []byte
Payload []byte
CRC uint32
}

View file

@ -1,3 +1,266 @@
# v1.32.0 (2024-02-06)
* **Feature**: This release adds a new field, logGroupArn, to the response of the logs:DescribeLogGroups action.
# v1.31.0 (2024-01-10)
* **Feature**: Add support for account level subscription filter policies to PutAccountPolicy, DescribeAccountPolicies, and DeleteAccountPolicy APIs. Additionally, PutAccountPolicy has been modified with new optional "selectionCriteria" parameter for resource selection.
# v1.30.2 (2024-01-04)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.30.1 (2023-12-20)
* No change notes available for this release.
# v1.30.0 (2023-12-12)
* **Feature**: This release introduces the StartLiveTail API to tail ingested logs in near real time.
# v1.29.5 (2023-12-08)
* **Bug Fix**: Reinstate presence of default Retryer in functional options, but still respect max attempts set therein.
# v1.29.4 (2023-12-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.29.3 (2023-12-06)
* **Bug Fix**: Restore pre-refactor auth behavior where all operations could technically be performed anonymously.
# v1.29.2 (2023-12-01)
* **Bug Fix**: Correct wrapping of errors in authentication workflow.
* **Bug Fix**: Correctly recognize cache-wrapped instances of AnonymousCredentials at client construction.
* **Dependency Update**: Updated to the latest SDK module versions
# v1.29.1 (2023-11-30)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.29.0 (2023-11-29)
* **Feature**: Expose Options() accessor on service clients.
* **Dependency Update**: Updated to the latest SDK module versions
# v1.28.2 (2023-11-28.2)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.28.1 (2023-11-28)
* **Bug Fix**: Respect setting RetryMaxAttempts in functional options at client construction.
# v1.28.0 (2023-11-27)
* **Feature**: Added APIs to Create, Update, Get, List and Delete LogAnomalyDetectors and List and Update Anomalies in Detector. Added LogGroupClass attribute for LogGroups to classify loggroup as Standard loggroup with all capabilities or InfrequentAccess loggroup with limited capabilities.
# v1.27.2 (2023-11-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.27.1 (2023-11-15)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.27.0 (2023-11-09.2)
* **Feature**: Update to support new APIs for delivery of logs from AWS services.
# v1.26.1 (2023-11-09)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.26.0 (2023-11-01)
* **Feature**: Adds support for configured endpoints via environment variables and the AWS shared configuration file.
* **Dependency Update**: Updated to the latest SDK module versions
# v1.25.0 (2023-10-31)
* **Feature**: **BREAKING CHANGE**: Bump minimum go version to 1.19 per the revised [go version support policy](https://aws.amazon.com/blogs/developer/aws-sdk-for-go-aligns-with-go-release-policy-on-supported-runtimes/).
* **Dependency Update**: Updated to the latest SDK module versions
# v1.24.2 (2023-10-12)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.24.1 (2023-10-06)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.24.0 (2023-09-20)
* **Feature**: Add ClientToken to QueryDefinition CFN Handler in CWL
# v1.23.5 (2023-08-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.23.4 (2023-08-18)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.23.3 (2023-08-17)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.23.2 (2023-08-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.23.1 (2023-08-01)
* No change notes available for this release.
# v1.23.0 (2023-07-31)
* **Feature**: Adds support for smithy-modeled endpoint resolution. A new rules-based endpoint resolution will be added to the SDK which will supercede and deprecate existing endpoint resolution. Specifically, EndpointResolver will be deprecated while BaseEndpoint and EndpointResolverV2 will take its place. For more information, please see the Endpoints section in our Developer Guide.
* **Dependency Update**: Updated to the latest SDK module versions
# v1.22.2 (2023-07-28)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.22.1 (2023-07-13)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.22.0 (2023-07-07)
* **Feature**: Add CMK encryption support for CloudWatch Logs Insights query result data
# v1.21.2 (2023-06-15)
* No change notes available for this release.
# v1.21.1 (2023-06-13)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.21.0 (2023-06-07)
* **Feature**: This change adds support for account level data protection policies using 3 new APIs, PutAccountPolicy, DeleteAccountPolicy and DescribeAccountPolicy. DescribeLogGroup API has been modified to indicate if account level policy is applied to the LogGroup via "inheritedProperties" list in the response.
# v1.20.11 (2023-05-04)
* No change notes available for this release.
# v1.20.10 (2023-04-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.9 (2023-04-10)
* No change notes available for this release.
# v1.20.8 (2023-04-07)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.7 (2023-03-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.6 (2023-03-10)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.5 (2023-02-22)
* **Bug Fix**: Prevent nil pointer dereference when retrieving error codes.
# v1.20.4 (2023-02-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.3 (2023-02-15)
* **Announcement**: When receiving an error response in restJson-based services, an incorrect error type may have been returned based on the content of the response. This has been fixed via PR #2012 tracked in issue #1910.
* **Bug Fix**: Correct error type parsing for restJson services.
# v1.20.2 (2023-02-03)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.20.1 (2023-01-23)
* No change notes available for this release.
# v1.20.0 (2023-01-19)
* **Feature**: Bug fix - Removed the regex pattern validation from CoralModel to avoid potential security issue.
# v1.19.0 (2023-01-12)
* **Feature**: Bug fix: logGroupName is now not a required field in GetLogEvents, FilterLogEvents, GetLogGroupFields, and DescribeLogStreams APIs as logGroupIdentifier can be provided instead
# v1.18.0 (2023-01-05)
* **Feature**: Add `ErrorCodeOverride` field to all error structs (aws/smithy-go#401).
# v1.17.4 (2023-01-04)
* **Documentation**: Update to remove sequenceToken as a required field in PutLogEvents calls.
# v1.17.3 (2022-12-15)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.2 (2022-12-09)
* **Documentation**: Doc-only update for CloudWatch Logs, for Tagging Permissions clarifications
# v1.17.1 (2022-12-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.17.0 (2022-11-28)
* **Feature**: Updates to support CloudWatch Logs data protection and CloudWatch cross-account observability
# v1.16.4 (2022-11-22)
* No change notes available for this release.
# v1.16.3 (2022-11-16)
* No change notes available for this release.
# v1.16.2 (2022-11-10)
* No change notes available for this release.
# v1.16.1 (2022-11-04)
* **Documentation**: Doc-only update for bug fixes and support of export to buckets encrypted with SSE-KMS
# v1.16.0 (2022-10-31)
* **Feature**: SDK release to support tagging for destinations and log groups with TagResource. Also supports tag on create with PutDestination.
# v1.15.22 (2022-10-24)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.21 (2022-10-21)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.20 (2022-09-20)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.19 (2022-09-14)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.18 (2022-09-02)
* **Dependency Update**: Updated to the latest SDK module versions
# v1.15.17 (2022-08-31)
* **Dependency Update**: Updated to the latest SDK module versions

View file

@ -4,17 +4,22 @@ package cloudwatchlogs
import (
"context"
cryptorand "crypto/rand"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/defaults"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
internalauth "github.com/aws/aws-sdk-go-v2/internal/auth"
internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
smithy "github.com/aws/smithy-go"
smithydocument "github.com/aws/smithy-go/document"
"github.com/aws/smithy-go/logging"
"github.com/aws/smithy-go/middleware"
smithyrand "github.com/aws/smithy-go/rand"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net"
"net/http"
@ -46,12 +51,24 @@ func New(options Options, optFns ...func(*Options)) *Client {
resolveHTTPSignerV4(&options)
resolveDefaultEndpointConfiguration(&options)
resolveIdempotencyTokenProvider(&options)
resolveEndpointResolverV2(&options)
resolveAuthSchemeResolver(&options)
for _, fn := range optFns {
fn(&options)
}
finalizeRetryMaxAttempts(&options)
ignoreAnonymousAuth(&options)
wrapWithAnonymousAuth(&options)
resolveAuthSchemes(&options)
client := &Client{
options: options,
}
@ -59,115 +76,27 @@ func New(options Options, optFns ...func(*Options)) *Client {
return client
}
type Options struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// Configures the events that will be sent to the configured logger.
ClientLogMode aws.ClientLogMode
// The credentials object to use when signing requests.
Credentials aws.CredentialsProvider
// The configuration DefaultsMode that the SDK should use when constructing the
// clients initial default settings.
DefaultsMode aws.DefaultsMode
// The endpoint options to be used when attempting to resolve an endpoint.
EndpointOptions EndpointResolverOptions
// The service endpoint resolver.
EndpointResolver EndpointResolver
// Signature Version 4 (SigV4) Signer
HTTPSignerV4 HTTPSignerV4
// The logger writer interface to write logging messages to.
Logger logging.Logger
// The region to send requests to. (Required)
Region string
// RetryMaxAttempts specifies the maximum number attempts an API client will call
// an operation that fails with a retryable error. A value of 0 is ignored, and
// will not be used to configure the API client created default retryer, or modify
// per operation call's retry max attempts. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. If specified in an operation call's functional
// options with a value that is different than the constructed client's Options,
// the Client's Retryer will be wrapped to use the operation's specific
// RetryMaxAttempts value.
RetryMaxAttempts int
// RetryMode specifies the retry mode the API client will be created with, if
// Retryer option is not also specified. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. Currently does not support per operation call
// overrides, may in the future.
RetryMode aws.RetryMode
// Retryer guides how HTTP requests should be retried in case of recoverable
// failures. When nil the API client will use a default retryer. The kind of
// default retry created by the API client can be changed with the RetryMode
// option.
Retryer aws.Retryer
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You
// should not populate this structure programmatically, or rely on the values here
// within your applications.
RuntimeEnvironment aws.RuntimeEnvironment
// The initial DefaultsMode used when the client options were constructed. If the
// DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
// value was at that point in time. Currently does not support per operation call
// overrides, may in the future.
resolvedDefaultsMode aws.DefaultsMode
// The HTTP client to invoke API calls with. Defaults to client's default HTTP
// implementation if nil.
HTTPClient HTTPClient
// Options returns a copy of the client configuration.
//
// Callers SHOULD NOT perform mutations on any inner structures within client
// config. Config overrides should instead be made on a per-operation basis through
// functional options.
func (c *Client) Options() Options {
return c.options.Copy()
}
// WithAPIOptions returns a functional option for setting the Client's APIOptions
// option.
func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
return func(o *Options) {
o.APIOptions = append(o.APIOptions, optFns...)
}
}
// WithEndpointResolver returns a functional option for setting the Client's
// EndpointResolver option.
func WithEndpointResolver(v EndpointResolver) func(*Options) {
return func(o *Options) {
o.EndpointResolver = v
}
}
type HTTPClient interface {
Do(*http.Request) (*http.Response, error)
}
// Copy creates a clone where the APIOptions list is deep copied.
func (o Options) Copy() Options {
to := o
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
copy(to.APIOptions, o.APIOptions)
return to
}
func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) {
ctx = middleware.ClearStackValues(ctx)
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
finalizeRetryMaxAttemptOptions(&options, *c)
setSafeEventStreamClientLogMode(&options, opID)
finalizeOperationRetryMaxAttempts(&options, *c)
finalizeClientEndpointResolverOptions(&options)
@ -195,8 +124,89 @@ func (c *Client) invokeOperation(ctx context.Context, opID string, params interf
return result, metadata, err
}
type operationInputKey struct{}
func setOperationInput(ctx context.Context, input interface{}) context.Context {
return middleware.WithStackValue(ctx, operationInputKey{}, input)
}
func getOperationInput(ctx context.Context) interface{} {
return middleware.GetStackValue(ctx, operationInputKey{})
}
type setOperationInputMiddleware struct {
}
func (*setOperationInputMiddleware) ID() string {
return "setOperationInput"
}
func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
ctx = setOperationInput(ctx, in.Parameters)
return next.HandleSerialize(ctx, in)
}
func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error {
if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil {
return fmt.Errorf("add ResolveAuthScheme: %w", err)
}
if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil {
return fmt.Errorf("add GetIdentity: %v", err)
}
if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil {
return fmt.Errorf("add ResolveEndpointV2: %v", err)
}
if err := stack.Finalize.Insert(&signRequestMiddleware{}, "ResolveEndpointV2", middleware.After); err != nil {
return fmt.Errorf("add Signing: %w", err)
}
return nil
}
func resolveAuthSchemeResolver(options *Options) {
if options.AuthSchemeResolver == nil {
options.AuthSchemeResolver = &defaultAuthSchemeResolver{}
}
}
func resolveAuthSchemes(options *Options) {
if options.AuthSchemes == nil {
options.AuthSchemes = []smithyhttp.AuthScheme{
internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{
Signer: options.HTTPSignerV4,
Logger: options.Logger,
LogSigning: options.ClientLogMode.IsSigning(),
}),
}
}
}
type noSmithyDocumentSerde = smithydocument.NoSerde
type legacyEndpointContextSetter struct {
LegacyResolver EndpointResolver
}
func (*legacyEndpointContextSetter) ID() string {
return "legacyEndpointContextSetter"
}
func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.LegacyResolver != nil {
ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true)
}
return next.HandleInitialize(ctx, in)
}
func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error {
return stack.Initialize.Add(&legacyEndpointContextSetter{
LegacyResolver: o.EndpointResolver,
}, middleware.Before)
}
func resolveDefaultLogger(o *Options) {
if o.Logger != nil {
return
@ -234,6 +244,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
APIOptions: cfg.APIOptions,
Logger: cfg.Logger,
ClientLogMode: cfg.ClientLogMode,
AppID: cfg.AppID,
}
resolveAWSRetryerProvider(cfg, &opts)
resolveAWSRetryMaxAttempts(cfg, &opts)
@ -241,6 +252,7 @@ func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
resolveAWSEndpointResolver(cfg, &opts)
resolveUseDualStackEndpoint(cfg, &opts)
resolveUseFIPSEndpoint(cfg, &opts)
resolveBaseEndpoint(cfg, &opts)
return New(opts, optFns...)
}
@ -332,7 +344,15 @@ func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
o.RetryMaxAttempts = cfg.RetryMaxAttempts
}
func finalizeRetryMaxAttemptOptions(o *Options, client Client) {
func finalizeRetryMaxAttempts(o *Options) {
if o.RetryMaxAttempts == 0 {
return
}
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
}
func finalizeOperationRetryMaxAttempts(o *Options, client Client) {
if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
return
}
@ -344,20 +364,19 @@ func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
return
}
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver())
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions)
}
func addClientUserAgent(stack *middleware.Stack) error {
return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "cloudwatchlogs", goModuleVersion)(stack)
}
func addClientUserAgent(stack *middleware.Stack, options Options) error {
if err := awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "cloudwatchlogs", goModuleVersion)(stack); err != nil {
return err
}
func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error {
mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{
CredentialsProvider: o.Credentials,
Signer: o.HTTPSignerV4,
LogSigning: o.ClientLogMode.IsSigning(),
})
return stack.Finalize.Add(mw, middleware.After)
if len(options.AppID) > 0 {
return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack)
}
return nil
}
type HTTPSignerV4 interface {
@ -378,6 +397,13 @@ func newDefaultV4Signer(o Options) *v4.Signer {
})
}
func resolveIdempotencyTokenProvider(o *Options) {
if o.IdempotencyTokenProvider != nil {
return
}
o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader)
}
func addRetryMiddlewares(stack *middleware.Stack, o Options) error {
mo := retry.AddRetryMiddlewaresOptions{
Retryer: o.Retryer,
@ -416,6 +442,11 @@ func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
return nil
}
// IdempotencyTokenProvider interface for providing idempotency token
type IdempotencyTokenProvider interface {
GetIdempotencyToken() (string, error)
}
func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
return awsmiddleware.AddRequestIDRetrieverMiddleware(stack)
}
@ -432,3 +463,32 @@ func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
}, middleware.After)
}
type disableHTTPSMiddleware struct {
DisableHTTPS bool
}
func (*disableHTTPSMiddleware) ID() string {
return "disableHTTPS"
}
func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) {
req.URL.Scheme = "http"
}
return next.HandleFinalize(ctx, in)
}
func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error {
return stack.Finalize.Insert(&disableHTTPSMiddleware{
DisableHTTPS: o.EndpointOptions.DisableHTTPS,
}, "ResolveEndpointV2", middleware.After)
}

View file

@ -4,25 +4,48 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Associates the specified Key Management Service customer master key (CMK) with
// the specified log group. Associating an KMS CMK with a log group overrides any
// existing associations between the log group and a CMK. After a CMK is associated
// with a log group, all newly ingested data for the log group is encrypted using
// the CMK. This association is stored as long as the data encrypted with the CMK
// is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt this
// data whenever it is requested. CloudWatch Logs supports only symmetric CMKs. Do
// not use an associate an asymmetric CMK with your log group. For more
// information, see Using Symmetric and Asymmetric Keys
// (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html).
// It can take up to 5 minutes for this operation to take effect. If you attempt to
// associate a CMK with a log group but the CMK does not exist or the CMK is
// disabled, you receive an InvalidParameterException error.
// Associates the specified KMS key with either one log group in the account, or
// with all stored CloudWatch Logs query insights results in the account. When you
// use AssociateKmsKey , you specify either the logGroupName parameter or the
// resourceIdentifier parameter. You can't specify both of those parameters in the
// same operation.
// - Specify the logGroupName parameter to cause all log events stored in the log
// group to be encrypted with that key. Only the log events ingested after the key
// is associated are encrypted with that key. Associating a KMS key with a log
// group overrides any existing associations between the log group and a KMS key.
// After a KMS key is associated with a log group, all newly ingested data for the
// log group is encrypted using the KMS key. This association is stored as long as
// the data encrypted with the KMS key is still within CloudWatch Logs. This
// enables CloudWatch Logs to decrypt this data whenever it is requested.
// Associating a key with a log group does not cause the results of queries of that
// log group to be encrypted with that key. To have query results encrypted with a
// KMS key, you must use an AssociateKmsKey operation with the resourceIdentifier
// parameter that specifies a query-result resource.
// - Specify the resourceIdentifier parameter with a query-result resource, to
// use that key to encrypt the stored results of all future StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// operations in the account. The response from a GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html)
// operation will still return the query results in plain text. Even if you have
// not associated a key with your query results, the query results are encrypted
// when stored, using the default CloudWatch Logs method. If you run a query from a
// monitoring account that queries logs in a source account, the query results key
// from the monitoring account, if any, is used.
//
// If you delete the key that is used to encrypt log events or log group query
// results, then all the associated stored log events or query results that were
// encrypted with that key will be unencryptable and unusable. CloudWatch Logs
// supports only symmetric KMS keys. Do not use an associate an asymmetric KMS key
// with your log group or query results. For more information, see Using Symmetric
// and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html)
// . It can take up to 5 minutes for this operation to take effect. If you attempt
// to associate a KMS key with a log group but the KMS key does not exist or the
// KMS key is disabled, you receive an InvalidParameterException error.
func (c *Client) AssociateKmsKey(ctx context.Context, params *AssociateKmsKeyInput, optFns ...func(*Options)) (*AssociateKmsKeyOutput, error) {
if params == nil {
params = &AssociateKmsKeyInput{}
@ -40,21 +63,35 @@ func (c *Client) AssociateKmsKey(ctx context.Context, params *AssociateKmsKeyInp
type AssociateKmsKeyInput struct {
// The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. This
// must be a symmetric CMK. For more information, see Amazon Resource Names - Key
// Management Service
// (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms)
// and Using Symmetric and Asymmetric Keys
// (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html).
// The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data.
// This must be a symmetric KMS key. For more information, see Amazon Resource
// Names (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms)
// and Using Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html)
// .
//
// This member is required.
KmsKeyId *string
// The name of the log group.
//
// This member is required.
// The name of the log group. In your AssociateKmsKey operation, you must specify
// either the resourceIdentifier parameter or the logGroup parameter, but you
// can't specify both.
LogGroupName *string
// Specifies the target for this operation. You must specify one of the following:
// - Specify the following ARN to have future GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html)
// operations in this account encrypt the results with the specified KMS key.
// Replace REGION and ACCOUNT_ID with your Region and account ID.
// arn:aws:logs:REGION:ACCOUNT_ID:query-result:*
// - Specify the ARN of a log group to have CloudWatch Logs use the KMS key to
// encrypt log events that are ingested and stored by that log group. The log group
// ARN must be in the following format. Replace REGION and ACCOUNT_ID with your
// Region and account ID.
// arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME
// In your AssociateKmsKey operation, you must specify either the
// resourceIdentifier parameter or the logGroup parameter, but you can't specify
// both.
ResourceIdentifier *string
noSmithyDocumentSerde
}
@ -66,6 +103,9 @@ type AssociateKmsKeyOutput struct {
}
func (c *Client) addOperationAssociateKmsKeyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAssociateKmsKey{}, middleware.After)
if err != nil {
return err
@ -74,6 +114,13 @@ func (c *Client) addOperationAssociateKmsKeyMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "AssociateKmsKey"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -92,16 +139,13 @@ func (c *Client) addOperationAssociateKmsKeyMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -110,12 +154,18 @@ func (c *Client) addOperationAssociateKmsKeyMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpAssociateKmsKeyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateKmsKey(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -125,6 +175,9 @@ func (c *Client) addOperationAssociateKmsKeyMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -132,7 +185,6 @@ func newServiceMetadataMiddleware_opAssociateKmsKey(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "AssociateKmsKey",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -45,6 +46,9 @@ type CancelExportTaskOutput struct {
}
func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCancelExportTask{}, middleware.After)
if err != nil {
return err
@ -53,6 +57,13 @@ func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CancelExportTask"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -71,16 +82,13 @@ func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -89,12 +97,18 @@ func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCancelExportTaskValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelExportTask(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -104,6 +118,9 @@ func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -111,7 +128,6 @@ func newServiceMetadataMiddleware_opCancelExportTask(region string) *awsmiddlewa
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "CancelExportTask",
}
}

View file

@ -0,0 +1,174 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a delivery. A delivery is a connection between a logical delivery
// source and a logical delivery destination that you have already created. Only
// some Amazon Web Services services support being configured as a delivery source
// using this operation. These services are listed as Supported [V2 Permissions] in
// the table at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
// A delivery destination can represent a log group in CloudWatch Logs, an Amazon
// S3 bucket, or a delivery stream in Kinesis Data Firehose. To configure logs
// delivery between a supported Amazon Web Services service and a destination, you
// must do the following:
// - Create a delivery source, which is a logical object that represents the
// resource that is actually sending the logs. For more information, see
// PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)
// .
// - Create a delivery destination, which is a logical object that represents
// the actual delivery destination. For more information, see
// PutDeliveryDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)
// .
// - If you are delivering logs cross-account, you must use
// PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)
// in the destination account to assign an IAM policy to the destination. This
// policy allows delivery to that destination.
// - Use CreateDelivery to create a delivery by pairing exactly one delivery
// source and one delivery destination.
//
// You can configure a single delivery source to send logs to multiple
// destinations by creating multiple deliveries. You can also create multiple
// deliveries to configure multiple delivery sources to send logs to the same
// delivery destination. You can't update an existing delivery. You can only create
// and delete deliveries.
func (c *Client) CreateDelivery(ctx context.Context, params *CreateDeliveryInput, optFns ...func(*Options)) (*CreateDeliveryOutput, error) {
if params == nil {
params = &CreateDeliveryInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDelivery", params, optFns, c.addOperationCreateDeliveryMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDeliveryOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDeliveryInput struct {
// The ARN of the delivery destination to use for this delivery.
//
// This member is required.
DeliveryDestinationArn *string
// The name of the delivery source to use for this delivery.
//
// This member is required.
DeliverySourceName *string
// An optional list of key-value pairs to associate with the resource. For more
// information about tagging, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
Tags map[string]string
noSmithyDocumentSerde
}
type CreateDeliveryOutput struct {
// A structure that contains information about the delivery that you just created.
Delivery *types.Delivery
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDeliveryMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateDelivery{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateDelivery{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateDelivery"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateDeliveryValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDelivery(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateDelivery(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateDelivery",
}
}

View file

@ -4,32 +4,31 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an export task, which allows you to efficiently export data from a log
// group to an Amazon S3 bucket. When you perform a CreateExportTask operation, you
// must use credentials that have permission to write to the S3 bucket that you
// specify as the destination. Exporting log data to Amazon S3 buckets that are
// encrypted by KMS is not supported. Exporting log data to Amazon S3 buckets that
// have S3 Object Lock enabled with a retention period is not supported. Exporting
// to S3 buckets that are encrypted with AES-256 is supported. This is an
// asynchronous call. If all the required information is provided, this operation
// initiates an export task and responds with the ID of the task. After the task
// has started, you can use DescribeExportTasks
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html)
// to get the status of the export task. Each account can only have one active
// (RUNNING or PENDING) export task at a time. To cancel an export task, use
// CancelExportTask
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CancelExportTask.html).
// You can export logs from multiple log groups or multiple time ranges to the same
// S3 bucket. To separate out log data for each export task, you can specify a
// prefix to be used as the Amazon S3 key prefix for all exported objects.
// Time-based sorting on chunks of log data inside an exported file is not
// guaranteed. You can sort the exported log fild data by using Linux utilities.
// Creates an export task so that you can efficiently export data from a log group
// to an Amazon S3 bucket. When you perform a CreateExportTask operation, you must
// use credentials that have permission to write to the S3 bucket that you specify
// as the destination. Exporting log data to S3 buckets that are encrypted by KMS
// is supported. Exporting log data to Amazon S3 buckets that have S3 Object Lock
// enabled with a retention period is also supported. Exporting to S3 buckets that
// are encrypted with AES-256 is supported. This is an asynchronous call. If all
// the required information is provided, this operation initiates an export task
// and responds with the ID of the task. After the task has started, you can use
// DescribeExportTasks (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html)
// to get the status of the export task. Each account can only have one active (
// RUNNING or PENDING ) export task at a time. To cancel an export task, use
// CancelExportTask (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CancelExportTask.html)
// . You can export logs from multiple log groups or multiple time ranges to the
// same S3 bucket. To separate log data for each export task, specify a prefix to
// be used as the Amazon S3 key prefix for all exported objects. Time-based sorting
// on chunks of log data inside an exported file is not guaranteed. You can sort
// the exported log field data by using Linux utilities.
func (c *Client) CreateExportTask(ctx context.Context, params *CreateExportTaskInput, optFns ...func(*Options)) (*CreateExportTaskOutput, error) {
if params == nil {
params = &CreateExportTaskInput{}
@ -48,13 +47,13 @@ func (c *Client) CreateExportTask(ctx context.Context, params *CreateExportTaskI
type CreateExportTaskInput struct {
// The name of S3 bucket for the exported log data. The bucket must be in the same
// Amazon Web Services region.
// Amazon Web Services Region.
//
// This member is required.
Destination *string
// The start time of the range for the request, expressed as the number of
// milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier
// milliseconds after Jan 1, 1970 00:00:00 UTC . Events with a timestamp earlier
// than this time are not exported.
//
// This member is required.
@ -66,14 +65,15 @@ type CreateExportTaskInput struct {
LogGroupName *string
// The end time of the range for the request, expressed as the number of
// milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than
// this time are not exported.
// milliseconds after Jan 1, 1970 00:00:00 UTC . Events with a timestamp later than
// this time are not exported. You must specify a time that is not earlier than
// when this log group was created.
//
// This member is required.
To *int64
// The prefix used as the start of the key for every object exported. If you don't
// specify a value, the default is exportedlogs.
// specify a value, the default is exportedlogs .
DestinationPrefix *string
// Export only log streams that match the provided prefix. If you don't specify a
@ -98,6 +98,9 @@ type CreateExportTaskOutput struct {
}
func (c *Client) addOperationCreateExportTaskMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateExportTask{}, middleware.After)
if err != nil {
return err
@ -106,6 +109,13 @@ func (c *Client) addOperationCreateExportTaskMiddlewares(stack *middleware.Stack
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateExportTask"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -124,16 +134,13 @@ func (c *Client) addOperationCreateExportTaskMiddlewares(stack *middleware.Stack
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -142,12 +149,18 @@ func (c *Client) addOperationCreateExportTaskMiddlewares(stack *middleware.Stack
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateExportTaskValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateExportTask(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -157,6 +170,9 @@ func (c *Client) addOperationCreateExportTaskMiddlewares(stack *middleware.Stack
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -164,7 +180,6 @@ func newServiceMetadataMiddleware_opCreateExportTask(region string) *awsmiddlewa
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "CreateExportTask",
}
}

View file

@ -0,0 +1,193 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an anomaly detector that regularly scans one or more log groups and
// look for patterns and anomalies in the logs. An anomaly detector can help
// surface issues by automatically discovering anomalies in your log event traffic.
// An anomaly detector uses machine learning algorithms to scan log events and find
// patterns. A pattern is a shared text structure that recurs among your log
// fields. Patterns provide a useful tool for analyzing large sets of logs because
// a large number of log events can often be compressed into a few patterns. The
// anomaly detector uses pattern recognition to find anomalies , which are unusual
// log events. It uses the evaluationFrequency to compare current log events and
// patterns with trained baselines. Fields within a pattern are called tokens.
// Fields that vary within a pattern, such as a request ID or timestamp, are
// referred to as dynamic tokens and represented by <> . The following is an
// example of a pattern: [INFO] Request time: < > ms This pattern represents log
// events like [INFO] Request time: 327 ms and other similar log events that
// differ only by the number, in this csse 327. When the pattern is displayed, the
// different numbers are replaced by <*> Any parts of log events that are masked
// as sensitive data are not scanned for anomalies. For more information about
// masking sensitive data, see Help protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html)
// .
func (c *Client) CreateLogAnomalyDetector(ctx context.Context, params *CreateLogAnomalyDetectorInput, optFns ...func(*Options)) (*CreateLogAnomalyDetectorOutput, error) {
if params == nil {
params = &CreateLogAnomalyDetectorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateLogAnomalyDetector", params, optFns, c.addOperationCreateLogAnomalyDetectorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateLogAnomalyDetectorOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateLogAnomalyDetectorInput struct {
// An array containing the ARN of the log group that this anomaly detector will
// watch. You can specify only one log group ARN.
//
// This member is required.
LogGroupArnList []string
// The number of days to have visibility on an anomaly. After this time period has
// elapsed for an anomaly, it will be automatically baselined and the anomaly
// detector will treat new occurrences of a similar anomaly as normal. Therefore,
// if you do not correct the cause of an anomaly during the time period specified
// in anomalyVisibilityTime , it will be considered normal going forward and will
// not be detected as an anomaly.
AnomalyVisibilityTime *int64
// A name for this anomaly detector.
DetectorName *string
// Specifies how often the anomaly detector is to run and look for anomalies. Set
// this value according to the frequency that the log group receives new logs. For
// example, if the log group receives new log events every 10 minutes, then 15
// minutes might be a good setting for evaluationFrequency .
EvaluationFrequency types.EvaluationFrequency
// You can use this parameter to limit the anomaly detection model to examine only
// log events that match the pattern you specify here. For more information, see
// Filter and Pattern Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
// .
FilterPattern *string
// Optionally assigns a KMS key to secure this anomaly detector and its findings.
// If a key is assigned, the anomalies found and the model used by this detector
// are encrypted at rest with the key. If a key is assigned to an anomaly detector,
// a user must have permissions for both this key and for the anomaly detector to
// retrieve information about the anomalies that it finds. For more information
// about using a KMS key and to see the required IAM policy, see Use a KMS key
// with an anomaly detector (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/LogsAnomalyDetection-KMS.html)
// .
KmsKeyId *string
// An optional list of key-value pairs to associate with the resource. For more
// information about tagging, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
Tags map[string]string
noSmithyDocumentSerde
}
type CreateLogAnomalyDetectorOutput struct {
// The ARN of the log anomaly detector that you just created.
AnomalyDetectorArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateLogAnomalyDetectorMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateLogAnomalyDetector"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateLogAnomalyDetectorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLogAnomalyDetector(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateLogAnomalyDetector(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateLogAnomalyDetector",
}
}

View file

@ -4,39 +4,37 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a log group with the specified name. You can create up to 20,000 log
// groups per account. You must use the following guidelines when naming a log
// group:
// Creates a log group with the specified name. You can create up to 1,000,000 log
// groups per Region per account. You must use the following guidelines when naming
// a log group:
// - Log group names must be unique within a Region for an Amazon Web Services
// account.
// - Log group names can be between 1 and 512 characters long.
// - Log group names consist of the following characters: a-z, A-Z, 0-9, '_'
// (underscore), '-' (hyphen), '/' (forward slash), '.' (period), and '#' (number
// sign)
// - Log group names can't start with the string aws/
//
// * Log group names must be unique within a region for an Amazon Web
// Services account.
//
// * Log group names can be between 1 and 512 characters
// long.
//
// * Log group names consist of the following characters: a-z, A-Z, 0-9, '_'
// (underscore), '-' (hyphen), '/' (forward slash), '.' (period), and '#' (number
// sign)
//
// When you create a log group, by default the log events in the log group
// never expire. To set a retention policy so that events expire and are deleted
// after a specified time, use PutRetentionPolicy
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutRetentionPolicy.html).
// If you associate a Key Management Service customer master key (CMK) with the log
// group, ingested data is encrypted using the CMK. This association is stored as
// long as the data encrypted with the CMK is still within CloudWatch Logs. This
// enables CloudWatch Logs to decrypt this data whenever it is requested. If you
// attempt to associate a CMK with the log group but the CMK does not exist or the
// CMK is disabled, you receive an InvalidParameterException error. CloudWatch Logs
// supports only symmetric CMKs. Do not associate an asymmetric CMK with your log
// group. For more information, see Using Symmetric and Asymmetric Keys
// (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html).
// When you create a log group, by default the log events in the log group do not
// expire. To set a retention policy so that events expire and are deleted after a
// specified time, use PutRetentionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutRetentionPolicy.html)
// . If you associate an KMS key with the log group, ingested data is encrypted
// using the KMS key. This association is stored as long as the data encrypted with
// the KMS key is still within CloudWatch Logs. This enables CloudWatch Logs to
// decrypt this data whenever it is requested. If you attempt to associate a KMS
// key with the log group but the KMS key does not exist or the KMS key is
// disabled, you receive an InvalidParameterException error. CloudWatch Logs
// supports only symmetric KMS keys. Do not associate an asymmetric KMS key with
// your log group. For more information, see Using Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html)
// .
func (c *Client) CreateLogGroup(ctx context.Context, params *CreateLogGroupInput, optFns ...func(*Options)) (*CreateLogGroupOutput, error) {
if params == nil {
params = &CreateLogGroupInput{}
@ -54,22 +52,35 @@ func (c *Client) CreateLogGroup(ctx context.Context, params *CreateLogGroupInput
type CreateLogGroupInput struct {
// The name of the log group.
// A name for the log group.
//
// This member is required.
LogGroupName *string
// The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. For
// more information, see Amazon Resource Names - Key Management Service
// (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms).
// The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data.
// For more information, see Amazon Resource Names (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms)
// .
KmsKeyId *string
// The key-value pairs to use for the tags. CloudWatch Logs doesnt support IAM
// policies that prevent users from assigning specified tags to log groups using
// the aws:Resource/key-name or aws:TagKeys condition keys. For more information
// about using tags to control access, see Controlling access to Amazon Web
// Services resources using tags
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html).
// Use this parameter to specify the log group class for this log group. There are
// two classes:
// - The Standard log class supports all CloudWatch Logs features.
// - The Infrequent Access log class supports a subset of CloudWatch Logs
// features and incurs lower costs.
// If you omit this parameter, the default of STANDARD is used. The value of
// logGroupClass can't be changed after a log group is created. For details about
// the features supported by each class, see Log classes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html)
LogGroupClass types.LogGroupClass
// The key-value pairs to use for the tags. You can grant users access to certain
// log groups while preventing them from accessing other log groups. To do so, tag
// your groups and use IAM policies that refer to those tags. To assign tags when
// you create a log group, you must have either the logs:TagResource or
// logs:TagLogGroup permission. For more information about tagging, see Tagging
// Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
// . For more information about using tags to control access, see Controlling
// access to Amazon Web Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html)
// .
Tags map[string]string
noSmithyDocumentSerde
@ -83,6 +94,9 @@ type CreateLogGroupOutput struct {
}
func (c *Client) addOperationCreateLogGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLogGroup{}, middleware.After)
if err != nil {
return err
@ -91,6 +105,13 @@ func (c *Client) addOperationCreateLogGroupMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateLogGroup"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -109,16 +130,13 @@ func (c *Client) addOperationCreateLogGroupMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -127,12 +145,18 @@ func (c *Client) addOperationCreateLogGroupMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateLogGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLogGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -142,6 +166,9 @@ func (c *Client) addOperationCreateLogGroupMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -149,7 +176,6 @@ func newServiceMetadataMiddleware_opCreateLogGroup(region string) *awsmiddleware
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "CreateLogGroup",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -16,15 +17,9 @@ import (
// streams that you can create for a log group. There is a limit of 50 TPS on
// CreateLogStream operations, after which transactions are throttled. You must use
// the following guidelines when naming a log stream:
//
// * Log stream names must be
// unique within the log group.
//
// * Log stream names can be between 1 and 512
// characters long.
//
// * The ':' (colon) and '*' (asterisk) characters are not
// allowed.
// - Log stream names must be unique within the log group.
// - Log stream names can be between 1 and 512 characters long.
// - Don't use ':' (colon) or '*' (asterisk) characters.
func (c *Client) CreateLogStream(ctx context.Context, params *CreateLogStreamInput, optFns ...func(*Options)) (*CreateLogStreamOutput, error) {
if params == nil {
params = &CreateLogStreamInput{}
@ -63,6 +58,9 @@ type CreateLogStreamOutput struct {
}
func (c *Client) addOperationCreateLogStreamMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLogStream{}, middleware.After)
if err != nil {
return err
@ -71,6 +69,13 @@ func (c *Client) addOperationCreateLogStreamMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateLogStream"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -89,16 +94,13 @@ func (c *Client) addOperationCreateLogStreamMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -107,12 +109,18 @@ func (c *Client) addOperationCreateLogStreamMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateLogStreamValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLogStream(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -122,6 +130,9 @@ func (c *Client) addOperationCreateLogStreamMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -129,7 +140,6 @@ func newServiceMetadataMiddleware_opCreateLogStream(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "CreateLogStream",
}
}

View file

@ -0,0 +1,146 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a CloudWatch Logs account policy. This stops the policy from applying
// to all log groups or a subset of log groups in the account. Log-group level
// policies will still be in effect. To use this operation, you must be signed on
// with the correct permissions depending on the type of policy that you are
// deleting.
// - To delete a data protection policy, you must have the
// logs:DeleteDataProtectionPolicy and logs:DeleteAccountPolicy permissions.
// - To delete a subscription filter policy, you must have the
// logs:DeleteSubscriptionFilter and logs:DeleteAccountPolicy permissions.
func (c *Client) DeleteAccountPolicy(ctx context.Context, params *DeleteAccountPolicyInput, optFns ...func(*Options)) (*DeleteAccountPolicyOutput, error) {
if params == nil {
params = &DeleteAccountPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteAccountPolicy", params, optFns, c.addOperationDeleteAccountPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteAccountPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteAccountPolicyInput struct {
// The name of the policy to delete.
//
// This member is required.
PolicyName *string
// The type of policy to delete.
//
// This member is required.
PolicyType types.PolicyType
noSmithyDocumentSerde
}
type DeleteAccountPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteAccountPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteAccountPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteAccountPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAccountPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteAccountPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccountPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteAccountPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteAccountPolicy",
}
}

View file

@ -0,0 +1,135 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the data protection policy from the specified log group. For more
// information about data protection policies, see PutDataProtectionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html)
// .
func (c *Client) DeleteDataProtectionPolicy(ctx context.Context, params *DeleteDataProtectionPolicyInput, optFns ...func(*Options)) (*DeleteDataProtectionPolicyOutput, error) {
if params == nil {
params = &DeleteDataProtectionPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDataProtectionPolicy", params, optFns, c.addOperationDeleteDataProtectionPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDataProtectionPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDataProtectionPolicyInput struct {
// The name or ARN of the log group that you want to delete the data protection
// policy for.
//
// This member is required.
LogGroupIdentifier *string
noSmithyDocumentSerde
}
type DeleteDataProtectionPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDataProtectionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDataProtectionPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDataProtectionPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDataProtectionPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDataProtectionPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDataProtectionPolicy",
}
}

View file

@ -0,0 +1,137 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes s delivery. A delivery is a connection between a logical delivery
// source and a logical delivery destination. Deleting a delivery only deletes the
// connection between the delivery source and delivery destination. It does not
// delete the delivery destination or the delivery source.
func (c *Client) DeleteDelivery(ctx context.Context, params *DeleteDeliveryInput, optFns ...func(*Options)) (*DeleteDeliveryOutput, error) {
if params == nil {
params = &DeleteDeliveryInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDelivery", params, optFns, c.addOperationDeleteDeliveryMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDeliveryOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDeliveryInput struct {
// The unique ID of the delivery to delete. You can find the ID of a delivery with
// the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html)
// operation.
//
// This member is required.
Id *string
noSmithyDocumentSerde
}
type DeleteDeliveryOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDeliveryMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDelivery{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDelivery{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDelivery"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDeliveryValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDelivery(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDelivery(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDelivery",
}
}

View file

@ -0,0 +1,139 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a delivery destination. A delivery is a connection between a logical
// delivery source and a logical delivery destination. You can't delete a delivery
// destination if any current deliveries are associated with it. To find whether
// any deliveries are associated with this delivery destination, use the
// DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html)
// operation and check the deliveryDestinationArn field in the results.
func (c *Client) DeleteDeliveryDestination(ctx context.Context, params *DeleteDeliveryDestinationInput, optFns ...func(*Options)) (*DeleteDeliveryDestinationOutput, error) {
if params == nil {
params = &DeleteDeliveryDestinationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDeliveryDestination", params, optFns, c.addOperationDeleteDeliveryDestinationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDeliveryDestinationOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDeliveryDestinationInput struct {
// The name of the delivery destination that you want to delete. You can find a
// list of delivery destionation names by using the DescribeDeliveryDestinations (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveryDestinations.html)
// operation.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type DeleteDeliveryDestinationOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDeliveryDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDeliveryDestination"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDeliveryDestinationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDeliveryDestination(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDeliveryDestination(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDeliveryDestination",
}
}

View file

@ -0,0 +1,134 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a delivery destination policy. For more information about these
// policies, see PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)
// .
func (c *Client) DeleteDeliveryDestinationPolicy(ctx context.Context, params *DeleteDeliveryDestinationPolicyInput, optFns ...func(*Options)) (*DeleteDeliveryDestinationPolicyOutput, error) {
if params == nil {
params = &DeleteDeliveryDestinationPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDeliveryDestinationPolicy", params, optFns, c.addOperationDeleteDeliveryDestinationPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDeliveryDestinationPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDeliveryDestinationPolicyInput struct {
// The name of the delivery destination that you want to delete the policy for.
//
// This member is required.
DeliveryDestinationName *string
noSmithyDocumentSerde
}
type DeleteDeliveryDestinationPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDeliveryDestinationPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDeliveryDestinationPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDeliveryDestinationPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDeliveryDestinationPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDeliveryDestinationPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDeliveryDestinationPolicy",
}
}

View file

@ -0,0 +1,136 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a delivery source. A delivery is a connection between a logical
// delivery source and a logical delivery destination. You can't delete a delivery
// source if any current deliveries are associated with it. To find whether any
// deliveries are associated with this delivery source, use the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html)
// operation and check the deliverySourceName field in the results.
func (c *Client) DeleteDeliverySource(ctx context.Context, params *DeleteDeliverySourceInput, optFns ...func(*Options)) (*DeleteDeliverySourceOutput, error) {
if params == nil {
params = &DeleteDeliverySourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDeliverySource", params, optFns, c.addOperationDeleteDeliverySourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDeliverySourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDeliverySourceInput struct {
// The name of the delivery source that you want to delete.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type DeleteDeliverySourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDeliverySourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDeliverySource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDeliverySource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDeliverySource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDeliverySourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDeliverySource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDeliverySource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteDeliverySource",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -46,6 +47,9 @@ type DeleteDestinationOutput struct {
}
func (c *Client) addOperationDeleteDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDestination{}, middleware.After)
if err != nil {
return err
@ -54,6 +58,13 @@ func (c *Client) addOperationDeleteDestinationMiddlewares(stack *middleware.Stac
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteDestination"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -72,16 +83,13 @@ func (c *Client) addOperationDeleteDestinationMiddlewares(stack *middleware.Stac
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -90,12 +98,18 @@ func (c *Client) addOperationDeleteDestinationMiddlewares(stack *middleware.Stac
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDestinationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDestination(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -105,6 +119,9 @@ func (c *Client) addOperationDeleteDestinationMiddlewares(stack *middleware.Stac
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -112,7 +129,6 @@ func newServiceMetadataMiddleware_opDeleteDestination(region string) *awsmiddlew
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteDestination",
}
}

View file

@ -0,0 +1,134 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified CloudWatch Logs anomaly detector.
func (c *Client) DeleteLogAnomalyDetector(ctx context.Context, params *DeleteLogAnomalyDetectorInput, optFns ...func(*Options)) (*DeleteLogAnomalyDetectorOutput, error) {
if params == nil {
params = &DeleteLogAnomalyDetectorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteLogAnomalyDetector", params, optFns, c.addOperationDeleteLogAnomalyDetectorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteLogAnomalyDetectorOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteLogAnomalyDetectorInput struct {
// The ARN of the anomaly detector to delete. You can find the ARNs of log anomaly
// detectors in your account by using the ListLogAnomalyDetectors (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListLogAnomalyDetectors.html)
// operation.
//
// This member is required.
AnomalyDetectorArn *string
noSmithyDocumentSerde
}
type DeleteLogAnomalyDetectorOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteLogAnomalyDetectorMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteLogAnomalyDetector"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteLogAnomalyDetectorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteLogAnomalyDetector(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteLogAnomalyDetector(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DeleteLogAnomalyDetector",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -45,6 +46,9 @@ type DeleteLogGroupOutput struct {
}
func (c *Client) addOperationDeleteLogGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteLogGroup{}, middleware.After)
if err != nil {
return err
@ -53,6 +57,13 @@ func (c *Client) addOperationDeleteLogGroupMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteLogGroup"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -71,16 +82,13 @@ func (c *Client) addOperationDeleteLogGroupMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -89,12 +97,18 @@ func (c *Client) addOperationDeleteLogGroupMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteLogGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteLogGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -104,6 +118,9 @@ func (c *Client) addOperationDeleteLogGroupMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -111,7 +128,6 @@ func newServiceMetadataMiddleware_opDeleteLogGroup(region string) *awsmiddleware
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteLogGroup",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -50,6 +51,9 @@ type DeleteLogStreamOutput struct {
}
func (c *Client) addOperationDeleteLogStreamMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteLogStream{}, middleware.After)
if err != nil {
return err
@ -58,6 +62,13 @@ func (c *Client) addOperationDeleteLogStreamMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteLogStream"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -76,16 +87,13 @@ func (c *Client) addOperationDeleteLogStreamMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -94,12 +102,18 @@ func (c *Client) addOperationDeleteLogStreamMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteLogStreamValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteLogStream(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -109,6 +123,9 @@ func (c *Client) addOperationDeleteLogStreamMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -116,7 +133,6 @@ func newServiceMetadataMiddleware_opDeleteLogStream(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteLogStream",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -49,6 +50,9 @@ type DeleteMetricFilterOutput struct {
}
func (c *Client) addOperationDeleteMetricFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteMetricFilter{}, middleware.After)
if err != nil {
return err
@ -57,6 +61,13 @@ func (c *Client) addOperationDeleteMetricFilterMiddlewares(stack *middleware.Sta
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteMetricFilter"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -75,16 +86,13 @@ func (c *Client) addOperationDeleteMetricFilterMiddlewares(stack *middleware.Sta
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -93,12 +101,18 @@ func (c *Client) addOperationDeleteMetricFilterMiddlewares(stack *middleware.Sta
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteMetricFilterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteMetricFilter(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -108,6 +122,9 @@ func (c *Client) addOperationDeleteMetricFilterMiddlewares(stack *middleware.Sta
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -115,7 +132,6 @@ func newServiceMetadataMiddleware_opDeleteMetricFilter(region string) *awsmiddle
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteMetricFilter",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -32,8 +33,7 @@ func (c *Client) DeleteQueryDefinition(ctx context.Context, params *DeleteQueryD
type DeleteQueryDefinitionInput struct {
// The ID of the query definition that you want to delete. You can use
// DescribeQueryDefinitions
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html)
// DescribeQueryDefinitions (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html)
// to retrieve the IDs of your saved query definitions.
//
// This member is required.
@ -44,8 +44,8 @@ type DeleteQueryDefinitionInput struct {
type DeleteQueryDefinitionOutput struct {
// A value of TRUE indicates that the operation succeeded. FALSE indicates that the
// operation failed.
// A value of TRUE indicates that the operation succeeded. FALSE indicates that
// the operation failed.
Success bool
// Metadata pertaining to the operation's result.
@ -55,6 +55,9 @@ type DeleteQueryDefinitionOutput struct {
}
func (c *Client) addOperationDeleteQueryDefinitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteQueryDefinition{}, middleware.After)
if err != nil {
return err
@ -63,6 +66,13 @@ func (c *Client) addOperationDeleteQueryDefinitionMiddlewares(stack *middleware.
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteQueryDefinition"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -81,16 +91,13 @@ func (c *Client) addOperationDeleteQueryDefinitionMiddlewares(stack *middleware.
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -99,12 +106,18 @@ func (c *Client) addOperationDeleteQueryDefinitionMiddlewares(stack *middleware.
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteQueryDefinitionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteQueryDefinition(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -114,6 +127,9 @@ func (c *Client) addOperationDeleteQueryDefinitionMiddlewares(stack *middleware.
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -121,7 +137,6 @@ func newServiceMetadataMiddleware_opDeleteQueryDefinition(region string) *awsmid
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteQueryDefinition",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -43,6 +44,9 @@ type DeleteResourcePolicyOutput struct {
}
func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteResourcePolicy{}, middleware.After)
if err != nil {
return err
@ -51,6 +55,13 @@ func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.S
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteResourcePolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -69,16 +80,13 @@ func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.S
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -87,9 +95,15 @@ func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.S
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteResourcePolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -99,6 +113,9 @@ func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.S
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -106,7 +123,6 @@ func newServiceMetadataMiddleware_opDeleteResourcePolicy(region string) *awsmidd
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteResourcePolicy",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -45,6 +46,9 @@ type DeleteRetentionPolicyOutput struct {
}
func (c *Client) addOperationDeleteRetentionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteRetentionPolicy{}, middleware.After)
if err != nil {
return err
@ -53,6 +57,13 @@ func (c *Client) addOperationDeleteRetentionPolicyMiddlewares(stack *middleware.
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteRetentionPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -71,16 +82,13 @@ func (c *Client) addOperationDeleteRetentionPolicyMiddlewares(stack *middleware.
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -89,12 +97,18 @@ func (c *Client) addOperationDeleteRetentionPolicyMiddlewares(stack *middleware.
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteRetentionPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRetentionPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -104,6 +118,9 @@ func (c *Client) addOperationDeleteRetentionPolicyMiddlewares(stack *middleware.
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -111,7 +128,6 @@ func newServiceMetadataMiddleware_opDeleteRetentionPolicy(region string) *awsmid
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteRetentionPolicy",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -49,6 +50,9 @@ type DeleteSubscriptionFilterOutput struct {
}
func (c *Client) addOperationDeleteSubscriptionFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteSubscriptionFilter{}, middleware.After)
if err != nil {
return err
@ -57,6 +61,13 @@ func (c *Client) addOperationDeleteSubscriptionFilterMiddlewares(stack *middlewa
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteSubscriptionFilter"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -75,16 +86,13 @@ func (c *Client) addOperationDeleteSubscriptionFilterMiddlewares(stack *middlewa
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -93,12 +101,18 @@ func (c *Client) addOperationDeleteSubscriptionFilterMiddlewares(stack *middlewa
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteSubscriptionFilterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteSubscriptionFilter(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -108,6 +122,9 @@ func (c *Client) addOperationDeleteSubscriptionFilterMiddlewares(stack *middlewa
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -115,7 +132,6 @@ func newServiceMetadataMiddleware_opDeleteSubscriptionFilter(region string) *aws
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DeleteSubscriptionFilter",
}
}

View file

@ -0,0 +1,151 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of all CloudWatch Logs account policies in the account.
func (c *Client) DescribeAccountPolicies(ctx context.Context, params *DescribeAccountPoliciesInput, optFns ...func(*Options)) (*DescribeAccountPoliciesOutput, error) {
if params == nil {
params = &DescribeAccountPoliciesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeAccountPolicies", params, optFns, c.addOperationDescribeAccountPoliciesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeAccountPoliciesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeAccountPoliciesInput struct {
// Use this parameter to limit the returned policies to only the policies that
// match the policy type that you specify.
//
// This member is required.
PolicyType types.PolicyType
// If you are using an account that is set up as a monitoring account for
// CloudWatch unified cross-account observability, you can use this to specify the
// account ID of a source account. If you do, the operation returns the account
// policy for the specified account. Currently, you can specify only one account ID
// in this parameter. If you omit this parameter, only the policy in the current
// account is returned.
AccountIdentifiers []string
// Use this parameter to limit the returned policies to only the policy with the
// name that you specify.
PolicyName *string
noSmithyDocumentSerde
}
type DescribeAccountPoliciesOutput struct {
// An array of structures that contain information about the CloudWatch Logs
// account policies that match the specified filters.
AccountPolicies []types.AccountPolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeAccountPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeAccountPolicies{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeAccountPolicies{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeAccountPolicies"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeAccountPoliciesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAccountPolicies(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeAccountPolicies(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DescribeAccountPolicies",
}
}

View file

@ -0,0 +1,237 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves a list of the deliveries that have been created in the account. A
// delivery is a connection between a delivery source (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)
// and a delivery destination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)
// . A delivery source represents an Amazon Web Services resource that sends logs
// to an logs delivery destination. The destination can be CloudWatch Logs, Amazon
// S3, or Kinesis Data Firehose. Only some Amazon Web Services services support
// being configured as a delivery source. These services are listed in Enable
// logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
func (c *Client) DescribeDeliveries(ctx context.Context, params *DescribeDeliveriesInput, optFns ...func(*Options)) (*DescribeDeliveriesOutput, error) {
if params == nil {
params = &DescribeDeliveriesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDeliveries", params, optFns, c.addOperationDescribeDeliveriesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDeliveriesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDeliveriesInput struct {
// Optionally specify the maximum number of deliveries to return in the response.
Limit *int32
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
noSmithyDocumentSerde
}
type DescribeDeliveriesOutput struct {
// An array of structures. Each structure contains information about one delivery
// in the account.
Deliveries []types.Delivery
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDeliveriesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeDeliveries{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeDeliveries{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeDeliveries"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDeliveries(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// DescribeDeliveriesAPIClient is a client that implements the DescribeDeliveries
// operation.
type DescribeDeliveriesAPIClient interface {
DescribeDeliveries(context.Context, *DescribeDeliveriesInput, ...func(*Options)) (*DescribeDeliveriesOutput, error)
}
var _ DescribeDeliveriesAPIClient = (*Client)(nil)
// DescribeDeliveriesPaginatorOptions is the paginator options for
// DescribeDeliveries
type DescribeDeliveriesPaginatorOptions struct {
// Optionally specify the maximum number of deliveries to return in the response.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDeliveriesPaginator is a paginator for DescribeDeliveries
type DescribeDeliveriesPaginator struct {
options DescribeDeliveriesPaginatorOptions
client DescribeDeliveriesAPIClient
params *DescribeDeliveriesInput
nextToken *string
firstPage bool
}
// NewDescribeDeliveriesPaginator returns a new DescribeDeliveriesPaginator
func NewDescribeDeliveriesPaginator(client DescribeDeliveriesAPIClient, params *DescribeDeliveriesInput, optFns ...func(*DescribeDeliveriesPaginatorOptions)) *DescribeDeliveriesPaginator {
if params == nil {
params = &DescribeDeliveriesInput{}
}
options := DescribeDeliveriesPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDeliveriesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDeliveriesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDeliveries page.
func (p *DescribeDeliveriesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDeliveriesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.DescribeDeliveries(ctx, &params, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDeliveries(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DescribeDeliveries",
}
}

View file

@ -0,0 +1,235 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves a list of the delivery destinations that have been created in the
// account.
func (c *Client) DescribeDeliveryDestinations(ctx context.Context, params *DescribeDeliveryDestinationsInput, optFns ...func(*Options)) (*DescribeDeliveryDestinationsOutput, error) {
if params == nil {
params = &DescribeDeliveryDestinationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDeliveryDestinations", params, optFns, c.addOperationDescribeDeliveryDestinationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDeliveryDestinationsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDeliveryDestinationsInput struct {
// Optionally specify the maximum number of delivery destinations to return in the
// response.
Limit *int32
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
noSmithyDocumentSerde
}
type DescribeDeliveryDestinationsOutput struct {
// An array of structures. Each structure contains information about one delivery
// destination in the account.
DeliveryDestinations []types.DeliveryDestination
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDeliveryDestinationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeDeliveryDestinations{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeDeliveryDestinations{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeDeliveryDestinations"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDeliveryDestinations(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// DescribeDeliveryDestinationsAPIClient is a client that implements the
// DescribeDeliveryDestinations operation.
type DescribeDeliveryDestinationsAPIClient interface {
DescribeDeliveryDestinations(context.Context, *DescribeDeliveryDestinationsInput, ...func(*Options)) (*DescribeDeliveryDestinationsOutput, error)
}
var _ DescribeDeliveryDestinationsAPIClient = (*Client)(nil)
// DescribeDeliveryDestinationsPaginatorOptions is the paginator options for
// DescribeDeliveryDestinations
type DescribeDeliveryDestinationsPaginatorOptions struct {
// Optionally specify the maximum number of delivery destinations to return in the
// response.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDeliveryDestinationsPaginator is a paginator for
// DescribeDeliveryDestinations
type DescribeDeliveryDestinationsPaginator struct {
options DescribeDeliveryDestinationsPaginatorOptions
client DescribeDeliveryDestinationsAPIClient
params *DescribeDeliveryDestinationsInput
nextToken *string
firstPage bool
}
// NewDescribeDeliveryDestinationsPaginator returns a new
// DescribeDeliveryDestinationsPaginator
func NewDescribeDeliveryDestinationsPaginator(client DescribeDeliveryDestinationsAPIClient, params *DescribeDeliveryDestinationsInput, optFns ...func(*DescribeDeliveryDestinationsPaginatorOptions)) *DescribeDeliveryDestinationsPaginator {
if params == nil {
params = &DescribeDeliveryDestinationsInput{}
}
options := DescribeDeliveryDestinationsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDeliveryDestinationsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDeliveryDestinationsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDeliveryDestinations page.
func (p *DescribeDeliveryDestinationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDeliveryDestinationsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.DescribeDeliveryDestinations(ctx, &params, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDeliveryDestinations(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DescribeDeliveryDestinations",
}
}

View file

@ -0,0 +1,233 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves a list of the delivery sources that have been created in the account.
func (c *Client) DescribeDeliverySources(ctx context.Context, params *DescribeDeliverySourcesInput, optFns ...func(*Options)) (*DescribeDeliverySourcesOutput, error) {
if params == nil {
params = &DescribeDeliverySourcesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDeliverySources", params, optFns, c.addOperationDescribeDeliverySourcesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDeliverySourcesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDeliverySourcesInput struct {
// Optionally specify the maximum number of delivery sources to return in the
// response.
Limit *int32
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
noSmithyDocumentSerde
}
type DescribeDeliverySourcesOutput struct {
// An array of structures. Each structure contains information about one delivery
// source in the account.
DeliverySources []types.DeliverySource
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDeliverySourcesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeDeliverySources{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeDeliverySources{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeDeliverySources"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDeliverySources(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// DescribeDeliverySourcesAPIClient is a client that implements the
// DescribeDeliverySources operation.
type DescribeDeliverySourcesAPIClient interface {
DescribeDeliverySources(context.Context, *DescribeDeliverySourcesInput, ...func(*Options)) (*DescribeDeliverySourcesOutput, error)
}
var _ DescribeDeliverySourcesAPIClient = (*Client)(nil)
// DescribeDeliverySourcesPaginatorOptions is the paginator options for
// DescribeDeliverySources
type DescribeDeliverySourcesPaginatorOptions struct {
// Optionally specify the maximum number of delivery sources to return in the
// response.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDeliverySourcesPaginator is a paginator for DescribeDeliverySources
type DescribeDeliverySourcesPaginator struct {
options DescribeDeliverySourcesPaginatorOptions
client DescribeDeliverySourcesAPIClient
params *DescribeDeliverySourcesInput
nextToken *string
firstPage bool
}
// NewDescribeDeliverySourcesPaginator returns a new
// DescribeDeliverySourcesPaginator
func NewDescribeDeliverySourcesPaginator(client DescribeDeliverySourcesAPIClient, params *DescribeDeliverySourcesInput, optFns ...func(*DescribeDeliverySourcesPaginatorOptions)) *DescribeDeliverySourcesPaginator {
if params == nil {
params = &DescribeDeliverySourcesInput{}
}
options := DescribeDeliverySourcesPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDeliverySourcesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDeliverySourcesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDeliverySources page.
func (p *DescribeDeliverySourcesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDeliverySourcesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.DescribeDeliverySources(ctx, &params, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeDeliverySources(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DescribeDeliverySources",
}
}

View file

@ -34,7 +34,7 @@ type DescribeDestinationsInput struct {
DestinationNamePrefix *string
// The maximum number of items returned. If you don't specify a value, the default
// is up to 50 items.
// maximum value of 50 items is used.
Limit *int32
// The token for the next set of items to return. (You received this token from a
@ -59,6 +59,9 @@ type DescribeDestinationsOutput struct {
}
func (c *Client) addOperationDescribeDestinationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeDestinations{}, middleware.After)
if err != nil {
return err
@ -67,6 +70,13 @@ func (c *Client) addOperationDescribeDestinationsMiddlewares(stack *middleware.S
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeDestinations"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -85,16 +95,13 @@ func (c *Client) addOperationDescribeDestinationsMiddlewares(stack *middleware.S
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -103,9 +110,15 @@ func (c *Client) addOperationDescribeDestinationsMiddlewares(stack *middleware.S
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDestinations(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -115,6 +128,9 @@ func (c *Client) addOperationDescribeDestinationsMiddlewares(stack *middleware.S
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -130,7 +146,7 @@ var _ DescribeDestinationsAPIClient = (*Client)(nil)
// DescribeDestinations
type DescribeDestinationsPaginatorOptions struct {
// The maximum number of items returned. If you don't specify a value, the default
// is up to 50 items.
// maximum value of 50 items is used.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
@ -214,7 +230,6 @@ func newServiceMetadataMiddleware_opDescribeDestinations(region string) *awsmidd
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeDestinations",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -38,12 +39,12 @@ type DescribeExportTasksInput struct {
// previous call.)
NextToken *string
// The status code of the export task. Specifying a status code filters the results
// to zero or more export tasks.
// The status code of the export task. Specifying a status code filters the
// results to zero or more export tasks.
StatusCode types.ExportTaskStatusCode
// The ID of the export task. Specifying a task ID filters the results to zero or
// one export tasks.
// The ID of the export task. Specifying a task ID filters the results to one or
// zero export tasks.
TaskId *string
noSmithyDocumentSerde
@ -64,6 +65,9 @@ type DescribeExportTasksOutput struct {
}
func (c *Client) addOperationDescribeExportTasksMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeExportTasks{}, middleware.After)
if err != nil {
return err
@ -72,6 +76,13 @@ func (c *Client) addOperationDescribeExportTasksMiddlewares(stack *middleware.St
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeExportTasks"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -90,16 +101,13 @@ func (c *Client) addOperationDescribeExportTasksMiddlewares(stack *middleware.St
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -108,9 +116,15 @@ func (c *Client) addOperationDescribeExportTasksMiddlewares(stack *middleware.St
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeExportTasks(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -120,6 +134,9 @@ func (c *Client) addOperationDescribeExportTasksMiddlewares(stack *middleware.St
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -127,7 +144,6 @@ func newServiceMetadataMiddleware_opDescribeExportTasks(region string) *awsmiddl
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeExportTasks",
}
}

View file

@ -18,8 +18,11 @@ import (
// action by using the aws:ResourceTag/key-name condition key. Other CloudWatch
// Logs actions do support the use of the aws:ResourceTag/key-name condition key
// to control access. For more information about using tags to control access, see
// Controlling access to Amazon Web Services resources using tags
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html).
// Controlling access to Amazon Web Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html)
// . If you are using CloudWatch cross-account observability, you can use this
// operation in a monitoring account and view data from the linked source accounts.
// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// .
func (c *Client) DescribeLogGroups(ctx context.Context, params *DescribeLogGroupsInput, optFns ...func(*Options)) (*DescribeLogGroupsOutput, error) {
if params == nil {
params = &DescribeLogGroupsInput{}
@ -37,11 +40,41 @@ func (c *Client) DescribeLogGroups(ctx context.Context, params *DescribeLogGroup
type DescribeLogGroupsInput struct {
// When includeLinkedAccounts is set to True , use this parameter to specify the
// list of accounts to search. You can specify as many as 20 account IDs in the
// array.
AccountIdentifiers []string
// If you are using a monitoring account, set this to True to have the operation
// return log groups in the accounts listed in accountIdentifiers . If this
// parameter is set to true and accountIdentifiers contains a null value, the
// operation returns all log groups in the monitoring account and all log groups in
// all source accounts that are linked to the monitoring account.
IncludeLinkedAccounts *bool
// The maximum number of items returned. If you don't specify a value, the default
// is up to 50 items.
Limit *int32
// The prefix to match.
// Specifies the log group class for this log group. There are two classes:
// - The Standard log class supports all CloudWatch Logs features.
// - The Infrequent Access log class supports a subset of CloudWatch Logs
// features and incurs lower costs.
// For details about the features supported by each class, see Log classes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html)
LogGroupClass types.LogGroupClass
// If you specify a string for this parameter, the operation returns only log
// groups that have names that match the string based on a case-sensitive substring
// search. For example, if you specify Foo , log groups named FooBar , aws/Foo ,
// and GroupFoo would match, but foo , F/o/o and Froo would not match. If you
// specify logGroupNamePattern in your request, then only arn , creationTime , and
// logGroupName are included in the response. logGroupNamePattern and
// logGroupNamePrefix are mutually exclusive. Only one of these parameters can be
// passed.
LogGroupNamePattern *string
// The prefix to match. logGroupNamePrefix and logGroupNamePattern are mutually
// exclusive. Only one of these parameters can be passed.
LogGroupNamePrefix *string
// The token for the next set of items to return. (You received this token from a
@ -54,7 +87,7 @@ type DescribeLogGroupsInput struct {
type DescribeLogGroupsOutput struct {
// The log groups. If the retentionInDays value is not included for a log group,
// then that log group is set to have its events never expire.
// then that log group's events do not expire.
LogGroups []types.LogGroup
// The token for the next set of items to return. The token expires after 24 hours.
@ -67,6 +100,9 @@ type DescribeLogGroupsOutput struct {
}
func (c *Client) addOperationDescribeLogGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeLogGroups{}, middleware.After)
if err != nil {
return err
@ -75,6 +111,13 @@ func (c *Client) addOperationDescribeLogGroupsMiddlewares(stack *middleware.Stac
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeLogGroups"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -93,16 +136,13 @@ func (c *Client) addOperationDescribeLogGroupsMiddlewares(stack *middleware.Stac
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -111,9 +151,15 @@ func (c *Client) addOperationDescribeLogGroupsMiddlewares(stack *middleware.Stac
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeLogGroups(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -123,6 +169,9 @@ func (c *Client) addOperationDescribeLogGroupsMiddlewares(stack *middleware.Stac
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -221,7 +270,6 @@ func newServiceMetadataMiddleware_opDescribeLogGroups(region string) *awsmiddlew
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeLogGroups",
}
}

View file

@ -14,8 +14,14 @@ import (
// Lists the log streams for the specified log group. You can list all the log
// streams or filter the results by prefix. You can also control how the results
// are ordered. This operation has a limit of five transactions per second, after
// which transactions are throttled.
// are ordered. You can specify the log group to search by using either
// logGroupIdentifier or logGroupName . You must include one of these two
// parameters, but you can't include both. This operation has a limit of five
// transactions per second, after which transactions are throttled. If you are
// using CloudWatch cross-account observability, you can use this operation in a
// monitoring account and view data from the linked source accounts. For more
// information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// .
func (c *Client) DescribeLogStreams(ctx context.Context, params *DescribeLogStreamsInput, optFns ...func(*Options)) (*DescribeLogStreamsOutput, error) {
if params == nil {
params = &DescribeLogStreamsInput{}
@ -33,11 +39,6 @@ func (c *Client) DescribeLogStreams(ctx context.Context, params *DescribeLogStre
type DescribeLogStreamsInput struct {
// The name of the log group.
//
// This member is required.
LogGroupName *string
// If the value is true, results are returned in descending order. If the value is
// to false, results are returned in ascending order. The default value is false.
Descending *bool
@ -46,7 +47,17 @@ type DescribeLogStreamsInput struct {
// is up to 50 items.
Limit *int32
// The prefix to match. If orderBy is LastEventTime, you cannot specify this
// Specify either the name or ARN of the log group to view. If the log group is in
// a source account and you are using a monitoring account, you must use the log
// group ARN. You must include either logGroupIdentifier or logGroupName , but not
// both.
LogGroupIdentifier *string
// The name of the log group. You must include either logGroupIdentifier or
// logGroupName , but not both.
LogGroupName *string
// The prefix to match. If orderBy is LastEventTime , you cannot specify this
// parameter.
LogStreamNamePrefix *string
@ -54,13 +65,13 @@ type DescribeLogStreamsInput struct {
// previous call.)
NextToken *string
// If the value is LogStreamName, the results are ordered by log stream name. If
// the value is LastEventTime, the results are ordered by the event time. The
// default value is LogStreamName. If you order the results by event time, you
// If the value is LogStreamName , the results are ordered by log stream name. If
// the value is LastEventTime , the results are ordered by the event time. The
// default value is LogStreamName . If you order the results by event time, you
// cannot specify the logStreamNamePrefix parameter. lastEventTimestamp represents
// the time of the most recent log event in the log stream in CloudWatch Logs. This
// number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00
// UTC. lastEventTimestamp updates on an eventual consistency basis. It typically
// number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC
// . lastEventTimestamp updates on an eventual consistency basis. It typically
// updates in less than an hour from ingestion, but in rare situations might take
// longer.
OrderBy types.OrderBy
@ -83,6 +94,9 @@ type DescribeLogStreamsOutput struct {
}
func (c *Client) addOperationDescribeLogStreamsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeLogStreams{}, middleware.After)
if err != nil {
return err
@ -91,6 +105,13 @@ func (c *Client) addOperationDescribeLogStreamsMiddlewares(stack *middleware.Sta
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeLogStreams"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -109,16 +130,13 @@ func (c *Client) addOperationDescribeLogStreamsMiddlewares(stack *middleware.Sta
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -127,12 +145,15 @@ func (c *Client) addOperationDescribeLogStreamsMiddlewares(stack *middleware.Sta
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeLogStreamsValidationMiddleware(stack); err != nil {
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeLogStreams(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -142,6 +163,9 @@ func (c *Client) addOperationDescribeLogStreamsMiddlewares(stack *middleware.Sta
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -241,7 +265,6 @@ func newServiceMetadataMiddleware_opDescribeLogStreams(region string) *awsmiddle
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeLogStreams",
}
}

View file

@ -32,8 +32,8 @@ func (c *Client) DescribeMetricFilters(ctx context.Context, params *DescribeMetr
type DescribeMetricFiltersInput struct {
// The prefix to match. CloudWatch Logs uses the value you set here only if you
// also include the logGroupName parameter in your request.
// The prefix to match. CloudWatch Logs uses the value that you set here only if
// you also include the logGroupName parameter in your request.
FilterNamePrefix *string
// The maximum number of items returned. If you don't specify a value, the default
@ -48,8 +48,9 @@ type DescribeMetricFiltersInput struct {
// metricNamespace parameter.
MetricName *string
// Filters results to include only those in the specified namespace. If you include
// this parameter in your request, you must also include the metricName parameter.
// Filters results to include only those in the specified namespace. If you
// include this parameter in your request, you must also include the metricName
// parameter.
MetricNamespace *string
// The token for the next set of items to return. (You received this token from a
@ -74,6 +75,9 @@ type DescribeMetricFiltersOutput struct {
}
func (c *Client) addOperationDescribeMetricFiltersMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeMetricFilters{}, middleware.After)
if err != nil {
return err
@ -82,6 +86,13 @@ func (c *Client) addOperationDescribeMetricFiltersMiddlewares(stack *middleware.
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeMetricFilters"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -100,16 +111,13 @@ func (c *Client) addOperationDescribeMetricFiltersMiddlewares(stack *middleware.
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -118,9 +126,15 @@ func (c *Client) addOperationDescribeMetricFiltersMiddlewares(stack *middleware.
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeMetricFilters(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -130,6 +144,9 @@ func (c *Client) addOperationDescribeMetricFiltersMiddlewares(stack *middleware.
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -229,7 +246,6 @@ func newServiceMetadataMiddleware_opDescribeMetricFilters(region string) *awsmid
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeMetricFilters",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -11,10 +12,9 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of CloudWatch Logs Insights queries that are scheduled,
// executing, or have been executed recently in this account. You can request all
// queries or limit it to queries of a specific log group or queries with a certain
// status.
// Returns a list of CloudWatch Logs Insights queries that are scheduled, running,
// or have been run recently in this account. You can request all queries or limit
// it to queries of a specific log group or queries with a certain status.
func (c *Client) DescribeQueries(ctx context.Context, params *DescribeQueriesInput, optFns ...func(*Options)) (*DescribeQueriesOutput, error) {
if params == nil {
params = &DescribeQueriesInput{}
@ -42,7 +42,7 @@ type DescribeQueriesInput struct {
NextToken *string
// Limits the returned queries to only those that have the specified status. Valid
// values are Cancelled, Complete, Failed, Running, and Scheduled.
// values are Cancelled , Complete , Failed , Running , and Scheduled .
Status types.QueryStatus
noSmithyDocumentSerde
@ -63,6 +63,9 @@ type DescribeQueriesOutput struct {
}
func (c *Client) addOperationDescribeQueriesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeQueries{}, middleware.After)
if err != nil {
return err
@ -71,6 +74,13 @@ func (c *Client) addOperationDescribeQueriesMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeQueries"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -89,16 +99,13 @@ func (c *Client) addOperationDescribeQueriesMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -107,9 +114,15 @@ func (c *Client) addOperationDescribeQueriesMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeQueries(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -119,6 +132,9 @@ func (c *Client) addOperationDescribeQueriesMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -126,7 +142,6 @@ func newServiceMetadataMiddleware_opDescribeQueries(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeQueries",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -12,9 +13,10 @@ import (
)
// This operation returns a paginated list of your saved CloudWatch Logs Insights
// query definitions. You can use the queryDefinitionNamePrefix parameter to limit
// the results to only the query definitions that have names that start with a
// certain string.
// query definitions. You can retrieve query definitions from the current account
// or from a source account that is linked to the current account. You can use the
// queryDefinitionNamePrefix parameter to limit the results to only the query
// definitions that have names that start with a certain string.
func (c *Client) DescribeQueryDefinitions(ctx context.Context, params *DescribeQueryDefinitionsInput, optFns ...func(*Options)) (*DescribeQueryDefinitionsOutput, error) {
if params == nil {
params = &DescribeQueryDefinitionsInput{}
@ -60,6 +62,9 @@ type DescribeQueryDefinitionsOutput struct {
}
func (c *Client) addOperationDescribeQueryDefinitionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeQueryDefinitions{}, middleware.After)
if err != nil {
return err
@ -68,6 +73,13 @@ func (c *Client) addOperationDescribeQueryDefinitionsMiddlewares(stack *middlewa
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeQueryDefinitions"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -86,16 +98,13 @@ func (c *Client) addOperationDescribeQueryDefinitionsMiddlewares(stack *middlewa
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -104,9 +113,15 @@ func (c *Client) addOperationDescribeQueryDefinitionsMiddlewares(stack *middlewa
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeQueryDefinitions(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -116,6 +131,9 @@ func (c *Client) addOperationDescribeQueryDefinitionsMiddlewares(stack *middlewa
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -123,7 +141,6 @@ func newServiceMetadataMiddleware_opDescribeQueryDefinitions(region string) *aws
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeQueryDefinitions",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -54,6 +55,9 @@ type DescribeResourcePoliciesOutput struct {
}
func (c *Client) addOperationDescribeResourcePoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeResourcePolicies{}, middleware.After)
if err != nil {
return err
@ -62,6 +66,13 @@ func (c *Client) addOperationDescribeResourcePoliciesMiddlewares(stack *middlewa
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeResourcePolicies"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -80,16 +91,13 @@ func (c *Client) addOperationDescribeResourcePoliciesMiddlewares(stack *middlewa
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -98,9 +106,15 @@ func (c *Client) addOperationDescribeResourcePoliciesMiddlewares(stack *middlewa
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeResourcePolicies(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -110,6 +124,9 @@ func (c *Client) addOperationDescribeResourcePoliciesMiddlewares(stack *middlewa
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -117,7 +134,6 @@ func newServiceMetadataMiddleware_opDescribeResourcePolicies(region string) *aws
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeResourcePolicies",
}
}

View file

@ -12,8 +12,8 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the subscription filters for the specified log group. You can list all the
// subscription filters or filter the results by prefix. The results are
// Lists the subscription filters for the specified log group. You can list all
// the subscription filters or filter the results by prefix. The results are
// ASCII-sorted by filter name.
func (c *Client) DescribeSubscriptionFilters(ctx context.Context, params *DescribeSubscriptionFiltersInput, optFns ...func(*Options)) (*DescribeSubscriptionFiltersOutput, error) {
if params == nil {
@ -66,6 +66,9 @@ type DescribeSubscriptionFiltersOutput struct {
}
func (c *Client) addOperationDescribeSubscriptionFiltersMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeSubscriptionFilters{}, middleware.After)
if err != nil {
return err
@ -74,6 +77,13 @@ func (c *Client) addOperationDescribeSubscriptionFiltersMiddlewares(stack *middl
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeSubscriptionFilters"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -92,16 +102,13 @@ func (c *Client) addOperationDescribeSubscriptionFiltersMiddlewares(stack *middl
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -110,12 +117,18 @@ func (c *Client) addOperationDescribeSubscriptionFiltersMiddlewares(stack *middl
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeSubscriptionFiltersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeSubscriptionFilters(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -125,6 +138,9 @@ func (c *Client) addOperationDescribeSubscriptionFiltersMiddlewares(stack *middl
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -226,7 +242,6 @@ func newServiceMetadataMiddleware_opDescribeSubscriptionFilters(region string) *
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DescribeSubscriptionFilters",
}
}

View file

@ -4,18 +4,33 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Disassociates the associated Key Management Service customer master key (CMK)
// from the specified log group. After the KMS CMK is disassociated from the log
// group, CloudWatch Logs stops encrypting newly ingested data for the log group.
// All previously ingested data remains encrypted, and CloudWatch Logs requires
// permissions for the CMK whenever the encrypted data is requested. Note that it
// can take up to 5 minutes for this operation to take effect.
// Disassociates the specified KMS key from the specified log group or from all
// CloudWatch Logs Insights query results in the account. When you use
// DisassociateKmsKey , you specify either the logGroupName parameter or the
// resourceIdentifier parameter. You can't specify both of those parameters in the
// same operation.
// - Specify the logGroupName parameter to stop using the KMS key to encrypt
// future log events ingested and stored in the log group. Instead, they will be
// encrypted with the default CloudWatch Logs method. The log events that were
// ingested while the key was associated with the log group are still encrypted
// with that key. Therefore, CloudWatch Logs will need permissions for the key
// whenever that data is accessed.
// - Specify the resourceIdentifier parameter with the query-result resource to
// stop using the KMS key to encrypt the results of all future StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// operations in the account. They will instead be encrypted with the default
// CloudWatch Logs method. The results from queries that ran while the key was
// associated with the account are still encrypted with that key. Therefore,
// CloudWatch Logs will need permissions for the key whenever that data is
// accessed.
//
// It can take up to 5 minutes for this operation to take effect.
func (c *Client) DisassociateKmsKey(ctx context.Context, params *DisassociateKmsKeyInput, optFns ...func(*Options)) (*DisassociateKmsKeyOutput, error) {
if params == nil {
params = &DisassociateKmsKeyInput{}
@ -33,11 +48,27 @@ func (c *Client) DisassociateKmsKey(ctx context.Context, params *DisassociateKms
type DisassociateKmsKeyInput struct {
// The name of the log group.
//
// This member is required.
// The name of the log group. In your DisassociateKmsKey operation, you must
// specify either the resourceIdentifier parameter or the logGroup parameter, but
// you can't specify both.
LogGroupName *string
// Specifies the target for this operation. You must specify one of the following:
// - Specify the ARN of a log group to stop having CloudWatch Logs use the KMS
// key to encrypt log events that are ingested and stored by that log group. After
// you run this operation, CloudWatch Logs encrypts ingested log events with the
// default CloudWatch Logs method. The log group ARN must be in the following
// format. Replace REGION and ACCOUNT_ID with your Region and account ID.
// arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME
// - Specify the following ARN to stop using this key to encrypt the results of
// future StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// operations in this account. Replace REGION and ACCOUNT_ID with your Region and
// account ID. arn:aws:logs:REGION:ACCOUNT_ID:query-result:*
// In your DisssociateKmsKey operation, you must specify either the
// resourceIdentifier parameter or the logGroup parameter, but you can't specify
// both.
ResourceIdentifier *string
noSmithyDocumentSerde
}
@ -49,6 +80,9 @@ type DisassociateKmsKeyOutput struct {
}
func (c *Client) addOperationDisassociateKmsKeyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDisassociateKmsKey{}, middleware.After)
if err != nil {
return err
@ -57,6 +91,13 @@ func (c *Client) addOperationDisassociateKmsKeyMiddlewares(stack *middleware.Sta
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DisassociateKmsKey"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -75,16 +116,13 @@ func (c *Client) addOperationDisassociateKmsKeyMiddlewares(stack *middleware.Sta
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -93,12 +131,15 @@ func (c *Client) addOperationDisassociateKmsKeyMiddlewares(stack *middleware.Sta
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDisassociateKmsKeyValidationMiddleware(stack); err != nil {
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateKmsKey(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -108,6 +149,9 @@ func (c *Client) addOperationDisassociateKmsKeyMiddlewares(stack *middleware.Sta
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -115,7 +159,6 @@ func newServiceMetadataMiddleware_opDisassociateKmsKey(region string) *awsmiddle
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "DisassociateKmsKey",
}
}

View file

@ -14,14 +14,21 @@ import (
// Lists log events from the specified log group. You can list all the log events
// or filter the results using a filter pattern, a time range, and the name of the
// log stream. By default, this operation returns as many log events as can fit in
// 1 MB (up to 10,000 log events) or all the events found within the time range
// that you specify. If the results include a token, then there are more log events
// available, and you can get additional results by specifying the token in a
// subsequent call. This operation can return empty results while there are more
// log events available through the token. The returned log events are sorted by
// event timestamp, the timestamp when the event was ingested by CloudWatch Logs,
// and the ID of the PutLogEvents request.
// log stream. You must have the logs:FilterLogEvents permission to perform this
// operation. You can specify the log group to search by using either
// logGroupIdentifier or logGroupName . You must include one of these two
// parameters, but you can't include both. By default, this operation returns as
// many log events as can fit in 1 MB (up to 10,000 log events) or all the events
// found within the specified time range. If the results include a token, that
// means there are more log events available. You can get additional results by
// specifying the token in a subsequent call. This operation can return empty
// results while there are more log events available through the token. The
// returned log events are sorted by event timestamp, the timestamp when the event
// was ingested by CloudWatch Logs, and the ID of the PutLogEvents request. If you
// are using CloudWatch cross-account observability, you can use this operation in
// a monitoring account and view data from the linked source accounts. For more
// information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// .
func (c *Client) FilterLogEvents(ctx context.Context, params *FilterLogEventsInput, optFns ...func(*Options)) (*FilterLogEventsOutput, error) {
if params == nil {
params = &FilterLogEventsInput{}
@ -39,28 +46,22 @@ func (c *Client) FilterLogEvents(ctx context.Context, params *FilterLogEventsInp
type FilterLogEventsInput struct {
// The name of the log group to search.
//
// This member is required.
LogGroupName *string
// The end of the time range, expressed as the number of milliseconds after Jan 1,
// 1970 00:00:00 UTC. Events with a timestamp later than this time are not
// 1970 00:00:00 UTC . Events with a timestamp later than this time are not
// returned.
EndTime *int64
// The filter pattern to use. For more information, see Filter and Pattern Syntax
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).
// If not provided, all the events are matched.
// The filter pattern to use. For more information, see Filter and Pattern Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
// . If not provided, all the events are matched.
FilterPattern *string
// If the value is true, the operation makes a best effort to provide responses
// that contain events from multiple log streams within the log group, interleaved
// in a single response. If the value is false, all the matched log events in the
// first log stream are searched first, then those in the next log stream, and so
// on. The default is false. Important: Starting on June 17, 2019, this parameter
// is ignored and the value is assumed to be true. The response from this operation
// always interleaves events from multiple log streams within a log group.
// If the value is true, the operation attempts to provide responses that contain
// events from multiple log streams within the log group, interleaved in a single
// response. If the value is false, all the matched log events in the first log
// stream are searched first, then those in the next log stream, and so on.
// Important As of June 17, 2019, this parameter is ignored and the value is
// assumed to be true. The response from this operation always interleaves events
// from multiple log streams within a log group.
//
// Deprecated: Starting on June 17, 2019, this parameter will be ignored and the
// value will be assumed to be true. The response from this operation will always
@ -70,15 +71,25 @@ type FilterLogEventsInput struct {
// The maximum number of events to return. The default is 10,000 events.
Limit *int32
// Specify either the name or ARN of the log group to view log events from. If the
// log group is in a source account and you are using a monitoring account, you
// must use the log group ARN. You must include either logGroupIdentifier or
// logGroupName , but not both.
LogGroupIdentifier *string
// The name of the log group to search. You must include either logGroupIdentifier
// or logGroupName , but not both.
LogGroupName *string
// Filters the results to include only events from log streams that have names
// starting with this prefix. If you specify a value for both logStreamNamePrefix
// and logStreamNames, but the value for logStreamNamePrefix does not match any log
// stream names specified in logStreamNames, the action returns an
// and logStreamNames , but the value for logStreamNamePrefix does not match any
// log stream names specified in logStreamNames , the action returns an
// InvalidParameterException error.
LogStreamNamePrefix *string
// Filters the results to only logs from the log streams in this list. If you
// specify a value for both logStreamNamePrefix and logStreamNames, the action
// specify a value for both logStreamNamePrefix and logStreamNames , the action
// returns an InvalidParameterException error.
LogStreamNames []string
@ -87,9 +98,14 @@ type FilterLogEventsInput struct {
NextToken *string
// The start of the time range, expressed as the number of milliseconds after Jan
// 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not returned.
// 1, 1970 00:00:00 UTC . Events with a timestamp before this time are not returned.
StartTime *int64
// Specify true to display the log event fields with all sensitive data unmasked
// and visible. The default is false . To use this operation with this parameter,
// you must be signed into an account with the logs:Unmask permission.
Unmask bool
noSmithyDocumentSerde
}
@ -102,9 +118,9 @@ type FilterLogEventsOutput struct {
// 24 hours.
NextToken *string
// IMPORTANT Starting on May 15, 2020, this parameter will be deprecated. This
// parameter will be an empty list after the deprecation occurs. Indicates which
// log streams have been searched and whether each has been searched completely.
// Important As of May 15, 2020, this parameter is no longer supported. This
// parameter returns an empty list. Indicates which log streams have been searched
// and whether each has been searched completely.
SearchedLogStreams []types.SearchedLogStream
// Metadata pertaining to the operation's result.
@ -114,6 +130,9 @@ type FilterLogEventsOutput struct {
}
func (c *Client) addOperationFilterLogEventsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpFilterLogEvents{}, middleware.After)
if err != nil {
return err
@ -122,6 +141,13 @@ func (c *Client) addOperationFilterLogEventsMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "FilterLogEvents"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -140,16 +166,13 @@ func (c *Client) addOperationFilterLogEventsMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -158,12 +181,15 @@ func (c *Client) addOperationFilterLogEventsMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpFilterLogEventsValidationMiddleware(stack); err != nil {
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opFilterLogEvents(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -173,6 +199,9 @@ func (c *Client) addOperationFilterLogEventsMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -270,7 +299,6 @@ func newServiceMetadataMiddleware_opFilterLogEvents(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "FilterLogEvents",
}
}

View file

@ -0,0 +1,143 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about a log group data protection policy.
func (c *Client) GetDataProtectionPolicy(ctx context.Context, params *GetDataProtectionPolicyInput, optFns ...func(*Options)) (*GetDataProtectionPolicyOutput, error) {
if params == nil {
params = &GetDataProtectionPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDataProtectionPolicy", params, optFns, c.addOperationGetDataProtectionPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDataProtectionPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetDataProtectionPolicyInput struct {
// The name or ARN of the log group that contains the data protection policy that
// you want to see.
//
// This member is required.
LogGroupIdentifier *string
noSmithyDocumentSerde
}
type GetDataProtectionPolicyOutput struct {
// The date and time that this policy was most recently updated.
LastUpdatedTime *int64
// The log group name or ARN that you specified in your request.
LogGroupIdentifier *string
// The data protection policy document for this log group.
PolicyDocument *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDataProtectionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDataProtectionPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetDataProtectionPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataProtectionPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDataProtectionPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetDataProtectionPolicy",
}
}

View file

@ -0,0 +1,147 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns complete information about one logical delivery. A delivery is a
// connection between a delivery source (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)
// and a delivery destination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)
// . A delivery source represents an Amazon Web Services resource that sends logs
// to an logs delivery destination. The destination can be CloudWatch Logs, Amazon
// S3, or Kinesis Data Firehose. Only some Amazon Web Services services support
// being configured as a delivery source. These services are listed in Enable
// logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
// You need to specify the delivery id in this operation. You can find the IDs of
// the deliveries in your account with the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html)
// operation.
func (c *Client) GetDelivery(ctx context.Context, params *GetDeliveryInput, optFns ...func(*Options)) (*GetDeliveryOutput, error) {
if params == nil {
params = &GetDeliveryInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDelivery", params, optFns, c.addOperationGetDeliveryMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDeliveryOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetDeliveryInput struct {
// The ID of the delivery that you want to retrieve.
//
// This member is required.
Id *string
noSmithyDocumentSerde
}
type GetDeliveryOutput struct {
// A structure that contains information about the delivery.
Delivery *types.Delivery
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDeliveryMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDelivery{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDelivery{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDelivery"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetDeliveryValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDelivery(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDelivery(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetDelivery",
}
}

View file

@ -0,0 +1,137 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves complete information about one delivery destination.
func (c *Client) GetDeliveryDestination(ctx context.Context, params *GetDeliveryDestinationInput, optFns ...func(*Options)) (*GetDeliveryDestinationOutput, error) {
if params == nil {
params = &GetDeliveryDestinationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDeliveryDestination", params, optFns, c.addOperationGetDeliveryDestinationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDeliveryDestinationOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetDeliveryDestinationInput struct {
// The name of the delivery destination that you want to retrieve.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type GetDeliveryDestinationOutput struct {
// A structure containing information about the delivery destination.
DeliveryDestination *types.DeliveryDestination
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDeliveryDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDeliveryDestination"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetDeliveryDestinationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDeliveryDestination(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDeliveryDestination(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetDeliveryDestination",
}
}

View file

@ -0,0 +1,140 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves the delivery destination policy assigned to the delivery destination
// that you specify. For more information about delivery destinations and their
// policies, see PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)
// .
func (c *Client) GetDeliveryDestinationPolicy(ctx context.Context, params *GetDeliveryDestinationPolicyInput, optFns ...func(*Options)) (*GetDeliveryDestinationPolicyOutput, error) {
if params == nil {
params = &GetDeliveryDestinationPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDeliveryDestinationPolicy", params, optFns, c.addOperationGetDeliveryDestinationPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDeliveryDestinationPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetDeliveryDestinationPolicyInput struct {
// The name of the delivery destination that you want to retrieve the policy of.
//
// This member is required.
DeliveryDestinationName *string
noSmithyDocumentSerde
}
type GetDeliveryDestinationPolicyOutput struct {
// The IAM policy for this delivery destination.
Policy *types.Policy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDeliveryDestinationPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDeliveryDestinationPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetDeliveryDestinationPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDeliveryDestinationPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDeliveryDestinationPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetDeliveryDestinationPolicy",
}
}

View file

@ -0,0 +1,137 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves complete information about one delivery source.
func (c *Client) GetDeliverySource(ctx context.Context, params *GetDeliverySourceInput, optFns ...func(*Options)) (*GetDeliverySourceOutput, error) {
if params == nil {
params = &GetDeliverySourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDeliverySource", params, optFns, c.addOperationGetDeliverySourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDeliverySourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetDeliverySourceInput struct {
// The name of the delivery source that you want to retrieve.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type GetDeliverySourceOutput struct {
// A structure containing information about the delivery source.
DeliverySource *types.DeliverySource
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDeliverySourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDeliverySource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDeliverySource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDeliverySource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetDeliverySourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDeliverySource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDeliverySource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetDeliverySource",
}
}

View file

@ -0,0 +1,175 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves information about the log anomaly detector that you specify.
func (c *Client) GetLogAnomalyDetector(ctx context.Context, params *GetLogAnomalyDetectorInput, optFns ...func(*Options)) (*GetLogAnomalyDetectorOutput, error) {
if params == nil {
params = &GetLogAnomalyDetectorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetLogAnomalyDetector", params, optFns, c.addOperationGetLogAnomalyDetectorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetLogAnomalyDetectorOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetLogAnomalyDetectorInput struct {
// The ARN of the anomaly detector to retrieve information about. You can find the
// ARNs of log anomaly detectors in your account by using the
// ListLogAnomalyDetectors (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListLogAnomalyDetectors.html)
// operation.
//
// This member is required.
AnomalyDetectorArn *string
noSmithyDocumentSerde
}
type GetLogAnomalyDetectorOutput struct {
// Specifies whether the anomaly detector is currently active. To change its
// status, use the enabled parameter in the UpdateLogAnomalyDetector (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateLogAnomalyDetector.html)
// operation.
AnomalyDetectorStatus types.AnomalyDetectorStatus
// The number of days used as the life cycle of anomalies. After this time,
// anomalies are automatically baselined and the anomaly detector model will treat
// new occurrences of similar event as normal.
AnomalyVisibilityTime *int64
// The date and time when this anomaly detector was created.
CreationTimeStamp int64
// The name of the log anomaly detector
DetectorName *string
// Specifies how often the anomaly detector runs and look for anomalies. Set this
// value according to the frequency that the log group receives new logs. For
// example, if the log group receives new log events every 10 minutes, then setting
// evaluationFrequency to FIFTEEN_MIN might be appropriate.
EvaluationFrequency types.EvaluationFrequency
// A symbolic description of how CloudWatch Logs should interpret the data in each
// log event. For example, a log event can contain timestamps, IP addresses,
// strings, and so on. You use the filter pattern to specify what to look for in
// the log event message.
FilterPattern *string
// The ID of the KMS key assigned to this anomaly detector, if any.
KmsKeyId *string
// The date and time when this anomaly detector was most recently modified.
LastModifiedTimeStamp int64
// An array of structures, where each structure contains the ARN of a log group
// associated with this anomaly detector.
LogGroupArnList []string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetLogAnomalyDetectorMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLogAnomalyDetector"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetLogAnomalyDetectorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLogAnomalyDetector(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetLogAnomalyDetector(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "GetLogAnomalyDetector",
}
}

View file

@ -17,7 +17,13 @@ import (
// log events as can fit in a response size of 1MB (up to 10,000 log events). You
// can get additional log events by specifying one of the tokens in a subsequent
// call. This operation can return empty results while there are more log events
// available through the token.
// available through the token. If you are using CloudWatch cross-account
// observability, you can use this operation in a monitoring account and view data
// from the linked source accounts. For more information, see CloudWatch
// cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// . You can specify the log group to search by using either logGroupIdentifier or
// logGroupName . You must include one of these two parameters, but you can't
// include both.
func (c *Client) GetLogEvents(ctx context.Context, params *GetLogEventsInput, optFns ...func(*Options)) (*GetLogEventsOutput, error) {
if params == nil {
params = &GetLogEventsInput{}
@ -35,26 +41,31 @@ func (c *Client) GetLogEvents(ctx context.Context, params *GetLogEventsInput, op
type GetLogEventsInput struct {
// The name of the log group.
//
// This member is required.
LogGroupName *string
// The name of the log stream.
//
// This member is required.
LogStreamName *string
// The end of the time range, expressed as the number of milliseconds after Jan 1,
// 1970 00:00:00 UTC. Events with a timestamp equal to or later than this time are
// 1970 00:00:00 UTC . Events with a timestamp equal to or later than this time are
// not included.
EndTime *int64
// The maximum number of log events returned. If you don't specify a value, the
// maximum is as many log events as can fit in a response size of 1 MB, up to
// 10,000 log events.
// The maximum number of log events returned. If you don't specify a limit, the
// default is as many log events as can fit in a response size of 1 MB (up to
// 10,000 log events).
Limit *int32
// Specify either the name or ARN of the log group to view events from. If the log
// group is in a source account and you are using a monitoring account, you must
// use the log group ARN. You must include either logGroupIdentifier or
// logGroupName , but not both.
LogGroupIdentifier *string
// The name of the log group. You must include either logGroupIdentifier or
// logGroupName , but not both.
LogGroupName *string
// The token for the next set of items to return. (You received this token from a
// previous call.)
NextToken *string
@ -62,15 +73,20 @@ type GetLogEventsInput struct {
// If the value is true, the earliest log events are returned first. If the value
// is false, the latest log events are returned first. The default value is false.
// If you are using a previous nextForwardToken value as the nextToken in this
// operation, you must specify true for startFromHead.
// operation, you must specify true for startFromHead .
StartFromHead *bool
// The start of the time range, expressed as the number of milliseconds after Jan
// 1, 1970 00:00:00 UTC. Events with a timestamp equal to this time or later than
// 1, 1970 00:00:00 UTC . Events with a timestamp equal to this time or later than
// this time are included. Events with a timestamp earlier than this time are not
// included.
StartTime *int64
// Specify true to display the log event fields with all sensitive data unmasked
// and visible. The default is false . To use this operation with this parameter,
// you must be signed into an account with the logs:Unmask permission.
Unmask bool
noSmithyDocumentSerde
}
@ -79,9 +95,9 @@ type GetLogEventsOutput struct {
// The events.
Events []types.OutputLogEvent
// The token for the next set of items in the backward direction. The token expires
// after 24 hours. This token is never null. If you have reached the end of the
// stream, it returns the same token you passed in.
// The token for the next set of items in the backward direction. The token
// expires after 24 hours. This token is not null. If you have reached the end of
// the stream, it returns the same token you passed in.
NextBackwardToken *string
// The token for the next set of items in the forward direction. The token expires
@ -96,6 +112,9 @@ type GetLogEventsOutput struct {
}
func (c *Client) addOperationGetLogEventsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLogEvents{}, middleware.After)
if err != nil {
return err
@ -104,6 +123,13 @@ func (c *Client) addOperationGetLogEventsMiddlewares(stack *middleware.Stack, op
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLogEvents"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -122,16 +148,13 @@ func (c *Client) addOperationGetLogEventsMiddlewares(stack *middleware.Stack, op
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -140,12 +163,18 @@ func (c *Client) addOperationGetLogEventsMiddlewares(stack *middleware.Stack, op
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetLogEventsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLogEvents(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -155,6 +184,9 @@ func (c *Client) addOperationGetLogEventsMiddlewares(stack *middleware.Stack, op
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -167,9 +199,9 @@ var _ GetLogEventsAPIClient = (*Client)(nil)
// GetLogEventsPaginatorOptions is the paginator options for GetLogEvents
type GetLogEventsPaginatorOptions struct {
// The maximum number of log events returned. If you don't specify a value, the
// maximum is as many log events as can fit in a response size of 1 MB, up to
// 10,000 log events.
// The maximum number of log events returned. If you don't specify a limit, the
// default is as many log events as can fit in a response size of 1 MB (up to
// 10,000 log events).
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
@ -253,7 +285,6 @@ func newServiceMetadataMiddleware_opGetLogEvents(region string) *awsmiddleware.R
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "GetLogEvents",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -12,14 +13,20 @@ import (
)
// Returns a list of the fields that are included in log events in the specified
// log group, along with the percentage of log events that contain each field. The
// search is limited to a time period that you specify. In the results, fields that
// start with @ are fields generated by CloudWatch Logs. For example, @timestamp is
// the timestamp of each log event. For more information about the fields that are
// generated by CloudWatch logs, see Supported Logs and Discovered Fields
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html).
// The response results are sorted by the frequency percentage, starting with the
// highest percentage.
// log group. Includes the percentage of log events that contain each field. The
// search is limited to a time period that you specify. You can specify the log
// group to search by using either logGroupIdentifier or logGroupName . You must
// specify one of these parameters, but you can't specify both. In the results,
// fields that start with @ are fields generated by CloudWatch Logs. For example,
// @timestamp is the timestamp of each log event. For more information about the
// fields that are generated by CloudWatch logs, see Supported Logs and Discovered
// Fields (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html)
// . The response results are sorted by the frequency percentage, starting with the
// highest percentage. If you are using CloudWatch cross-account observability, you
// can use this operation in a monitoring account and view data from the linked
// source accounts. For more information, see CloudWatch cross-account
// observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// .
func (c *Client) GetLogGroupFields(ctx context.Context, params *GetLogGroupFieldsInput, optFns ...func(*Options)) (*GetLogGroupFieldsOutput, error) {
if params == nil {
params = &GetLogGroupFieldsInput{}
@ -37,15 +44,20 @@ func (c *Client) GetLogGroupFields(ctx context.Context, params *GetLogGroupField
type GetLogGroupFieldsInput struct {
// The name of the log group to search.
//
// This member is required.
// Specify either the name or ARN of the log group to view. If the log group is in
// a source account and you are using a monitoring account, you must specify the
// ARN. You must include either logGroupIdentifier or logGroupName , but not both.
LogGroupIdentifier *string
// The name of the log group to search. You must include either logGroupIdentifier
// or logGroupName , but not both.
LogGroupName *string
// The time to set as the center of the query. If you specify time, the 15 minutes
// before this time are queries. If you omit time the 8 minutes before and 8
// minutes after this time are searched. The time value is specified as epoch time,
// the number of seconds since January 1, 1970, 00:00:00 UTC.
// The time to set as the center of the query. If you specify time , the 8 minutes
// before and 8 minutes after this time are searched. If you omit time , the most
// recent 15 minutes up to the current time are searched. The time value is
// specified as epoch time, which is the number of seconds since January 1, 1970,
// 00:00:00 UTC .
Time *int64
noSmithyDocumentSerde
@ -65,6 +77,9 @@ type GetLogGroupFieldsOutput struct {
}
func (c *Client) addOperationGetLogGroupFieldsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLogGroupFields{}, middleware.After)
if err != nil {
return err
@ -73,6 +88,13 @@ func (c *Client) addOperationGetLogGroupFieldsMiddlewares(stack *middleware.Stac
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLogGroupFields"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -91,16 +113,13 @@ func (c *Client) addOperationGetLogGroupFieldsMiddlewares(stack *middleware.Stac
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -109,12 +128,15 @@ func (c *Client) addOperationGetLogGroupFieldsMiddlewares(stack *middleware.Stac
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetLogGroupFieldsValidationMiddleware(stack); err != nil {
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLogGroupFields(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -124,6 +146,9 @@ func (c *Client) addOperationGetLogGroupFieldsMiddlewares(stack *middleware.Stac
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -131,7 +156,6 @@ func newServiceMetadataMiddleware_opGetLogGroupFields(region string) *awsmiddlew
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "GetLogGroupFields",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -13,7 +14,7 @@ import (
// Retrieves all of the fields and values of a single log event. All fields are
// retrieved, even if the original query that produced the logRecordPointer
// retrieved only a subset of fields. Fields are returned as field name/field value
// pairs. The full unparsed log event is returned within @message.
// pairs. The full unparsed log event is returned within @message .
func (c *Client) GetLogRecord(ctx context.Context, params *GetLogRecordInput, optFns ...func(*Options)) (*GetLogRecordOutput, error) {
if params == nil {
params = &GetLogRecordInput{}
@ -39,6 +40,11 @@ type GetLogRecordInput struct {
// This member is required.
LogRecordPointer *string
// Specify true to display the log event fields with all sensitive data unmasked
// and visible. The default is false . To use this operation with this parameter,
// you must be signed into an account with the logs:Unmask permission.
Unmask bool
noSmithyDocumentSerde
}
@ -54,6 +60,9 @@ type GetLogRecordOutput struct {
}
func (c *Client) addOperationGetLogRecordMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLogRecord{}, middleware.After)
if err != nil {
return err
@ -62,6 +71,13 @@ func (c *Client) addOperationGetLogRecordMiddlewares(stack *middleware.Stack, op
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLogRecord"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -80,16 +96,13 @@ func (c *Client) addOperationGetLogRecordMiddlewares(stack *middleware.Stack, op
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -98,12 +111,18 @@ func (c *Client) addOperationGetLogRecordMiddlewares(stack *middleware.Stack, op
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetLogRecordValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLogRecord(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -113,6 +132,9 @@ func (c *Client) addOperationGetLogRecordMiddlewares(stack *middleware.Stack, op
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -120,7 +142,6 @@ func newServiceMetadataMiddleware_opGetLogRecord(region string) *awsmiddleware.R
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "GetLogRecord",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -12,15 +13,19 @@ import (
)
// Returns the results from the specified query. Only the fields requested in the
// query are returned, along with a @ptr field, which is the identifier for the log
// record. You can use the value of @ptr in a GetLogRecord
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogRecord.html)
// operation to get the full log record. GetQueryResults does not start a query
// execution. To run a query, use StartQuery
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html).
// If the value of the Status field in the output is Running, this operation
// returns only partial results. If you see a value of Scheduled or Running for the
// status, you can retry the operation later to see the final results.
// query are returned, along with a @ptr field, which is the identifier for the
// log record. You can use the value of @ptr in a GetLogRecord (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogRecord.html)
// operation to get the full log record. GetQueryResults does not start running a
// query. To run a query, use StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// . For more information about how long results of previous queries are available,
// see CloudWatch Logs quotas (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html)
// . If the value of the Status field in the output is Running , this operation
// returns only partial results. If you see a value of Scheduled or Running for
// the status, you can retry the operation later to see the final results. If you
// are using CloudWatch cross-account observability, you can use this operation in
// a monitoring account to start queries in linked source accounts. For more
// information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// .
func (c *Client) GetQueryResults(ctx context.Context, params *GetQueryResultsInput, optFns ...func(*Options)) (*GetQueryResultsOutput, error) {
if params == nil {
params = &GetQueryResultsInput{}
@ -48,22 +53,28 @@ type GetQueryResultsInput struct {
type GetQueryResultsOutput struct {
// If you associated an KMS key with the CloudWatch Logs Insights query results in
// this account, this field displays the ARN of the key that's used to encrypt the
// query results when StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// stores them.
EncryptionKey *string
// The log events that matched the query criteria during the most recent time it
// ran. The results value is an array of arrays. Each log event is one object in
// the top-level array. Each of these log event objects is an array of field/value
// the top-level array. Each of these log event objects is an array of field / value
// pairs.
Results [][]types.ResultField
// Includes the number of log events scanned by the query, the number of log events
// that matched the query criteria, and the total number of bytes in the log events
// that were scanned. These values reflect the full raw results of the query.
// Includes the number of log events scanned by the query, the number of log
// events that matched the query criteria, and the total number of bytes in the
// scanned log events. These values reflect the full raw results of the query.
Statistics *types.QueryStatistics
// The status of the most recent running of the query. Possible values are
// Cancelled, Complete, Failed, Running, Scheduled, Timeout, and Unknown. Queries
// time out after 15 minutes of execution. To avoid having your queries time out,
// reduce the time range being searched or partition your query into a number of
// queries.
// Cancelled , Complete , Failed , Running , Scheduled , Timeout , and Unknown .
// Queries time out after 60 minutes of runtime. To avoid having your queries time
// out, reduce the time range being searched or partition your query into a number
// of queries.
Status types.QueryStatus
// Metadata pertaining to the operation's result.
@ -73,6 +84,9 @@ type GetQueryResultsOutput struct {
}
func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetQueryResults{}, middleware.After)
if err != nil {
return err
@ -81,6 +95,13 @@ func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "GetQueryResults"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -99,16 +120,13 @@ func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -117,12 +135,18 @@ func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpGetQueryResultsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetQueryResults(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -132,6 +156,9 @@ func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -139,7 +166,6 @@ func newServiceMetadataMiddleware_opGetQueryResults(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "GetQueryResults",
}
}

View file

@ -0,0 +1,240 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of anomalies that log anomaly detectors have found. For details
// about the structure format of each anomaly object that is returned, see the
// example in this section.
func (c *Client) ListAnomalies(ctx context.Context, params *ListAnomaliesInput, optFns ...func(*Options)) (*ListAnomaliesOutput, error) {
if params == nil {
params = &ListAnomaliesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListAnomalies", params, optFns, c.addOperationListAnomaliesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListAnomaliesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListAnomaliesInput struct {
// Use this to optionally limit the results to only the anomalies found by a
// certain anomaly detector.
AnomalyDetectorArn *string
// The maximum number of items to return. If you don't specify a value, the
// default maximum value of 50 items is used.
Limit *int32
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// You can specify this parameter if you want to the operation to return only
// anomalies that are currently either suppressed or unsuppressed.
SuppressionState types.SuppressionState
noSmithyDocumentSerde
}
type ListAnomaliesOutput struct {
// An array of structures, where each structure contains information about one
// anomaly that a log anomaly detector has found.
Anomalies []types.Anomaly
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListAnomaliesMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListAnomalies{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListAnomalies{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "ListAnomalies"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAnomalies(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// ListAnomaliesAPIClient is a client that implements the ListAnomalies operation.
type ListAnomaliesAPIClient interface {
ListAnomalies(context.Context, *ListAnomaliesInput, ...func(*Options)) (*ListAnomaliesOutput, error)
}
var _ ListAnomaliesAPIClient = (*Client)(nil)
// ListAnomaliesPaginatorOptions is the paginator options for ListAnomalies
type ListAnomaliesPaginatorOptions struct {
// The maximum number of items to return. If you don't specify a value, the
// default maximum value of 50 items is used.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListAnomaliesPaginator is a paginator for ListAnomalies
type ListAnomaliesPaginator struct {
options ListAnomaliesPaginatorOptions
client ListAnomaliesAPIClient
params *ListAnomaliesInput
nextToken *string
firstPage bool
}
// NewListAnomaliesPaginator returns a new ListAnomaliesPaginator
func NewListAnomaliesPaginator(client ListAnomaliesAPIClient, params *ListAnomaliesInput, optFns ...func(*ListAnomaliesPaginatorOptions)) *ListAnomaliesPaginator {
if params == nil {
params = &ListAnomaliesInput{}
}
options := ListAnomaliesPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListAnomaliesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListAnomaliesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListAnomalies page.
func (p *ListAnomaliesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAnomaliesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListAnomalies(ctx, &params, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListAnomalies(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "ListAnomalies",
}
}

View file

@ -0,0 +1,237 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves a list of the log anomaly detectors in the account.
func (c *Client) ListLogAnomalyDetectors(ctx context.Context, params *ListLogAnomalyDetectorsInput, optFns ...func(*Options)) (*ListLogAnomalyDetectorsOutput, error) {
if params == nil {
params = &ListLogAnomalyDetectorsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListLogAnomalyDetectors", params, optFns, c.addOperationListLogAnomalyDetectorsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListLogAnomalyDetectorsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListLogAnomalyDetectorsInput struct {
// Use this to optionally filter the results to only include anomaly detectors
// that are associated with the specified log group.
FilterLogGroupArn *string
// The maximum number of items to return. If you don't specify a value, the
// default maximum value of 50 items is used.
Limit *int32
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
noSmithyDocumentSerde
}
type ListLogAnomalyDetectorsOutput struct {
// An array of structures, where each structure in the array contains information
// about one anomaly detector.
AnomalyDetectors []types.AnomalyDetector
// The token for the next set of items to return. The token expires after 24 hours.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListLogAnomalyDetectorsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListLogAnomalyDetectors{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListLogAnomalyDetectors{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "ListLogAnomalyDetectors"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListLogAnomalyDetectors(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// ListLogAnomalyDetectorsAPIClient is a client that implements the
// ListLogAnomalyDetectors operation.
type ListLogAnomalyDetectorsAPIClient interface {
ListLogAnomalyDetectors(context.Context, *ListLogAnomalyDetectorsInput, ...func(*Options)) (*ListLogAnomalyDetectorsOutput, error)
}
var _ ListLogAnomalyDetectorsAPIClient = (*Client)(nil)
// ListLogAnomalyDetectorsPaginatorOptions is the paginator options for
// ListLogAnomalyDetectors
type ListLogAnomalyDetectorsPaginatorOptions struct {
// The maximum number of items to return. If you don't specify a value, the
// default maximum value of 50 items is used.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListLogAnomalyDetectorsPaginator is a paginator for ListLogAnomalyDetectors
type ListLogAnomalyDetectorsPaginator struct {
options ListLogAnomalyDetectorsPaginatorOptions
client ListLogAnomalyDetectorsAPIClient
params *ListLogAnomalyDetectorsInput
nextToken *string
firstPage bool
}
// NewListLogAnomalyDetectorsPaginator returns a new
// ListLogAnomalyDetectorsPaginator
func NewListLogAnomalyDetectorsPaginator(client ListLogAnomalyDetectorsAPIClient, params *ListLogAnomalyDetectorsInput, optFns ...func(*ListLogAnomalyDetectorsPaginatorOptions)) *ListLogAnomalyDetectorsPaginator {
if params == nil {
params = &ListLogAnomalyDetectorsInput{}
}
options := ListLogAnomalyDetectorsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListLogAnomalyDetectorsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListLogAnomalyDetectorsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListLogAnomalyDetectors page.
func (p *ListLogAnomalyDetectorsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListLogAnomalyDetectorsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListLogAnomalyDetectors(ctx, &params, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListLogAnomalyDetectors(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "ListLogAnomalyDetectors",
}
}

View file

@ -0,0 +1,142 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Displays the tags associated with a CloudWatch Logs resource. Currently, log
// groups and destinations support tagging.
func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) {
if params == nil {
params = &ListTagsForResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListTagsForResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListTagsForResourceInput struct {
// The ARN of the resource that you want to view tags for. The ARN format of a log
// group is arn:aws:logs:Region:account-id:log-group:log-group-name The ARN
// format of a destination is
// arn:aws:logs:Region:account-id:destination:destination-name For more
// information about ARN format, see CloudWatch Logs resources and operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html)
// .
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type ListTagsForResourceOutput struct {
// The list of tags associated with the requested resource.>
Tags map[string]string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsForResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTagsForResource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "ListTagsForResource",
}
}

View file

@ -4,13 +4,18 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the tags for the specified log group.
// The ListTagsLogGroup operation is on the path to deprecation. We recommend that
// you use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html)
// instead. Lists the tags for the specified log group.
//
// Deprecated: Please use the generic tagging API ListTagsForResource
func (c *Client) ListTagsLogGroup(ctx context.Context, params *ListTagsLogGroupInput, optFns ...func(*Options)) (*ListTagsLogGroupOutput, error) {
if params == nil {
params = &ListTagsLogGroupInput{}
@ -48,6 +53,9 @@ type ListTagsLogGroupOutput struct {
}
func (c *Client) addOperationListTagsLogGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsLogGroup{}, middleware.After)
if err != nil {
return err
@ -56,6 +64,13 @@ func (c *Client) addOperationListTagsLogGroupMiddlewares(stack *middleware.Stack
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "ListTagsLogGroup"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -74,16 +89,13 @@ func (c *Client) addOperationListTagsLogGroupMiddlewares(stack *middleware.Stack
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -92,12 +104,18 @@ func (c *Client) addOperationListTagsLogGroupMiddlewares(stack *middleware.Stack
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpListTagsLogGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsLogGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -107,6 +125,9 @@ func (c *Client) addOperationListTagsLogGroupMiddlewares(stack *middleware.Stack
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -114,7 +135,6 @@ func newServiceMetadataMiddleware_opListTagsLogGroup(region string) *awsmiddlewa
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "ListTagsLogGroup",
}
}

View file

@ -0,0 +1,257 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an account-level data protection policy or subscription filter policy
// that applies to all log groups or a subset of log groups in the account. Data
// protection policy A data protection policy can help safeguard sensitive data
// that's ingested by your log groups by auditing and masking the sensitive log
// data. Each account can have only one account-level data protection policy.
// Sensitive data is detected and masked when it is ingested into a log group. When
// you set a data protection policy, log events ingested into the log groups before
// that time are not masked. If you use PutAccountPolicy to create a data
// protection policy for your whole account, it applies to both existing log groups
// and all log groups that are created later in this account. The account-level
// policy is applied to existing log groups with eventual consistency. It might
// take up to 5 minutes before sensitive data in existing log groups begins to be
// masked. By default, when a user views a log event that includes masked data, the
// sensitive data is replaced by asterisks. A user who has the logs:Unmask
// permission can use a GetLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html)
// or FilterLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html)
// operation with the unmask parameter set to true to view the unmasked log
// events. Users with the logs:Unmask can also view unmasked data in the
// CloudWatch Logs console by running a CloudWatch Logs Insights query with the
// unmask query command. For more information, including a list of types of data
// that can be audited and masked, see Protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html)
// . To use the PutAccountPolicy operation for a data protection policy, you must
// be signed on with the logs:PutDataProtectionPolicy and logs:PutAccountPolicy
// permissions. The PutAccountPolicy operation applies to all log groups in the
// account. You can use PutDataProtectionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html)
// to create a data protection policy that applies to just one log group. If a log
// group has its own data protection policy and the account also has an
// account-level data protection policy, then the two policies are cumulative. Any
// sensitive term specified in either policy is masked. Subscription filter policy
// A subscription filter policy sets up a real-time feed of log events from
// CloudWatch Logs to other Amazon Web Services services. Account-level
// subscription filter policies apply to both existing log groups and log groups
// that are created later in this account. Supported destinations are Kinesis Data
// Streams, Kinesis Data Firehose, and Lambda. When log events are sent to the
// receiving service, they are Base64 encoded and compressed with the GZIP format.
// The following destinations are supported for subscription filters:
// - An Kinesis Data Streams data stream in the same account as the subscription
// policy, for same-account delivery.
// - An Kinesis Data Firehose data stream in the same account as the
// subscription policy, for same-account delivery.
// - A Lambda function in the same account as the subscription policy, for
// same-account delivery.
// - A logical destination in a different account created with PutDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html)
// , for cross-account delivery. Kinesis Data Streams and Kinesis Data Firehose are
// supported as logical destinations.
//
// Each account can have one account-level subscription filter policy. If you are
// updating an existing filter, you must specify the correct name in PolicyName .
// To perform a PutAccountPolicy subscription filter operation for any destination
// except a Lambda function, you must also have the iam:PassRole permission.
func (c *Client) PutAccountPolicy(ctx context.Context, params *PutAccountPolicyInput, optFns ...func(*Options)) (*PutAccountPolicyOutput, error) {
if params == nil {
params = &PutAccountPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutAccountPolicy", params, optFns, c.addOperationPutAccountPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutAccountPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutAccountPolicyInput struct {
// Specify the policy, in JSON. Data protection policy A data protection policy
// must include two JSON blocks:
// - The first block must include both a DataIdentifer array and an Operation
// property with an Audit action. The DataIdentifer array lists the types of
// sensitive data that you want to mask. For more information about the available
// options, see Types of data that you can mask (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html)
// . The Operation property with an Audit action is required to find the
// sensitive data terms. This Audit action must contain a FindingsDestination
// object. You can optionally use that FindingsDestination object to list one or
// more destinations to send audit findings to. If you specify destinations such as
// log groups, Kinesis Data Firehose streams, and S3 buckets, they must already
// exist.
// - The second block must include both a DataIdentifer array and an Operation
// property with an Deidentify action. The DataIdentifer array must exactly match
// the DataIdentifer array in the first block of the policy. The Operation
// property with the Deidentify action is what actually masks the data, and it
// must contain the "MaskConfig": {} object. The "MaskConfig": {} object must be
// empty.
// For an example data protection policy, see the Examples section on this page.
// The contents of the two DataIdentifer arrays must match exactly. In addition to
// the two JSON blocks, the policyDocument can also include Name , Description ,
// and Version fields. The Name is different than the operation's policyName
// parameter, and is used as a dimension when CloudWatch Logs reports audit
// findings metrics to CloudWatch. The JSON specified in policyDocument can be up
// to 30,720 characters long. Subscription filter policy A subscription filter
// policy can include the following attributes in a JSON block:
// - DestinationArn The ARN of the destination to deliver log events to.
// Supported destinations are:
// - An Kinesis Data Streams data stream in the same account as the subscription
// policy, for same-account delivery.
// - An Kinesis Data Firehose data stream in the same account as the
// subscription policy, for same-account delivery.
// - A Lambda function in the same account as the subscription policy, for
// same-account delivery.
// - A logical destination in a different account created with PutDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html)
// , for cross-account delivery. Kinesis Data Streams and Kinesis Data Firehose are
// supported as logical destinations.
// - RoleArn The ARN of an IAM role that grants CloudWatch Logs permissions to
// deliver ingested log events to the destination stream. You don't need to provide
// the ARN when you are working with a logical destination for cross-account
// delivery.
// - FilterPattern A filter pattern for subscribing to a filtered stream of log
// events.
// - DistributionThe method used to distribute log data to the destination. By
// default, log data is grouped by log stream, but the grouping can be set to
// Random for a more even distribution. This property is only applicable when the
// destination is an Kinesis Data Streams data stream.
//
// This member is required.
PolicyDocument *string
// A name for the policy. This must be unique within the account.
//
// This member is required.
PolicyName *string
// The type of policy that you're creating or updating.
//
// This member is required.
PolicyType types.PolicyType
// Currently the only valid value for this parameter is ALL , which specifies that
// the data protection policy applies to all log groups in the account. If you omit
// this parameter, the default of ALL is used.
Scope types.Scope
// Use this parameter to apply the subscription filter policy to a subset of log
// groups in the account. Currently, the only supported filter is LogGroupName NOT
// IN [] . The selectionCriteria string can be up to 25KB in length. The length is
// determined by using its UTF-8 bytes. Using the selectionCriteria parameter is
// useful to help prevent infinite loops. For more information, see Log recursion
// prevention (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions-recursion-prevention.html)
// . Specifing selectionCriteria is valid only when you specify
// SUBSCRIPTION_FILTER_POLICY for policyType .
SelectionCriteria *string
noSmithyDocumentSerde
}
type PutAccountPolicyOutput struct {
// The account policy that you created.
AccountPolicy *types.AccountPolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutAccountPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutAccountPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutAccountPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutAccountPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutAccountPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutAccountPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutAccountPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutAccountPolicy",
}
}

View file

@ -0,0 +1,190 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a data protection policy for the specified log group. A data protection
// policy can help safeguard sensitive data that's ingested by the log group by
// auditing and masking the sensitive log data. Sensitive data is detected and
// masked when it is ingested into the log group. When you set a data protection
// policy, log events ingested into the log group before that time are not masked.
// By default, when a user views a log event that includes masked data, the
// sensitive data is replaced by asterisks. A user who has the logs:Unmask
// permission can use a GetLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html)
// or FilterLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html)
// operation with the unmask parameter set to true to view the unmasked log
// events. Users with the logs:Unmask can also view unmasked data in the
// CloudWatch Logs console by running a CloudWatch Logs Insights query with the
// unmask query command. For more information, including a list of types of data
// that can be audited and masked, see Protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html)
// . The PutDataProtectionPolicy operation applies to only the specified log
// group. You can also use PutAccountPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutAccountPolicy.html)
// to create an account-level data protection policy that applies to all log groups
// in the account, including both existing log groups and log groups that are
// created level. If a log group has its own data protection policy and the account
// also has an account-level data protection policy, then the two policies are
// cumulative. Any sensitive term specified in either policy is masked.
func (c *Client) PutDataProtectionPolicy(ctx context.Context, params *PutDataProtectionPolicyInput, optFns ...func(*Options)) (*PutDataProtectionPolicyOutput, error) {
if params == nil {
params = &PutDataProtectionPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutDataProtectionPolicy", params, optFns, c.addOperationPutDataProtectionPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutDataProtectionPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutDataProtectionPolicyInput struct {
// Specify either the log group name or log group ARN.
//
// This member is required.
LogGroupIdentifier *string
// Specify the data protection policy, in JSON. This policy must include two JSON
// blocks:
// - The first block must include both a DataIdentifer array and an Operation
// property with an Audit action. The DataIdentifer array lists the types of
// sensitive data that you want to mask. For more information about the available
// options, see Types of data that you can mask (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html)
// . The Operation property with an Audit action is required to find the
// sensitive data terms. This Audit action must contain a FindingsDestination
// object. You can optionally use that FindingsDestination object to list one or
// more destinations to send audit findings to. If you specify destinations such as
// log groups, Kinesis Data Firehose streams, and S3 buckets, they must already
// exist.
// - The second block must include both a DataIdentifer array and an Operation
// property with an Deidentify action. The DataIdentifer array must exactly match
// the DataIdentifer array in the first block of the policy. The Operation
// property with the Deidentify action is what actually masks the data, and it
// must contain the "MaskConfig": {} object. The "MaskConfig": {} object must be
// empty.
// For an example data protection policy, see the Examples section on this page.
// The contents of the two DataIdentifer arrays must match exactly. In addition to
// the two JSON blocks, the policyDocument can also include Name , Description ,
// and Version fields. The Name is used as a dimension when CloudWatch Logs
// reports audit findings metrics to CloudWatch. The JSON specified in
// policyDocument can be up to 30,720 characters.
//
// This member is required.
PolicyDocument *string
noSmithyDocumentSerde
}
type PutDataProtectionPolicyOutput struct {
// The date and time that this policy was most recently updated.
LastUpdatedTime *int64
// The log group name or ARN that you specified in your request.
LogGroupIdentifier *string
// The data protection policy used for this log group.
PolicyDocument *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutDataProtectionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutDataProtectionPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDataProtectionPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDataProtectionPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDataProtectionPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutDataProtectionPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutDataProtectionPolicy",
}
}

View file

@ -0,0 +1,180 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates or updates a logical delivery destination. A delivery destination is an
// Amazon Web Services resource that represents an Amazon Web Services service that
// logs can be sent to. CloudWatch Logs, Amazon S3, and Kinesis Data Firehose are
// supported as logs delivery destinations. To configure logs delivery between a
// supported Amazon Web Services service and a destination, you must do the
// following:
// - Create a delivery source, which is a logical object that represents the
// resource that is actually sending the logs. For more information, see
// PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)
// .
// - Use PutDeliveryDestination to create a delivery destination, which is a
// logical object that represents the actual delivery destination.
// - If you are delivering logs cross-account, you must use
// PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)
// in the destination account to assign an IAM policy to the destination. This
// policy allows delivery to that destination.
// - Use CreateDelivery to create a delivery by pairing exactly one delivery
// source and one delivery destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html)
// .
//
// You can configure a single delivery source to send logs to multiple
// destinations by creating multiple deliveries. You can also create multiple
// deliveries to configure multiple delivery sources to send logs to the same
// delivery destination. Only some Amazon Web Services services support being
// configured as a delivery source. These services are listed as Supported [V2
// Permissions] in the table at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
// If you use this operation to update an existing delivery destination, all the
// current delivery destination parameters are overwritten with the new parameter
// values that you specify.
func (c *Client) PutDeliveryDestination(ctx context.Context, params *PutDeliveryDestinationInput, optFns ...func(*Options)) (*PutDeliveryDestinationOutput, error) {
if params == nil {
params = &PutDeliveryDestinationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutDeliveryDestination", params, optFns, c.addOperationPutDeliveryDestinationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutDeliveryDestinationOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutDeliveryDestinationInput struct {
// A structure that contains the ARN of the Amazon Web Services resource that will
// receive the logs.
//
// This member is required.
DeliveryDestinationConfiguration *types.DeliveryDestinationConfiguration
// A name for this delivery destination. This name must be unique for all delivery
// destinations in your account.
//
// This member is required.
Name *string
// The format for the logs that this delivery destination will receive.
OutputFormat types.OutputFormat
// An optional list of key-value pairs to associate with the resource. For more
// information about tagging, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
Tags map[string]string
noSmithyDocumentSerde
}
type PutDeliveryDestinationOutput struct {
// A structure containing information about the delivery destination that you just
// created or updated.
DeliveryDestination *types.DeliveryDestination
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutDeliveryDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutDeliveryDestination{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDeliveryDestination"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDeliveryDestinationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDeliveryDestination(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutDeliveryDestination(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutDeliveryDestination",
}
}

View file

@ -0,0 +1,166 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates and assigns an IAM policy that grants permissions to CloudWatch Logs to
// deliver logs cross-account to a specified destination in this account. To
// configure the delivery of logs from an Amazon Web Services service in another
// account to a logs delivery destination in the current account, you must do the
// following:
// - Create a delivery source, which is a logical object that represents the
// resource that is actually sending the logs. For more information, see
// PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html)
// .
// - Create a delivery destination, which is a logical object that represents
// the actual delivery destination. For more information, see
// PutDeliveryDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)
// .
// - Use this operation in the destination account to assign an IAM policy to
// the destination. This policy allows delivery to that destination.
// - Create a delivery by pairing exactly one delivery source and one delivery
// destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html)
// .
//
// Only some Amazon Web Services services support being configured as a delivery
// source. These services are listed as Supported [V2 Permissions] in the table at
// Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
// The contents of the policy must include two statements. One statement enables
// general logs delivery, and the other allows delivery to the chosen destination.
// See the examples for the needed policies.
func (c *Client) PutDeliveryDestinationPolicy(ctx context.Context, params *PutDeliveryDestinationPolicyInput, optFns ...func(*Options)) (*PutDeliveryDestinationPolicyOutput, error) {
if params == nil {
params = &PutDeliveryDestinationPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutDeliveryDestinationPolicy", params, optFns, c.addOperationPutDeliveryDestinationPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutDeliveryDestinationPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutDeliveryDestinationPolicyInput struct {
// The name of the delivery destination to assign this policy to.
//
// This member is required.
DeliveryDestinationName *string
// The contents of the policy.
//
// This member is required.
DeliveryDestinationPolicy *string
noSmithyDocumentSerde
}
type PutDeliveryDestinationPolicyOutput struct {
// The contents of the policy that you just created.
Policy *types.Policy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutDeliveryDestinationPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutDeliveryDestinationPolicy{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDeliveryDestinationPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDeliveryDestinationPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDeliveryDestinationPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutDeliveryDestinationPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutDeliveryDestinationPolicy",
}
}

View file

@ -0,0 +1,184 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates or updates a logical delivery source. A delivery source represents an
// Amazon Web Services resource that sends logs to an logs delivery destination.
// The destination can be CloudWatch Logs, Amazon S3, or Kinesis Data Firehose. To
// configure logs delivery between a delivery destination and an Amazon Web
// Services service that is supported as a delivery source, you must do the
// following:
// - Use PutDeliverySource to create a delivery source, which is a logical object
// that represents the resource that is actually sending the logs.
// - Use PutDeliveryDestination to create a delivery destination, which is a
// logical object that represents the actual delivery destination. For more
// information, see PutDeliveryDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html)
// .
// - If you are delivering logs cross-account, you must use
// PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html)
// in the destination account to assign an IAM policy to the destination. This
// policy allows delivery to that destination.
// - Use CreateDelivery to create a delivery by pairing exactly one delivery
// source and one delivery destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html)
// .
//
// You can configure a single delivery source to send logs to multiple
// destinations by creating multiple deliveries. You can also create multiple
// deliveries to configure multiple delivery sources to send logs to the same
// delivery destination. Only some Amazon Web Services services support being
// configured as a delivery source. These services are listed as Supported [V2
// Permissions] in the table at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html)
// If you use this operation to update an existing delivery source, all the current
// delivery source parameters are overwritten with the new parameter values that
// you specify.
func (c *Client) PutDeliverySource(ctx context.Context, params *PutDeliverySourceInput, optFns ...func(*Options)) (*PutDeliverySourceOutput, error) {
if params == nil {
params = &PutDeliverySourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutDeliverySource", params, optFns, c.addOperationPutDeliverySourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutDeliverySourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutDeliverySourceInput struct {
// Defines the type of log that the source is sending. For Amazon CodeWhisperer,
// the valid value is EVENT_LOGS .
//
// This member is required.
LogType *string
// A name for this delivery source. This name must be unique for all delivery
// sources in your account.
//
// This member is required.
Name *string
// The ARN of the Amazon Web Services resource that is generating and sending
// logs. For example,
// arn:aws:workmail:us-east-1:123456789012:organization/m-1234EXAMPLEabcd1234abcd1234abcd1234
//
// This member is required.
ResourceArn *string
// An optional list of key-value pairs to associate with the resource. For more
// information about tagging, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
Tags map[string]string
noSmithyDocumentSerde
}
type PutDeliverySourceOutput struct {
// A structure containing information about the delivery source that was just
// created or updated.
DeliverySource *types.DeliverySource
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutDeliverySourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDeliverySource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutDeliverySource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDeliverySource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDeliverySourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDeliverySource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPutDeliverySource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "PutDeliverySource",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -13,19 +14,16 @@ import (
// Creates or updates a destination. This operation is used only to create
// destinations for cross-account subscriptions. A destination encapsulates a
// physical resource (such as an Amazon Kinesis stream) and enables you to
// subscribe to a real-time stream of log events for a different account, ingested
// using PutLogEvents
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html).
// Through an access policy, a destination controls what is written to it. By
// physical resource (such as an Amazon Kinesis stream). With a destination, you
// can subscribe to a real-time stream of log events for a different account,
// ingested using PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html)
// . Through an access policy, a destination controls what is written to it. By
// default, PutDestination does not set any access policy with the destination,
// which means a cross-account user cannot call PutSubscriptionFilter
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutSubscriptionFilter.html)
// which means a cross-account user cannot call PutSubscriptionFilter (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutSubscriptionFilter.html)
// against this destination. To enable this, the destination owner must call
// PutDestinationPolicy
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html)
// after PutDestination. To perform a PutDestination operation, you must also have
// the iam:PassRole permission.
// PutDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html)
// after PutDestination . To perform a PutDestination operation, you must also
// have the iam:PassRole permission.
func (c *Client) PutDestination(ctx context.Context, params *PutDestinationInput, optFns ...func(*Options)) (*PutDestinationOutput, error) {
if params == nil {
params = &PutDestinationInput{}
@ -59,6 +57,10 @@ type PutDestinationInput struct {
// This member is required.
TargetArn *string
// An optional list of key-value pairs to associate with the resource. For more
// information about tagging, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
Tags map[string]string
noSmithyDocumentSerde
}
@ -74,6 +76,9 @@ type PutDestinationOutput struct {
}
func (c *Client) addOperationPutDestinationMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDestination{}, middleware.After)
if err != nil {
return err
@ -82,6 +87,13 @@ func (c *Client) addOperationPutDestinationMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDestination"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -100,16 +112,13 @@ func (c *Client) addOperationPutDestinationMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -118,12 +127,18 @@ func (c *Client) addOperationPutDestinationMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDestinationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDestination(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -133,6 +148,9 @@ func (c *Client) addOperationPutDestinationMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -140,7 +158,6 @@ func newServiceMetadataMiddleware_opPutDestination(region string) *awsmiddleware
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutDestination",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -11,13 +12,9 @@ import (
)
// Creates or updates an access policy associated with an existing destination. An
// access policy is an IAM policy document
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies_overview.html) that
// is used to authorize claims to register a subscription filter against a given
// destination. If multiple Amazon Web Services accounts are sending logs to this
// destination, each sender account must be listed separately in the policy. The
// policy does not support specifying * as the Principal or the use of the
// aws:PrincipalOrgId global key.
// access policy is an IAM policy document (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies_overview.html)
// that is used to authorize claims to register a subscription filter against a
// given destination.
func (c *Client) PutDestinationPolicy(ctx context.Context, params *PutDestinationPolicyInput, optFns ...func(*Options)) (*PutDestinationPolicyOutput, error) {
if params == nil {
params = &PutDestinationPolicyInput{}
@ -48,13 +45,12 @@ type PutDestinationPolicyInput struct {
// Specify true if you are updating an existing destination policy to grant
// permission to an organization ID instead of granting permission to individual
// AWS accounts. Before you update a destination policy this way, you must first
// update the subscription filters in the accounts that send logs to this
// destination. If you do not, the subscription filters might stop working. By
// specifying true for forceUpdate, you are affirming that you have already updated
// the subscription filters. For more information, see Updating an existing
// cross-account subscription
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Cross-Account-Log_Subscription-Update.html)
// Amazon Web Services accounts. Before you update a destination policy this way,
// you must first update the subscription filters in the accounts that send logs to
// this destination. If you do not, the subscription filters might stop working. By
// specifying true for forceUpdate , you are affirming that you have already
// updated the subscription filters. For more information, see Updating an
// existing cross-account subscription (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Cross-Account-Log_Subscription-Update.html)
// If you omit this parameter, the default of false is used.
ForceUpdate *bool
@ -69,6 +65,9 @@ type PutDestinationPolicyOutput struct {
}
func (c *Client) addOperationPutDestinationPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutDestinationPolicy{}, middleware.After)
if err != nil {
return err
@ -77,6 +76,13 @@ func (c *Client) addOperationPutDestinationPolicyMiddlewares(stack *middleware.S
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutDestinationPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -95,16 +101,13 @@ func (c *Client) addOperationPutDestinationPolicyMiddlewares(stack *middleware.S
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -113,12 +116,18 @@ func (c *Client) addOperationPutDestinationPolicyMiddlewares(stack *middleware.S
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutDestinationPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutDestinationPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -128,6 +137,9 @@ func (c *Client) addOperationPutDestinationPolicyMiddlewares(stack *middleware.S
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -135,7 +147,6 @@ func newServiceMetadataMiddleware_opPutDestinationPolicy(region string) *awsmidd
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutDestinationPolicy",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -11,45 +12,35 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Uploads a batch of log events to the specified log stream. You must include the
// sequence token obtained from the response of the previous call. An upload in a
// newly created log stream does not require a sequence token. You can also get the
// sequence token in the expectedSequenceToken field from
// InvalidSequenceTokenException. If you call PutLogEvents twice within a narrow
// time period using the same value for sequenceToken, both calls might be
// successful or one might be rejected. The batch of events must satisfy the
// following constraints:
// Uploads a batch of log events to the specified log stream. The sequence token
// is now ignored in PutLogEvents actions. PutLogEvents actions are always
// accepted and never return InvalidSequenceTokenException or
// DataAlreadyAcceptedException even if the sequence token is not valid. You can
// use parallel PutLogEvents actions on the same log stream. The batch of events
// must satisfy the following constraints:
// - The maximum batch size is 1,048,576 bytes. This size is calculated as the
// sum of all event messages in UTF-8, plus 26 bytes for each log event.
// - None of the log events in the batch can be more than 2 hours in the future.
// - None of the log events in the batch can be more than 14 days in the past.
// Also, none of the log events can be from earlier than the retention period of
// the log group.
// - The log events in the batch must be in chronological order by their
// timestamp. The timestamp is the time that the event occurred, expressed as the
// number of milliseconds after Jan 1, 1970 00:00:00 UTC . (In Amazon Web
// Services Tools for PowerShell and the Amazon Web Services SDK for .NET, the
// timestamp is specified in .NET format: yyyy-mm-ddThh:mm:ss . For example,
// 2017-09-15T13:45:30 .)
// - A batch of log events in a single request cannot span more than 24 hours.
// Otherwise, the operation fails.
// - Each log event can be no larger than 256 KB.
// - The maximum number of log events in a batch is 10,000.
// - The quota of five requests per second per log stream has been removed.
// Instead, PutLogEvents actions are throttled based on a per-second per-account
// quota. You can request an increase to the per-second throttling quota by using
// the Service Quotas service.
//
// * The maximum batch size is 1,048,576 bytes. This size
// is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each
// log event.
//
// * None of the log events in the batch can be more than 2 hours in
// the future.
//
// * None of the log events in the batch can be older than 14 days or
// older than the retention period of the log group.
//
// * The log events in the batch
// must be in chronological order by their timestamp. The timestamp is the time the
// event occurred, expressed as the number of milliseconds after Jan 1, 1970
// 00:00:00 UTC. (In Amazon Web Services Tools for PowerShell and the Amazon Web
// Services SDK for .NET, the timestamp is specified in .NET format:
// yyyy-mm-ddThh:mm:ss. For example, 2017-09-15T13:45:30.)
//
// * A batch of log events
// in a single request cannot span more than 24 hours. Otherwise, the operation
// fails.
//
// * The maximum number of log events in a batch is 10,000.
//
// * There is a
// quota of 5 requests per second per log stream. Additional requests are
// throttled. This quota can't be changed.
//
// If a call to PutLogEvents returns
// "UnrecognizedClientException" the most likely cause is an invalid Amazon Web
// Services access key ID or secret key.
// If a call to PutLogEvents returns "UnrecognizedClientException" the most likely
// cause is a non-valid Amazon Web Services access key ID or secret key.
func (c *Client) PutLogEvents(ctx context.Context, params *PutLogEventsInput, optFns ...func(*Options)) (*PutLogEventsOutput, error) {
if params == nil {
params = &PutLogEventsInput{}
@ -82,12 +73,11 @@ type PutLogEventsInput struct {
// This member is required.
LogStreamName *string
// The sequence token obtained from the response of the previous PutLogEvents call.
// An upload in a newly created log stream does not require a sequence token. You
// can also get the sequence token using DescribeLogStreams
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html).
// If you call PutLogEvents twice within a narrow time period using the same value
// for sequenceToken, both calls might be successful or one might be rejected.
// The sequence token obtained from the response of the previous PutLogEvents
// call. The sequenceToken parameter is now ignored in PutLogEvents actions.
// PutLogEvents actions are now accepted and never return
// InvalidSequenceTokenException or DataAlreadyAcceptedException even if the
// sequence token is not valid.
SequenceToken *string
noSmithyDocumentSerde
@ -95,7 +85,11 @@ type PutLogEventsInput struct {
type PutLogEventsOutput struct {
// The next sequence token.
// The next sequence token. This field has been deprecated. The sequence token is
// now ignored in PutLogEvents actions. PutLogEvents actions are always accepted
// even if the sequence token is not valid. You can use parallel PutLogEvents
// actions on the same log stream and you do not need to wait for the response of a
// previous PutLogEvents action to obtain the nextSequenceToken value.
NextSequenceToken *string
// The rejected events.
@ -108,6 +102,9 @@ type PutLogEventsOutput struct {
}
func (c *Client) addOperationPutLogEventsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutLogEvents{}, middleware.After)
if err != nil {
return err
@ -116,6 +113,13 @@ func (c *Client) addOperationPutLogEventsMiddlewares(stack *middleware.Stack, op
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutLogEvents"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -134,16 +138,13 @@ func (c *Client) addOperationPutLogEventsMiddlewares(stack *middleware.Stack, op
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -152,12 +153,18 @@ func (c *Client) addOperationPutLogEventsMiddlewares(stack *middleware.Stack, op
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutLogEventsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutLogEvents(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -167,6 +174,9 @@ func (c *Client) addOperationPutLogEventsMiddlewares(stack *middleware.Stack, op
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -174,7 +184,6 @@ func newServiceMetadataMiddleware_opPutLogEvents(region string) *awsmiddleware.R
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutLogEvents",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -12,22 +13,20 @@ import (
)
// Creates or updates a metric filter and associates it with the specified log
// group. Metric filters allow you to configure rules to extract metric data from
// log events ingested through PutLogEvents
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html).
// The maximum number of metric filters that can be associated with a log group is
// 100. When you create a metric filter, you can also optionally assign a unit and
// dimensions to the metric that is created. Metrics extracted from log events are
// charged as custom metrics. To prevent unexpected high charges, do not specify
// high-cardinality fields such as IPAddress or requestID as dimensions. Each
// different value found for a dimension is treated as a separate metric and
// accrues charges as a separate custom metric. To help prevent accidental high
// charges, Amazon disables a metric filter if it generates 1000 different
// name/value pairs for the dimensions that you have specified within a certain
// amount of time. You can also set up a billing alarm to alert you if your charges
// are higher than expected. For more information, see Creating a Billing Alarm to
// Monitor Your Estimated Amazon Web Services Charges
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html).
// group. With metric filters, you can configure rules to extract metric data from
// log events ingested through PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html)
// . The maximum number of metric filters that can be associated with a log group
// is 100. When you create a metric filter, you can also optionally assign a unit
// and dimensions to the metric that is created. Metrics extracted from log events
// are charged as custom metrics. To prevent unexpected high charges, do not
// specify high-cardinality fields such as IPAddress or requestID as dimensions.
// Each different value found for a dimension is treated as a separate metric and
// accrues charges as a separate custom metric. CloudWatch Logs might disable a
// metric filter if it generates 1,000 different name/value pairs for your
// specified dimensions within one hour. You can also set up a billing alarm to
// alert you if your charges are higher than expected. For more information, see
// Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html)
// .
func (c *Client) PutMetricFilter(ctx context.Context, params *PutMetricFilterInput, optFns ...func(*Options)) (*PutMetricFilterOutput, error) {
if params == nil {
params = &PutMetricFilterInput{}
@ -76,6 +75,9 @@ type PutMetricFilterOutput struct {
}
func (c *Client) addOperationPutMetricFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutMetricFilter{}, middleware.After)
if err != nil {
return err
@ -84,6 +86,13 @@ func (c *Client) addOperationPutMetricFilterMiddlewares(stack *middleware.Stack,
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutMetricFilter"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -102,16 +111,13 @@ func (c *Client) addOperationPutMetricFilterMiddlewares(stack *middleware.Stack,
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -120,12 +126,18 @@ func (c *Client) addOperationPutMetricFilterMiddlewares(stack *middleware.Stack,
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutMetricFilterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutMetricFilter(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -135,6 +147,9 @@ func (c *Client) addOperationPutMetricFilterMiddlewares(stack *middleware.Stack,
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -142,7 +157,6 @@ func newServiceMetadataMiddleware_opPutMetricFilter(region string) *awsmiddlewar
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutMetricFilter",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -11,16 +12,15 @@ import (
)
// Creates or updates a query definition for CloudWatch Logs Insights. For more
// information, see Analyzing Log Data with CloudWatch Logs Insights
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html).
// To update a query definition, specify its queryDefinitionId in your request. The
// values of name, queryString, and logGroupNames are changed to the values that
// you specify in your update operation. No current values are retained from the
// current query definition. For example, if you update a current query definition
// that includes log groups, and you don't specify the logGroupNames parameter in
// your update operation, the query definition changes to contain no log groups.
// You must have the logs:PutQueryDefinition permission to be able to perform this
// operation.
// information, see Analyzing Log Data with CloudWatch Logs Insights (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)
// . To update a query definition, specify its queryDefinitionId in your request.
// The values of name , queryString , and logGroupNames are changed to the values
// that you specify in your update operation. No current values are retained from
// the current query definition. For example, imagine updating a current query
// definition that includes log groups. If you don't specify the logGroupNames
// parameter in your update operation, the query definition changes to contain no
// log groups. You must have the logs:PutQueryDefinition permission to be able to
// perform this operation.
func (c *Client) PutQueryDefinition(ctx context.Context, params *PutQueryDefinitionInput, optFns ...func(*Options)) (*PutQueryDefinitionOutput, error) {
if params == nil {
params = &PutQueryDefinitionInput{}
@ -38,22 +38,26 @@ func (c *Client) PutQueryDefinition(ctx context.Context, params *PutQueryDefinit
type PutQueryDefinitionInput struct {
// A name for the query definition. If you are saving a lot of query definitions,
// we recommend that you name them so that you can easily find the ones you want by
// A name for the query definition. If you are saving numerous query definitions,
// we recommend that you name them. This way, you can find the ones you want by
// using the first part of the name as a filter in the queryDefinitionNamePrefix
// parameter of DescribeQueryDefinitions
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html).
// parameter of DescribeQueryDefinitions (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html)
// .
//
// This member is required.
Name *string
// The query string to use for this definition. For more information, see
// CloudWatch Logs Insights Query Syntax
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html).
// CloudWatch Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)
// .
//
// This member is required.
QueryString *string
// Used as an idempotency token, to avoid returning an exception if the service
// receives the same request twice because of a network error.
ClientToken *string
// Use this parameter to include specific log groups as part of your query
// definition. If you are updating a query definition and you omit this parameter,
// then the updated definition will contain no log groups.
@ -61,8 +65,7 @@ type PutQueryDefinitionInput struct {
// If you are updating a query definition, use this parameter to specify the ID of
// the query definition that you want to update. You can use
// DescribeQueryDefinitions
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html)
// DescribeQueryDefinitions (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html)
// to retrieve the IDs of your saved query definitions. If you are creating a query
// definition, do not specify this parameter. CloudWatch generates a unique ID for
// the new query definition and include it in the response to this operation.
@ -83,6 +86,9 @@ type PutQueryDefinitionOutput struct {
}
func (c *Client) addOperationPutQueryDefinitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutQueryDefinition{}, middleware.After)
if err != nil {
return err
@ -91,6 +97,13 @@ func (c *Client) addOperationPutQueryDefinitionMiddlewares(stack *middleware.Sta
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutQueryDefinition"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -109,16 +122,13 @@ func (c *Client) addOperationPutQueryDefinitionMiddlewares(stack *middleware.Sta
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -127,12 +137,21 @@ func (c *Client) addOperationPutQueryDefinitionMiddlewares(stack *middleware.Sta
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opPutQueryDefinitionMiddleware(stack, options); err != nil {
return err
}
if err = addOpPutQueryDefinitionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutQueryDefinition(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -142,14 +161,49 @@ func (c *Client) addOperationPutQueryDefinitionMiddlewares(stack *middleware.Sta
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
type idempotencyToken_initializeOpPutQueryDefinition struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpPutQueryDefinition) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpPutQueryDefinition) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*PutQueryDefinitionInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *PutQueryDefinitionInput ")
}
if input.ClientToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opPutQueryDefinitionMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpPutQueryDefinition{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opPutQueryDefinition(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutQueryDefinition",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -11,9 +12,9 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates or updates a resource policy allowing other Amazon Web Services services
// to put log events to this account, such as Amazon Route 53. An account can have
// up to 10 resource policies per Amazon Web Services Region.
// Creates or updates a resource policy allowing other Amazon Web Services
// services to put log events to this account, such as Amazon Route 53. An account
// can have up to 10 resource policies per Amazon Web Services Region.
func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolicyInput, optFns ...func(*Options)) (*PutResourcePolicyOutput, error) {
if params == nil {
params = &PutResourcePolicyInput{}
@ -36,18 +37,17 @@ type PutResourcePolicyInput struct {
// parameter is required. The following example creates a resource policy enabling
// the Route 53 service to put DNS query logs in to the specified log group.
// Replace "logArn" with the ARN of your CloudWatch Logs resource, such as a log
// group or log stream. CloudWatch Logs also supports aws:SourceArn
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn)
// and aws:SourceAccount
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount)
// group or log stream. CloudWatch Logs also supports aws:SourceArn (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn)
// and aws:SourceAccount (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount)
// condition context keys. In the example resource policy, you would replace the
// value of SourceArn with the resource making the call from Route 53 to CloudWatch
// Logs and replace the value of SourceAccount with the Amazon Web Services account
// ID making that call. { "Version": "2012-10-17", "Statement": [ { "Sid":
// "Route53LogsToCloudWatchLogs", "Effect": "Allow", "Principal": { "Service": [
// "route53.amazonaws.com" ] }, "Action": "logs:PutLogEvents", "Resource":
// "logArn", "Condition": { "ArnLike": { "aws:SourceArn": "myRoute53ResourceArn" },
// "StringEquals": { "aws:SourceAccount": "myAwsAccountId" } } } ] }
// value of SourceArn with the resource making the call from Route 53 to
// CloudWatch Logs. You would also replace the value of SourceAccount with the
// Amazon Web Services account ID making that call. { "Version": "2012-10-17",
// "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", "Effect": "Allow",
// "Principal": { "Service": [ "route53.amazonaws.com" ] }, "Action":
// "logs:PutLogEvents", "Resource": "logArn", "Condition": { "ArnLike": {
// "aws:SourceArn": "myRoute53ResourceArn" }, "StringEquals": {
// "aws:SourceAccount": "myAwsAccountId" } } } ] }
PolicyDocument *string
// Name of the new policy. This parameter is required.
@ -68,6 +68,9 @@ type PutResourcePolicyOutput struct {
}
func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutResourcePolicy{}, middleware.After)
if err != nil {
return err
@ -76,6 +79,13 @@ func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stac
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutResourcePolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -94,16 +104,13 @@ func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stac
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -112,9 +119,15 @@ func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stac
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutResourcePolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -124,6 +137,9 @@ func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stac
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -131,7 +147,6 @@ func newServiceMetadataMiddleware_opPutResourcePolicy(region string) *awsmiddlew
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutResourcePolicy",
}
}

View file

@ -4,15 +4,30 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Sets the retention of the specified log group. A retention policy allows you to
// Sets the retention of the specified log group. With a retention policy, you can
// configure the number of days for which to retain log events in the specified log
// group.
// group. CloudWatch Logs doesnt immediately delete log events when they reach
// their retention setting. It typically takes up to 72 hours after that before log
// events are deleted, but in rare situations might take longer. To illustrate,
// imagine that you change a log group to have a longer retention setting when it
// contains log events that are past the expiration date, but havent been deleted.
// Those log events will take up to 72 hours to be deleted after the new retention
// date is reached. To make sure that log data is deleted permanently, keep a log
// group at its lower retention setting until 72 hours after the previous retention
// period ends. Alternatively, wait to change the retention setting until you
// confirm that the earlier log events are deleted. When log events reach their
// retention setting they are marked for deletion. After they are marked for
// deletion, they do not add to your archival storage costs anymore, even if they
// are not actually deleted until later. These log events marked for deletion are
// also not included when you use an API to retrieve the storedBytes value to see
// how many bytes a log group is storing.
func (c *Client) PutRetentionPolicy(ctx context.Context, params *PutRetentionPolicyInput, optFns ...func(*Options)) (*PutRetentionPolicyOutput, error) {
if params == nil {
params = &PutRetentionPolicyInput{}
@ -35,11 +50,11 @@ type PutRetentionPolicyInput struct {
// This member is required.
LogGroupName *string
// The number of days to retain the log events in the specified log group. Possible
// values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827,
// 2192, 2557, 2922, 3288, and 3653. To set a log group to never have log events
// expire, use DeleteRetentionPolicy
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html).
// The number of days to retain the log events in the specified log group.
// Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545,
// 731, 1096, 1827, 2192, 2557, 2922, 3288, and 3653. To set a log group so that
// its log events do not expire, use DeleteRetentionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html)
// .
//
// This member is required.
RetentionInDays *int32
@ -55,6 +70,9 @@ type PutRetentionPolicyOutput struct {
}
func (c *Client) addOperationPutRetentionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutRetentionPolicy{}, middleware.After)
if err != nil {
return err
@ -63,6 +81,13 @@ func (c *Client) addOperationPutRetentionPolicyMiddlewares(stack *middleware.Sta
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutRetentionPolicy"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -81,16 +106,13 @@ func (c *Client) addOperationPutRetentionPolicyMiddlewares(stack *middleware.Sta
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -99,12 +121,18 @@ func (c *Client) addOperationPutRetentionPolicyMiddlewares(stack *middleware.Sta
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutRetentionPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRetentionPolicy(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -114,6 +142,9 @@ func (c *Client) addOperationPutRetentionPolicyMiddlewares(stack *middleware.Sta
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -121,7 +152,6 @@ func newServiceMetadataMiddleware_opPutRetentionPolicy(region string) *awsmiddle
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutRetentionPolicy",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -12,31 +13,25 @@ import (
)
// Creates or updates a subscription filter and associates it with the specified
// log group. Subscription filters allow you to subscribe to a real-time stream of
// log events ingested through PutLogEvents
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html)
// log group. With subscription filters, you can subscribe to a real-time stream of
// log events ingested through PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html)
// and have them delivered to a specific destination. When log events are sent to
// the receiving service, they are Base64 encoded and compressed with the gzip
// the receiving service, they are Base64 encoded and compressed with the GZIP
// format. The following destinations are supported for subscription filters:
// - An Amazon Kinesis data stream belonging to the same account as the
// subscription filter, for same-account delivery.
// - A logical destination created with PutDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html)
// that belongs to a different account, for cross-account delivery. We currently
// support Kinesis Data Streams and Kinesis Data Firehose as logical destinations.
// - An Amazon Kinesis Data Firehose delivery stream that belongs to the same
// account as the subscription filter, for same-account delivery.
// - An Lambda function that belongs to the same account as the subscription
// filter, for same-account delivery.
//
// * An
// Amazon Kinesis stream belonging to the same account as the subscription filter,
// for same-account delivery.
//
// * A logical destination that belongs to a different
// account, for cross-account delivery.
//
// * An Amazon Kinesis Firehose delivery
// stream that belongs to the same account as the subscription filter, for
// same-account delivery.
//
// * An Lambda function that belongs to the same account as
// the subscription filter, for same-account delivery.
//
// Each log group can have up
// to two subscription filters associated with it. If you are updating an existing
// filter, you must specify the correct name in filterName. To perform a
// PutSubscriptionFilter operation, you must also have the iam:PassRole permission.
// Each log group can have up to two subscription filters associated with it. If
// you are updating an existing filter, you must specify the correct name in
// filterName . To perform a PutSubscriptionFilter operation for any destination
// except a Lambda function, you must also have the iam:PassRole permission.
func (c *Client) PutSubscriptionFilter(ctx context.Context, params *PutSubscriptionFilterInput, optFns ...func(*Options)) (*PutSubscriptionFilterOutput, error) {
if params == nil {
params = &PutSubscriptionFilterInput{}
@ -56,31 +51,26 @@ type PutSubscriptionFilterInput struct {
// The ARN of the destination to deliver matching log events to. Currently, the
// supported destinations are:
//
// * An Amazon Kinesis stream belonging to the same
// account as the subscription filter, for same-account delivery.
//
// * A logical
// destination (specified using an ARN) belonging to a different account, for
// cross-account delivery. If you are setting up a cross-account subscription, the
// destination must have an IAM policy associated with it that allows the sender to
// send logs to the destination. For more information, see PutDestinationPolicy
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html).
//
// *
// An Amazon Kinesis Firehose delivery stream belonging to the same account as the
// subscription filter, for same-account delivery.
//
// * A Lambda function belonging
// to the same account as the subscription filter, for same-account delivery.
// - An Amazon Kinesis stream belonging to the same account as the subscription
// filter, for same-account delivery.
// - A logical destination (specified using an ARN) belonging to a different
// account, for cross-account delivery. If you're setting up a cross-account
// subscription, the destination must have an IAM policy associated with it. The
// IAM policy must allow the sender to send logs to the destination. For more
// information, see PutDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html)
// .
// - A Kinesis Data Firehose delivery stream belonging to the same account as
// the subscription filter, for same-account delivery.
// - A Lambda function belonging to the same account as the subscription filter,
// for same-account delivery.
//
// This member is required.
DestinationArn *string
// A name for the subscription filter. If you are updating an existing filter, you
// must specify the correct name in filterName. To find the name of the filter
// currently associated with a log group, use DescribeSubscriptionFilters
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeSubscriptionFilters.html).
// must specify the correct name in filterName . To find the name of the filter
// currently associated with a log group, use DescribeSubscriptionFilters (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeSubscriptionFilters.html)
// .
//
// This member is required.
FilterName *string
@ -98,7 +88,7 @@ type PutSubscriptionFilterInput struct {
// The method used to distribute log data to the destination. By default, log data
// is grouped by log stream, but the grouping can be set to random for a more even
// distribution. This property is only applicable when the destination is an Amazon
// Kinesis stream.
// Kinesis data stream.
Distribution types.Distribution
// The ARN of an IAM role that grants CloudWatch Logs permissions to deliver
@ -117,6 +107,9 @@ type PutSubscriptionFilterOutput struct {
}
func (c *Client) addOperationPutSubscriptionFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutSubscriptionFilter{}, middleware.After)
if err != nil {
return err
@ -125,6 +118,13 @@ func (c *Client) addOperationPutSubscriptionFilterMiddlewares(stack *middleware.
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "PutSubscriptionFilter"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -143,16 +143,13 @@ func (c *Client) addOperationPutSubscriptionFilterMiddlewares(stack *middleware.
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -161,12 +158,18 @@ func (c *Client) addOperationPutSubscriptionFilterMiddlewares(stack *middleware.
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpPutSubscriptionFilterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutSubscriptionFilter(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -176,6 +179,9 @@ func (c *Client) addOperationPutSubscriptionFilterMiddlewares(stack *middleware.
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -183,7 +189,6 @@ func newServiceMetadataMiddleware_opPutSubscriptionFilter(region string) *awsmid
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "PutSubscriptionFilter",
}
}

View file

@ -0,0 +1,323 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithysync "github.com/aws/smithy-go/sync"
smithyhttp "github.com/aws/smithy-go/transport/http"
"sync"
)
// Starts a Live Tail streaming session for one or more log groups. A Live Tail
// session returns a stream of log events that have been recently ingested in the
// log groups. For more information, see Use Live Tail to view logs in near real
// time (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs_LiveTail.html)
// . The response to this operation is a response stream, over which the server
// sends live log events and the client receives them. The following objects are
// sent over the stream:
// - A single LiveTailSessionStart (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_LiveTailSessionStart.html)
// object is sent at the start of the session.
// - Every second, a LiveTailSessionUpdate (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_LiveTailSessionUpdate.html)
// object is sent. Each of these objects contains an array of the actual log
// events. If no new log events were ingested in the past second, the
// LiveTailSessionUpdate object will contain an empty array. The array of log
// events contained in a LiveTailSessionUpdate can include as many as 500 log
// events. If the number of log events matching the request exceeds 500 per second,
// the log events are sampled down to 500 log events to be included in each
// LiveTailSessionUpdate object. If your client consumes the log events slower
// than the server produces them, CloudWatch Logs buffers up to 10
// LiveTailSessionUpdate events or 5000 log events, after which it starts
// dropping the oldest events.
// - A SessionStreamingException (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_SessionStreamingException.html)
// object is returned if an unknown error occurs on the server side.
// - A SessionTimeoutException (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_SessionTimeoutException.html)
// object is returned when the session times out, after it has been kept open for
// three hours.
//
// You can end a session before it times out by closing the session stream or by
// closing the client that is receiving the stream. The session also ends if the
// established connection between the client and the server breaks. For examples of
// using an SDK to start a Live Tail session, see Start a Live Tail session using
// an Amazon Web Services SDK (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/example_cloudwatch-logs_StartLiveTail_section.html)
// .
func (c *Client) StartLiveTail(ctx context.Context, params *StartLiveTailInput, optFns ...func(*Options)) (*StartLiveTailOutput, error) {
if params == nil {
params = &StartLiveTailInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartLiveTail", params, optFns, c.addOperationStartLiveTailMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartLiveTailOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartLiveTailInput struct {
// An array where each item in the array is a log group to include in the Live
// Tail session. Specify each log group by its ARN. If you specify an ARN, the ARN
// can't end with an asterisk (*). You can include up to 10 log groups.
//
// This member is required.
LogGroupIdentifiers []string
// An optional pattern to use to filter the results to include only log events
// that match the pattern. For example, a filter pattern of error 404 causes only
// log events that include both error and 404 to be included in the Live Tail
// stream. Regular expression filter patterns are supported. For more information
// about filter pattern syntax, see Filter and Pattern Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
// .
LogEventFilterPattern *string
// If you specify this parameter, then only log events in the log streams that
// have names that start with the prefixes that you specify here are included in
// the Live Tail session. If you specify this field, you can't also specify the
// logStreamNames field. You can specify this parameter only if you specify only
// one log group in logGroupIdentifiers .
LogStreamNamePrefixes []string
// If you specify this parameter, then only log events in the log streams that you
// specify here are included in the Live Tail session. If you specify this field,
// you can't also specify the logStreamNamePrefixes field. You can specify this
// parameter only if you specify only one log group in logGroupIdentifiers .
LogStreamNames []string
noSmithyDocumentSerde
}
type StartLiveTailOutput struct {
eventStream *StartLiveTailEventStream
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
// GetStream returns the type to interact with the event stream.
func (o *StartLiveTailOutput) GetStream() *StartLiveTailEventStream {
return o.eventStream
}
func (c *Client) addOperationStartLiveTailMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartLiveTail{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartLiveTail{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "StartLiveTail"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addEventStreamStartLiveTailMiddleware(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addEndpointPrefix_opStartLiveTailMiddleware(stack); err != nil {
return err
}
if err = addOpStartLiveTailValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLiveTail(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
type endpointPrefix_opStartLiveTailMiddleware struct {
}
func (*endpointPrefix_opStartLiveTailMiddleware) ID() string {
return "EndpointHostPrefix"
}
func (m *endpointPrefix_opStartLiveTailMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) {
return next.HandleFinalize(ctx, in)
}
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
req.URL.Host = "streaming-" + req.URL.Host
return next.HandleFinalize(ctx, in)
}
func addEndpointPrefix_opStartLiveTailMiddleware(stack *middleware.Stack) error {
return stack.Finalize.Insert(&endpointPrefix_opStartLiveTailMiddleware{}, "ResolveEndpointV2", middleware.After)
}
func newServiceMetadataMiddleware_opStartLiveTail(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "StartLiveTail",
}
}
// StartLiveTailEventStream provides the event stream handling for the StartLiveTail operation.
//
// For testing and mocking the event stream this type should be initialized via
// the NewStartLiveTailEventStream constructor function. Using the functional options
// to pass in nested mock behavior.
type StartLiveTailEventStream struct {
// StartLiveTailResponseStreamReader is the EventStream reader for the
// StartLiveTailResponseStream events. This value is automatically set by the SDK
// when the API call is made Use this member when unit testing your code with the
// SDK to mock out the EventStream Reader.
//
// Must not be nil.
Reader StartLiveTailResponseStreamReader
done chan struct{}
closeOnce sync.Once
err *smithysync.OnceErr
}
// NewStartLiveTailEventStream initializes an StartLiveTailEventStream.
// This function should only be used for testing and mocking the StartLiveTailEventStream
// stream within your application.
//
// The Reader member must be set before reading events from the stream.
func NewStartLiveTailEventStream(optFns ...func(*StartLiveTailEventStream)) *StartLiveTailEventStream {
es := &StartLiveTailEventStream{
done: make(chan struct{}),
err: smithysync.NewOnceErr(),
}
for _, fn := range optFns {
fn(es)
}
return es
}
// Events returns a channel to read events from.
func (es *StartLiveTailEventStream) Events() <-chan types.StartLiveTailResponseStream {
return es.Reader.Events()
}
// Close closes the stream. This will also cause the stream to be closed.
// Close must be called when done using the stream API. Not calling Close
// may result in resource leaks.
//
// Will close the underlying EventStream writer and reader, and no more events can be
// sent or received.
func (es *StartLiveTailEventStream) Close() error {
es.closeOnce.Do(es.safeClose)
return es.Err()
}
func (es *StartLiveTailEventStream) safeClose() {
close(es.done)
es.Reader.Close()
}
// Err returns any error that occurred while reading or writing EventStream Events
// from the service API's response. Returns nil if there were no errors.
func (es *StartLiveTailEventStream) Err() error {
if err := es.err.Err(); err != nil {
return err
}
if err := es.Reader.Err(); err != nil {
return err
}
return nil
}
func (es *StartLiveTailEventStream) waitStreamClose() {
type errorSet interface {
ErrorSet() <-chan struct{}
}
var outputErrCh <-chan struct{}
if v, ok := es.Reader.(errorSet); ok {
outputErrCh = v.ErrorSet()
}
var outputClosedCh <-chan struct{}
if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok {
outputClosedCh = v.Closed()
}
select {
case <-es.done:
case <-outputErrCh:
es.err.SetError(es.Reader.Err())
es.Close()
case <-outputClosedCh:
if err := es.Reader.Err(); err != nil {
es.err.SetError(es.Reader.Err())
}
es.Close()
}
}

View file

@ -4,19 +4,32 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Schedules a query of a log group using CloudWatch Logs Insights. You specify the
// log group and time range to query and the query string to use. For more
// information, see CloudWatch Logs Insights Query Syntax
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html).
// Queries time out after 15 minutes of execution. If your queries are timing out,
// reduce the time range being searched or partition your query into a number of
// queries.
// Schedules a query of a log group using CloudWatch Logs Insights. You specify
// the log group and time range to query and the query string to use. For more
// information, see CloudWatch Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)
// . After you run a query using StartQuery , the query results are stored by
// CloudWatch Logs. You can use GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html)
// to retrieve the results of a query, using the queryId that StartQuery returns.
// If you have associated a KMS key with the query results in this account, then
// StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html)
// uses that key to encrypt the results when it stores them. If no key is
// associated with query results, the query results are encrypted with the default
// CloudWatch Logs encryption method. Queries time out after 60 minutes of runtime.
// If your queries are timing out, reduce the time range being searched or
// partition your query into a number of queries. If you are using CloudWatch
// cross-account observability, you can use this operation in a monitoring account
// to start a query in a linked source account. For more information, see
// CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html)
// . For a cross-account StartQuery operation, the query definition must be
// defined in the monitoring account. You can have up to 30 concurrent CloudWatch
// Logs insights queries, including queries that have been added to dashboards.
func (c *Client) StartQuery(ctx context.Context, params *StartQueryInput, optFns ...func(*Options)) (*StartQueryOutput, error) {
if params == nil {
params = &StartQueryInput{}
@ -34,23 +47,23 @@ func (c *Client) StartQuery(ctx context.Context, params *StartQueryInput, optFns
type StartQueryInput struct {
// The end of the time range to query. The range is inclusive, so the specified end
// time is included in the query. Specified as epoch time, the number of seconds
// since January 1, 1970, 00:00:00 UTC.
// The end of the time range to query. The range is inclusive, so the specified
// end time is included in the query. Specified as epoch time, the number of
// seconds since January 1, 1970, 00:00:00 UTC .
//
// This member is required.
EndTime *int64
// The query string to use. For more information, see CloudWatch Logs Insights
// Query Syntax
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html).
// Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html)
// .
//
// This member is required.
QueryString *string
// The beginning of the time range to query. The range is inclusive, so the
// specified start time is included in the query. Specified as epoch time, the
// number of seconds since January 1, 1970, 00:00:00 UTC.
// number of seconds since January 1, 1970, 00:00:00 UTC .
//
// This member is required.
StartTime *int64
@ -60,13 +73,23 @@ type StartQueryInput struct {
// returned. The default is 1000.
Limit *int32
// The log group on which to perform the query. A StartQuery operation must include
// a logGroupNames or a logGroupName parameter, but not both.
// The list of log groups to query. You can include up to 50 log groups. You can
// specify them by the log group name or ARN. If a log group that you're querying
// is in a source account and you're using a monitoring account, you must specify
// the ARN of the log group here. The query definition must also be defined in the
// monitoring account. If you specify an ARN, the ARN can't end with an asterisk
// (*). A StartQuery operation must include exactly one of the following
// parameters: logGroupName , logGroupNames , or logGroupIdentifiers .
LogGroupIdentifiers []string
// The log group on which to perform the query. A StartQuery operation must
// include exactly one of the following parameters: logGroupName , logGroupNames ,
// or logGroupIdentifiers .
LogGroupName *string
// The list of log groups to be queried. You can include up to 20 log groups. A
// StartQuery operation must include a logGroupNames or a logGroupName parameter,
// but not both.
// The list of log groups to be queried. You can include up to 50 log groups. A
// StartQuery operation must include exactly one of the following parameters:
// logGroupName , logGroupNames , or logGroupIdentifiers .
LogGroupNames []string
noSmithyDocumentSerde
@ -84,6 +107,9 @@ type StartQueryOutput struct {
}
func (c *Client) addOperationStartQueryMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartQuery{}, middleware.After)
if err != nil {
return err
@ -92,6 +118,13 @@ func (c *Client) addOperationStartQueryMiddlewares(stack *middleware.Stack, opti
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "StartQuery"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -110,16 +143,13 @@ func (c *Client) addOperationStartQueryMiddlewares(stack *middleware.Stack, opti
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -128,12 +158,18 @@ func (c *Client) addOperationStartQueryMiddlewares(stack *middleware.Stack, opti
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpStartQueryValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartQuery(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -143,6 +179,9 @@ func (c *Client) addOperationStartQueryMiddlewares(stack *middleware.Stack, opti
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -150,7 +189,6 @@ func newServiceMetadataMiddleware_opStartQuery(region string) *awsmiddleware.Reg
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "StartQuery",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
@ -30,7 +31,7 @@ func (c *Client) StopQuery(ctx context.Context, params *StopQueryInput, optFns .
type StopQueryInput struct {
// The ID number of the query to stop. To find this ID number, use DescribeQueries.
// The ID number of the query to stop. To find this ID number, use DescribeQueries .
//
// This member is required.
QueryId *string
@ -50,6 +51,9 @@ type StopQueryOutput struct {
}
func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStopQuery{}, middleware.After)
if err != nil {
return err
@ -58,6 +62,13 @@ func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, optio
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "StopQuery"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -76,16 +87,13 @@ func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, optio
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -94,12 +102,18 @@ func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, optio
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpStopQueryValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopQuery(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -109,6 +123,9 @@ func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, optio
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -116,7 +133,6 @@ func newServiceMetadataMiddleware_opStopQuery(region string) *awsmiddleware.Regi
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "StopQuery",
}
}

View file

@ -4,25 +4,27 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds or updates the specified tags for the specified log group. To list the tags
// for a log group, use ListTagsLogGroup
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsLogGroup.html).
// To remove tags, use UntagLogGroup
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagLogGroup.html).
// For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs
// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#log-group-tagging)
// The TagLogGroup operation is on the path to deprecation. We recommend that you
// use TagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html)
// instead. Adds or updates the specified tags for the specified log group. To list
// the tags for a log group, use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html)
// . To remove tags, use UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html)
// . For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#log-group-tagging)
// in the Amazon CloudWatch Logs User Guide. CloudWatch Logs doesnt support IAM
// policies that prevent users from assigning specified tags to log groups using
// the aws:Resource/key-name or aws:TagKeys condition keys. For more information
// about using tags to control access, see Controlling access to Amazon Web
// Services resources using tags
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html).
// Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html)
// .
//
// Deprecated: Please use the generic tagging API TagResource
func (c *Client) TagLogGroup(ctx context.Context, params *TagLogGroupInput, optFns ...func(*Options)) (*TagLogGroupOutput, error) {
if params == nil {
params = &TagLogGroupInput{}
@ -61,6 +63,9 @@ type TagLogGroupOutput struct {
}
func (c *Client) addOperationTagLogGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpTagLogGroup{}, middleware.After)
if err != nil {
return err
@ -69,6 +74,13 @@ func (c *Client) addOperationTagLogGroupMiddlewares(stack *middleware.Stack, opt
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "TagLogGroup"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -87,16 +99,13 @@ func (c *Client) addOperationTagLogGroupMiddlewares(stack *middleware.Stack, opt
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -105,12 +114,18 @@ func (c *Client) addOperationTagLogGroupMiddlewares(stack *middleware.Stack, opt
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpTagLogGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagLogGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -120,6 +135,9 @@ func (c *Client) addOperationTagLogGroupMiddlewares(stack *middleware.Stack, opt
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -127,7 +145,6 @@ func newServiceMetadataMiddleware_opTagLogGroup(region string) *awsmiddleware.Re
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "TagLogGroup",
}
}

View file

@ -0,0 +1,153 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs
// resource. Currently, the only CloudWatch Logs resources that can be tagged are
// log groups and destinations. Tags can help you organize and categorize your
// resources. You can also use them to scope user permissions by granting a user
// permission to access or change only resources with certain tag values. Tags
// don't have any semantic meaning to Amazon Web Services and are interpreted
// strictly as strings of characters. You can use the TagResource action with a
// resource that already has tags. If you specify a new tag key for the alarm, this
// tag is appended to the list of tags associated with the alarm. If you specify a
// tag key that is already associated with the alarm, the new tag value that you
// specify replaces the previous value for that tag. You can associate as many as
// 50 tags with a CloudWatch Logs resource.
func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) {
if params == nil {
params = &TagResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*TagResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type TagResourceInput struct {
// The ARN of the resource that you're adding tags to. The ARN format of a log
// group is arn:aws:logs:Region:account-id:log-group:log-group-name The ARN
// format of a destination is
// arn:aws:logs:Region:account-id:destination:destination-name For more
// information about ARN format, see CloudWatch Logs resources and operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html)
// .
//
// This member is required.
ResourceArn *string
// The list of key-value pairs to associate with the resource.
//
// This member is required.
Tags map[string]string
noSmithyDocumentSerde
}
type TagResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpTagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTagResource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpTagResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "TagResource",
}
}

View file

@ -4,6 +4,7 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
@ -59,6 +60,9 @@ type TestMetricFilterOutput struct {
}
func (c *Client) addOperationTestMetricFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpTestMetricFilter{}, middleware.After)
if err != nil {
return err
@ -67,6 +71,13 @@ func (c *Client) addOperationTestMetricFilterMiddlewares(stack *middleware.Stack
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "TestMetricFilter"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -85,16 +96,13 @@ func (c *Client) addOperationTestMetricFilterMiddlewares(stack *middleware.Stack
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -103,12 +111,18 @@ func (c *Client) addOperationTestMetricFilterMiddlewares(stack *middleware.Stack
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpTestMetricFilterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestMetricFilter(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -118,6 +132,9 @@ func (c *Client) addOperationTestMetricFilterMiddlewares(stack *middleware.Stack
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -125,7 +142,6 @@ func newServiceMetadataMiddleware_opTestMetricFilter(region string) *awsmiddlewa
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "TestMetricFilter",
}
}

View file

@ -4,20 +4,23 @@ package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Removes the specified tags from the specified log group. To list the tags for a
// log group, use ListTagsLogGroup
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsLogGroup.html).
// To add tags, use TagLogGroup
// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagLogGroup.html).
// CloudWatch Logs doesnt support IAM policies that prevent users from assigning
// The UntagLogGroup operation is on the path to deprecation. We recommend that
// you use UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html)
// instead. Removes the specified tags from the specified log group. To list the
// tags for a log group, use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html)
// . To add tags, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html)
// . CloudWatch Logs doesnt support IAM policies that prevent users from assigning
// specified tags to log groups using the aws:Resource/key-name or aws:TagKeys
// condition keys.
//
// Deprecated: Please use the generic tagging API UntagResource
func (c *Client) UntagLogGroup(ctx context.Context, params *UntagLogGroupInput, optFns ...func(*Options)) (*UntagLogGroupOutput, error) {
if params == nil {
params = &UntagLogGroupInput{}
@ -56,6 +59,9 @@ type UntagLogGroupOutput struct {
}
func (c *Client) addOperationUntagLogGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUntagLogGroup{}, middleware.After)
if err != nil {
return err
@ -64,6 +70,13 @@ func (c *Client) addOperationUntagLogGroupMiddlewares(stack *middleware.Stack, o
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "UntagLogGroup"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
@ -82,16 +95,13 @@ func (c *Client) addOperationUntagLogGroupMiddlewares(stack *middleware.Stack, o
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = addHTTPSignerV4Middleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack); err != nil {
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
@ -100,12 +110,18 @@ func (c *Client) addOperationUntagLogGroupMiddlewares(stack *middleware.Stack, o
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpUntagLogGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagLogGroup(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
@ -115,6 +131,9 @@ func (c *Client) addOperationUntagLogGroupMiddlewares(stack *middleware.Stack, o
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
@ -122,7 +141,6 @@ func newServiceMetadataMiddleware_opUntagLogGroup(region string) *awsmiddleware.
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "logs",
OperationName: "UntagLogGroup",
}
}

View file

@ -0,0 +1,142 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Removes one or more tags from the specified resource.
func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) {
if params == nil {
params = &UntagResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UntagResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type UntagResourceInput struct {
// The ARN of the CloudWatch Logs resource that you're removing tags from. The ARN
// format of a log group is
// arn:aws:logs:Region:account-id:log-group:log-group-name The ARN format of a
// destination is arn:aws:logs:Region:account-id:destination:destination-name For
// more information about ARN format, see CloudWatch Logs resources and operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html)
// .
//
// This member is required.
ResourceArn *string
// The list of tag keys to remove from the resource.
//
// This member is required.
TagKeys []string
noSmithyDocumentSerde
}
type UntagResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUntagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUntagResource{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpUntagResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "UntagResource",
}
}

View file

@ -0,0 +1,161 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Use this operation to suppress anomaly detection for a specified anomaly or
// pattern. If you suppress an anomaly, CloudWatch Logs wont report new
// occurrences of that anomaly and won't update that anomaly with new data. If you
// suppress a pattern, CloudWatch Logs wont report any anomalies related to that
// pattern. You must specify either anomalyId or patternId , but you can't specify
// both parameters in the same operation. If you have previously used this
// operation to suppress detection of a pattern or anomaly, you can use it again to
// cause CloudWatch Logs to end the suppression. To do this, use this operation and
// specify the anomaly or pattern to stop suppressing, and omit the suppressionType
// and suppressionPeriod parameters.
func (c *Client) UpdateAnomaly(ctx context.Context, params *UpdateAnomalyInput, optFns ...func(*Options)) (*UpdateAnomalyOutput, error) {
if params == nil {
params = &UpdateAnomalyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateAnomaly", params, optFns, c.addOperationUpdateAnomalyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateAnomalyOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateAnomalyInput struct {
// The ARN of the anomaly detector that this operation is to act on.
//
// This member is required.
AnomalyDetectorArn *string
// If you are suppressing or unsuppressing an anomaly, specify its unique ID here.
// You can find anomaly IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html)
// operation.
AnomalyId *string
// If you are suppressing or unsuppressing an pattern, specify its unique ID here.
// You can find pattern IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html)
// operation.
PatternId *string
// If you are temporarily suppressing an anomaly or pattern, use this structure to
// specify how long the suppression is to last.
SuppressionPeriod *types.SuppressionPeriod
// Use this to specify whether the suppression to be temporary or infinite. If you
// specify LIMITED , you must also specify a suppressionPeriod . If you specify
// INFINITE , any value for suppressionPeriod is ignored.
SuppressionType types.SuppressionType
noSmithyDocumentSerde
}
type UpdateAnomalyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateAnomalyMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateAnomaly{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateAnomaly{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAnomaly"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateAnomalyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAnomaly(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUpdateAnomaly(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "UpdateAnomaly",
}
}

View file

@ -0,0 +1,157 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates an existing log anomaly detector.
func (c *Client) UpdateLogAnomalyDetector(ctx context.Context, params *UpdateLogAnomalyDetectorInput, optFns ...func(*Options)) (*UpdateLogAnomalyDetectorOutput, error) {
if params == nil {
params = &UpdateLogAnomalyDetectorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateLogAnomalyDetector", params, optFns, c.addOperationUpdateLogAnomalyDetectorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateLogAnomalyDetectorOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateLogAnomalyDetectorInput struct {
// The ARN of the anomaly detector that you want to update.
//
// This member is required.
AnomalyDetectorArn *string
// Use this parameter to pause or restart the anomaly detector.
//
// This member is required.
Enabled *bool
// The number of days to use as the life cycle of anomalies. After this time,
// anomalies are automatically baselined and the anomaly detector model will treat
// new occurrences of similar event as normal. Therefore, if you do not correct the
// cause of an anomaly during this time, it will be considered normal going forward
// and will not be detected.
AnomalyVisibilityTime *int64
// Specifies how often the anomaly detector runs and look for anomalies. Set this
// value according to the frequency that the log group receives new logs. For
// example, if the log group receives new log events every 10 minutes, then setting
// evaluationFrequency to FIFTEEN_MIN might be appropriate.
EvaluationFrequency types.EvaluationFrequency
// A symbolic description of how CloudWatch Logs should interpret the data in each
// log event. For example, a log event can contain timestamps, IP addresses,
// strings, and so on. You use the filter pattern to specify what to look for in
// the log event message.
FilterPattern *string
noSmithyDocumentSerde
}
type UpdateLogAnomalyDetectorOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateLogAnomalyDetectorMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateLogAnomalyDetector{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateLogAnomalyDetector"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateLogAnomalyDetectorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateLogAnomalyDetector(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUpdateLogAnomalyDetector(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "UpdateLogAnomalyDetector",
}
}

View file

@ -0,0 +1,284 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
smithy "github.com/aws/smithy-go"
smithyauth "github.com/aws/smithy-go/auth"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
func bindAuthParamsRegion(params *AuthResolverParameters, _ interface{}, options Options) {
params.Region = options.Region
}
type setLegacyContextSigningOptionsMiddleware struct {
}
func (*setLegacyContextSigningOptionsMiddleware) ID() string {
return "setLegacyContextSigningOptions"
}
func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
rscheme := getResolvedAuthScheme(ctx)
schemeID := rscheme.Scheme.SchemeID()
if sn := awsmiddleware.GetSigningName(ctx); sn != "" {
if schemeID == "aws.auth#sigv4" {
smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn)
} else if schemeID == "aws.auth#sigv4a" {
smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn)
}
}
if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" {
if schemeID == "aws.auth#sigv4" {
smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr)
} else if schemeID == "aws.auth#sigv4a" {
smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr})
}
}
return next.HandleFinalize(ctx, in)
}
func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error {
return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before)
}
type withAnonymous struct {
resolver AuthSchemeResolver
}
var _ AuthSchemeResolver = (*withAnonymous)(nil)
func (v *withAnonymous) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
opts, err := v.resolver.ResolveAuthSchemes(ctx, params)
if err != nil {
return nil, err
}
opts = append(opts, &smithyauth.Option{
SchemeID: smithyauth.SchemeIDAnonymous,
})
return opts, nil
}
func wrapWithAnonymousAuth(options *Options) {
if _, ok := options.AuthSchemeResolver.(*defaultAuthSchemeResolver); !ok {
return
}
options.AuthSchemeResolver = &withAnonymous{
resolver: options.AuthSchemeResolver,
}
}
// AuthResolverParameters contains the set of inputs necessary for auth scheme
// resolution.
type AuthResolverParameters struct {
// The name of the operation being invoked.
Operation string
// The region in which the operation is being invoked.
Region string
}
func bindAuthResolverParams(operation string, input interface{}, options Options) *AuthResolverParameters {
params := &AuthResolverParameters{
Operation: operation,
}
bindAuthParamsRegion(params, input, options)
return params
}
// AuthSchemeResolver returns a set of possible authentication options for an
// operation.
type AuthSchemeResolver interface {
ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error)
}
type defaultAuthSchemeResolver struct{}
var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil)
func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
if overrides, ok := operationAuthOptions[params.Operation]; ok {
return overrides(params), nil
}
return serviceAuthOptions(params), nil
}
var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{}
func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option {
return []*smithyauth.Option{
{
SchemeID: smithyauth.SchemeIDSigV4,
SignerProperties: func() smithy.Properties {
var props smithy.Properties
smithyhttp.SetSigV4SigningName(&props, "logs")
smithyhttp.SetSigV4SigningRegion(&props, params.Region)
return props
}(),
},
}
}
type resolveAuthSchemeMiddleware struct {
operation string
options Options
}
func (*resolveAuthSchemeMiddleware) ID() string {
return "ResolveAuthScheme"
}
func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
params := bindAuthResolverParams(m.operation, getOperationInput(ctx), m.options)
options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params)
if err != nil {
return out, metadata, fmt.Errorf("resolve auth scheme: %w", err)
}
scheme, ok := m.selectScheme(options)
if !ok {
return out, metadata, fmt.Errorf("could not select an auth scheme")
}
ctx = setResolvedAuthScheme(ctx, scheme)
return next.HandleFinalize(ctx, in)
}
func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) {
for _, option := range options {
if option.SchemeID == smithyauth.SchemeIDAnonymous {
return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true
}
for _, scheme := range m.options.AuthSchemes {
if scheme.SchemeID() != option.SchemeID {
continue
}
if scheme.IdentityResolver(m.options) != nil {
return newResolvedAuthScheme(scheme, option), true
}
}
}
return nil, false
}
type resolvedAuthSchemeKey struct{}
type resolvedAuthScheme struct {
Scheme smithyhttp.AuthScheme
IdentityProperties smithy.Properties
SignerProperties smithy.Properties
}
func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme {
return &resolvedAuthScheme{
Scheme: scheme,
IdentityProperties: option.IdentityProperties,
SignerProperties: option.SignerProperties,
}
}
func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context {
return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme)
}
func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme {
v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme)
return v
}
type getIdentityMiddleware struct {
options Options
}
func (*getIdentityMiddleware) ID() string {
return "GetIdentity"
}
func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
rscheme := getResolvedAuthScheme(ctx)
if rscheme == nil {
return out, metadata, fmt.Errorf("no resolved auth scheme")
}
resolver := rscheme.Scheme.IdentityResolver(m.options)
if resolver == nil {
return out, metadata, fmt.Errorf("no identity resolver")
}
identity, err := resolver.GetIdentity(ctx, rscheme.IdentityProperties)
if err != nil {
return out, metadata, fmt.Errorf("get identity: %w", err)
}
ctx = setIdentity(ctx, identity)
return next.HandleFinalize(ctx, in)
}
type identityKey struct{}
func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context {
return middleware.WithStackValue(ctx, identityKey{}, identity)
}
func getIdentity(ctx context.Context) smithyauth.Identity {
v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity)
return v
}
type signRequestMiddleware struct {
}
func (*signRequestMiddleware) ID() string {
return "Signing"
}
func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request)
}
rscheme := getResolvedAuthScheme(ctx)
if rscheme == nil {
return out, metadata, fmt.Errorf("no resolved auth scheme")
}
identity := getIdentity(ctx)
if identity == nil {
return out, metadata, fmt.Errorf("no identity")
}
signer := rscheme.Scheme.Signer()
if signer == nil {
return out, metadata, fmt.Errorf("no signer")
}
if err := signer.SignRequest(ctx, req, identity, rscheme.SignerProperties); err != nil {
return out, metadata, fmt.Errorf("sign request: %w", err)
}
return next.HandleFinalize(ctx, in)
}

File diff suppressed because it is too large Load diff

View file

@ -5,31 +5,27 @@
//
// You can use Amazon CloudWatch Logs to monitor, store, and access your log files
// from EC2 instances, CloudTrail, and other sources. You can then retrieve the
// associated log data from CloudWatch Logs using the CloudWatch console,
// CloudWatch Logs commands in the Amazon Web Services CLI, CloudWatch Logs API, or
// CloudWatch Logs SDK. You can use CloudWatch Logs to:
//
// * Monitor logs from EC2
// instances in real-time: You can use CloudWatch Logs to monitor applications and
// systems using log data. For example, CloudWatch Logs can track the number of
// errors that occur in your application logs and send you a notification whenever
// the rate of errors exceeds a threshold that you specify. CloudWatch Logs uses
// your log data for monitoring so no code changes are required. For example, you
// can monitor application logs for specific literal terms (such as
// "NullReferenceException") or count the number of occurrences of a literal term
// at a particular position in log data (such as "404" status codes in an Apache
// access log). When the term you are searching for is found, CloudWatch Logs
// reports the data to a CloudWatch metric that you specify.
//
// * Monitor CloudTrail
// logged events: You can create alarms in CloudWatch and receive notifications of
// particular API activity as captured by CloudTrail. You can use the notification
// to perform troubleshooting.
//
// * Archive log data: You can use CloudWatch Logs to
// store your log data in highly durable storage. You can change the log retention
// setting so that any log events older than this setting are automatically
// deleted. The CloudWatch Logs agent makes it easy to quickly send both rotated
// and non-rotated log data off of a host and into the log service. You can then
// access the raw log data when you need it.
// associated log data from CloudWatch Logs using the CloudWatch console.
// Alternatively, you can use CloudWatch Logs commands in the Amazon Web Services
// CLI, CloudWatch Logs API, or CloudWatch Logs SDK. You can use CloudWatch Logs
// to:
// - Monitor logs from EC2 instances in real time: You can use CloudWatch Logs
// to monitor applications and systems using log data. For example, CloudWatch Logs
// can track the number of errors that occur in your application logs. Then, it can
// send you a notification whenever the rate of errors exceeds a threshold that you
// specify. CloudWatch Logs uses your log data for monitoring so no code changes
// are required. For example, you can monitor application logs for specific literal
// terms (such as "NullReferenceException"). You can also count the number of
// occurrences of a literal term at a particular position in log data (such as
// "404" status codes in an Apache access log). When the term you are searching for
// is found, CloudWatch Logs reports the data to a CloudWatch metric that you
// specify.
// - Monitor CloudTrail logged events: You can create alarms in CloudWatch and
// receive notifications of particular API activity as captured by CloudTrail. You
// can use the notification to perform troubleshooting.
// - Archive log data: You can use CloudWatch Logs to store your log data in
// highly durable storage. You can change the log retention setting so that any log
// events earlier than this setting are automatically deleted. The CloudWatch Logs
// agent helps to quickly send both rotated and non-rotated log data off of a host
// and into the log service. You can then access the raw log data when you need it.
package cloudwatchlogs

View file

@ -8,10 +8,18 @@ import (
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
"github.com/aws/aws-sdk-go-v2/internal/endpoints"
"github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn"
internalendpoints "github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/internal/endpoints"
smithyauth "github.com/aws/smithy-go/auth"
smithyendpoints "github.com/aws/smithy-go/endpoints"
"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/ptr"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/http"
"net/url"
"os"
"strings"
)
@ -39,13 +47,6 @@ func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointRe
return fn(region, options)
}
func resolveDefaultEndpointConfiguration(o *Options) {
if o.EndpointResolver != nil {
return
}
o.EndpointResolver = NewDefaultEndpointResolver()
}
// EndpointResolverFromURL returns an EndpointResolver configured using the
// provided endpoint url. By default, the resolved endpoint resolver uses the
// client region as signing region, and the endpoint source is set to
@ -79,6 +80,10 @@ func (*ResolveEndpoint) ID() string {
func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
return next.HandleSerialize(ctx, in)
}
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
@ -94,6 +99,11 @@ func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.Ser
var endpoint aws.Endpoint
endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo)
if err != nil {
nf := (&aws.EndpointNotFoundError{})
if errors.As(err, &nf) {
ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false)
return next.HandleSerialize(ctx, in)
}
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
}
@ -129,27 +139,10 @@ func removeResolveEndpointMiddleware(stack *middleware.Stack) error {
type wrappedEndpointResolver struct {
awsResolver aws.EndpointResolverWithOptions
resolver EndpointResolver
}
func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
if w.awsResolver == nil {
goto fallback
}
endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options)
if err == nil {
return endpoint, nil
}
if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) {
return endpoint, err
}
fallback:
if w.resolver == nil {
return endpoint, fmt.Errorf("default endpoint resolver provided was nil")
}
return w.resolver.ResolveEndpoint(region, options)
return w.awsResolver.ResolveEndpoint(ServiceID, region, options)
}
type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error)
@ -160,12 +153,13 @@ func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, opti
var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil)
// withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver.
// If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided
// fallbackResolver for resolution.
// withEndpointResolver returns an aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver.
// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error,
// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked
// via its middleware.
//
// fallbackResolver must not be nil
func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver {
// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated.
func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver {
var resolver aws.EndpointResolverWithOptions
if awsResolverWithOptions != nil {
@ -176,7 +170,6 @@ func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptio
return &wrappedEndpointResolver{
awsResolver: resolver,
resolver: fallbackResolver,
}
}
@ -198,3 +191,345 @@ func finalizeClientEndpointResolverOptions(options *Options) {
}
}
func resolveEndpointResolverV2(options *Options) {
if options.EndpointResolverV2 == nil {
options.EndpointResolverV2 = NewDefaultEndpointResolverV2()
}
}
func resolveBaseEndpoint(cfg aws.Config, o *Options) {
if cfg.BaseEndpoint != nil {
o.BaseEndpoint = cfg.BaseEndpoint
}
_, g := os.LookupEnv("AWS_ENDPOINT_URL")
_, s := os.LookupEnv("AWS_ENDPOINT_URL_CLOUDWATCH_LOGS")
if g && !s {
return
}
value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "CloudWatch Logs", cfg.ConfigSources)
if found && err == nil {
o.BaseEndpoint = &value
}
}
// EndpointParameters provides the parameters that influence how endpoints are
// resolved.
type EndpointParameters struct {
// The AWS region used to dispatch the request.
//
// Parameter is
// required.
//
// AWS::Region
Region *string
// When true, use the dual-stack endpoint. If the configured endpoint does not
// support dual-stack, dispatching the request MAY return an error.
//
// Defaults to
// false if no value is provided.
//
// AWS::UseDualStack
UseDualStack *bool
// When true, send this request to the FIPS-compliant regional endpoint. If the
// configured endpoint does not have a FIPS compliant endpoint, dispatching the
// request will return an error.
//
// Defaults to false if no value is
// provided.
//
// AWS::UseFIPS
UseFIPS *bool
// Override the endpoint used to send this request
//
// Parameter is
// required.
//
// SDK::Endpoint
Endpoint *string
}
// ValidateRequired validates required parameters are set.
func (p EndpointParameters) ValidateRequired() error {
if p.UseDualStack == nil {
return fmt.Errorf("parameter UseDualStack is required")
}
if p.UseFIPS == nil {
return fmt.Errorf("parameter UseFIPS is required")
}
return nil
}
// WithDefaults returns a shallow copy of EndpointParameterswith default values
// applied to members where applicable.
func (p EndpointParameters) WithDefaults() EndpointParameters {
if p.UseDualStack == nil {
p.UseDualStack = ptr.Bool(false)
}
if p.UseFIPS == nil {
p.UseFIPS = ptr.Bool(false)
}
return p
}
// EndpointResolverV2 provides the interface for resolving service endpoints.
type EndpointResolverV2 interface {
// ResolveEndpoint attempts to resolve the endpoint with the provided options,
// returning the endpoint if found. Otherwise an error is returned.
ResolveEndpoint(ctx context.Context, params EndpointParameters) (
smithyendpoints.Endpoint, error,
)
}
// resolver provides the implementation for resolving endpoints.
type resolver struct{}
func NewDefaultEndpointResolverV2() EndpointResolverV2 {
return &resolver{}
}
// ResolveEndpoint attempts to resolve the endpoint with the provided options,
// returning the endpoint if found. Otherwise an error is returned.
func (r *resolver) ResolveEndpoint(
ctx context.Context, params EndpointParameters,
) (
endpoint smithyendpoints.Endpoint, err error,
) {
params = params.WithDefaults()
if err = params.ValidateRequired(); err != nil {
return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err)
}
_UseDualStack := *params.UseDualStack
_UseFIPS := *params.UseFIPS
if exprVal := params.Endpoint; exprVal != nil {
_Endpoint := *exprVal
_ = _Endpoint
if _UseFIPS == true {
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported")
}
if _UseDualStack == true {
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported")
}
uriString := _Endpoint
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
if exprVal := params.Region; exprVal != nil {
_Region := *exprVal
_ = _Region
if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil {
_PartitionResult := *exprVal
_ = _PartitionResult
if _UseFIPS == true {
if _UseDualStack == true {
if true == _PartitionResult.SupportsFIPS {
if true == _PartitionResult.SupportsDualStack {
uriString := func() string {
var out strings.Builder
out.WriteString("https://logs-fips.")
out.WriteString(_Region)
out.WriteString(".")
out.WriteString(_PartitionResult.DualStackDnsSuffix)
return out.String()
}()
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both")
}
}
if _UseFIPS == true {
if _PartitionResult.SupportsFIPS == true {
if _Region == "us-gov-east-1" {
uriString := "https://logs.us-gov-east-1.amazonaws.com"
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
if _Region == "us-gov-west-1" {
uriString := "https://logs.us-gov-west-1.amazonaws.com"
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
uriString := func() string {
var out strings.Builder
out.WriteString("https://logs-fips.")
out.WriteString(_Region)
out.WriteString(".")
out.WriteString(_PartitionResult.DnsSuffix)
return out.String()
}()
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS")
}
if _UseDualStack == true {
if true == _PartitionResult.SupportsDualStack {
uriString := func() string {
var out strings.Builder
out.WriteString("https://logs.")
out.WriteString(_Region)
out.WriteString(".")
out.WriteString(_PartitionResult.DualStackDnsSuffix)
return out.String()
}()
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack")
}
uriString := func() string {
var out strings.Builder
out.WriteString("https://logs.")
out.WriteString(_Region)
out.WriteString(".")
out.WriteString(_PartitionResult.DnsSuffix)
return out.String()
}()
uri, err := url.Parse(uriString)
if err != nil {
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
}, nil
}
return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.")
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region")
}
type endpointParamsBinder interface {
bindEndpointParams(*EndpointParameters)
}
func bindEndpointParams(input interface{}, options Options) *EndpointParameters {
params := &EndpointParameters{}
params.Region = aws.String(endpoints.MapFIPSRegion(options.Region))
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
params.Endpoint = options.BaseEndpoint
if b, ok := input.(endpointParamsBinder); ok {
b.bindEndpointParams(params)
}
return params
}
type resolveEndpointV2Middleware struct {
options Options
}
func (*resolveEndpointV2Middleware) ID() string {
return "ResolveEndpointV2"
}
func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
if awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
return next.HandleFinalize(ctx, in)
}
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
if m.options.EndpointResolverV2 == nil {
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
params := bindEndpointParams(getOperationInput(ctx), m.options)
endpt, err := m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
if err != nil {
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
}
if endpt.URI.RawPath == "" && req.URL.RawPath != "" {
endpt.URI.RawPath = endpt.URI.Path
}
req.URL.Scheme = endpt.URI.Scheme
req.URL.Host = endpt.URI.Host
req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path)
req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath)
for k := range endpt.Headers {
req.Header.Set(k, endpt.Headers.Get(k))
}
rscheme := getResolvedAuthScheme(ctx)
if rscheme == nil {
return out, metadata, fmt.Errorf("no resolved auth scheme")
}
opts, _ := smithyauth.GetAuthOptions(&endpt.Properties)
for _, o := range opts {
rscheme.SignerProperties.SetAll(&o.SignerProperties)
}
return next.HandleFinalize(ctx, in)
}

View file

@ -0,0 +1,342 @@
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatchlogs
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream"
"github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi"
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
smithysync "github.com/aws/smithy-go/sync"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"io/ioutil"
"sync"
)
// StartLiveTailResponseStreamReader provides the interface for reading events
// from a stream.
//
// The writer's Close method must allow multiple concurrent calls.
type StartLiveTailResponseStreamReader interface {
Events() <-chan types.StartLiveTailResponseStream
Close() error
Err() error
}
type startLiveTailResponseStreamReadEvent interface {
isStartLiveTailResponseStreamReadEvent()
}
type startLiveTailResponseStreamReadEventMessage struct {
Value types.StartLiveTailResponseStream
}
func (*startLiveTailResponseStreamReadEventMessage) isStartLiveTailResponseStreamReadEvent() {}
type startLiveTailResponseStreamReadEventInitialResponse struct {
Value interface{}
}
func (*startLiveTailResponseStreamReadEventInitialResponse) isStartLiveTailResponseStreamReadEvent() {
}
type startLiveTailResponseStreamReader struct {
stream chan types.StartLiveTailResponseStream
decoder *eventstream.Decoder
eventStream io.ReadCloser
err *smithysync.OnceErr
payloadBuf []byte
done chan struct{}
closeOnce sync.Once
initialResponseDeserializer func(*eventstream.Message) (interface{}, error)
initialResponse chan interface{}
}
func newStartLiveTailResponseStreamReader(readCloser io.ReadCloser, decoder *eventstream.Decoder, ird func(*eventstream.Message) (interface{}, error)) *startLiveTailResponseStreamReader {
w := &startLiveTailResponseStreamReader{
stream: make(chan types.StartLiveTailResponseStream),
decoder: decoder,
eventStream: readCloser,
err: smithysync.NewOnceErr(),
done: make(chan struct{}),
payloadBuf: make([]byte, 10*1024),
initialResponseDeserializer: ird,
initialResponse: make(chan interface{}, 1),
}
go w.readEventStream()
return w
}
func (r *startLiveTailResponseStreamReader) Events() <-chan types.StartLiveTailResponseStream {
return r.stream
}
func (r *startLiveTailResponseStreamReader) readEventStream() {
defer r.Close()
defer close(r.stream)
defer close(r.initialResponse)
for {
r.payloadBuf = r.payloadBuf[0:0]
decodedMessage, err := r.decoder.Decode(r.eventStream, r.payloadBuf)
if err != nil {
if err == io.EOF {
return
}
select {
case <-r.done:
return
default:
r.err.SetError(err)
return
}
}
event, err := r.deserializeEventMessage(&decodedMessage)
if err != nil {
r.err.SetError(err)
return
}
switch ev := event.(type) {
case *startLiveTailResponseStreamReadEventInitialResponse:
select {
case r.initialResponse <- ev.Value:
case <-r.done:
return
default:
}
case *startLiveTailResponseStreamReadEventMessage:
select {
case r.stream <- ev.Value:
case <-r.done:
return
}
default:
r.err.SetError(fmt.Errorf("unexpected event wrapper: %T", event))
return
}
}
}
func (r *startLiveTailResponseStreamReader) deserializeEventMessage(msg *eventstream.Message) (startLiveTailResponseStreamReadEvent, error) {
messageType := msg.Headers.Get(eventstreamapi.MessageTypeHeader)
if messageType == nil {
return nil, fmt.Errorf("%s event header not present", eventstreamapi.MessageTypeHeader)
}
switch messageType.String() {
case eventstreamapi.EventMessageType:
eventType := msg.Headers.Get(eventstreamapi.EventTypeHeader)
if eventType == nil {
return nil, fmt.Errorf("%s event header not present", eventstreamapi.EventTypeHeader)
}
if eventType.String() == "initial-response" {
v, err := r.initialResponseDeserializer(msg)
if err != nil {
return nil, err
}
return &startLiveTailResponseStreamReadEventInitialResponse{Value: v}, nil
}
var v types.StartLiveTailResponseStream
if err := awsAwsjson11_deserializeEventStreamStartLiveTailResponseStream(&v, msg); err != nil {
return nil, err
}
return &startLiveTailResponseStreamReadEventMessage{Value: v}, nil
case eventstreamapi.ExceptionMessageType:
return nil, awsAwsjson11_deserializeEventStreamExceptionStartLiveTailResponseStream(msg)
case eventstreamapi.ErrorMessageType:
errorCode := "UnknownError"
errorMessage := errorCode
if header := msg.Headers.Get(eventstreamapi.ErrorCodeHeader); header != nil {
errorCode = header.String()
}
if header := msg.Headers.Get(eventstreamapi.ErrorMessageHeader); header != nil {
errorMessage = header.String()
}
return nil, &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
default:
mc := msg.Clone()
return nil, &UnknownEventMessageError{
Type: messageType.String(),
Message: &mc,
}
}
}
func (r *startLiveTailResponseStreamReader) ErrorSet() <-chan struct{} {
return r.err.ErrorSet()
}
func (r *startLiveTailResponseStreamReader) Close() error {
r.closeOnce.Do(r.safeClose)
return r.Err()
}
func (r *startLiveTailResponseStreamReader) safeClose() {
close(r.done)
r.eventStream.Close()
}
func (r *startLiveTailResponseStreamReader) Err() error {
return r.err.Err()
}
func (r *startLiveTailResponseStreamReader) Closed() <-chan struct{} {
return r.done
}
type awsAwsjson11_deserializeOpEventStreamStartLiveTail struct {
LogEventStreamWrites bool
LogEventStreamReads bool
}
func (*awsAwsjson11_deserializeOpEventStreamStartLiveTail) ID() string {
return "OperationEventStreamDeserializer"
}
func (m *awsAwsjson11_deserializeOpEventStreamStartLiveTail) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
defer func() {
if err == nil {
return
}
m.closeResponseBody(out)
}()
logger := middleware.GetLogger(ctx)
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type: %T", in.Request)
}
_ = request
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
deserializeOutput, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type: %T", out.RawResponse)
}
_ = deserializeOutput
output, ok := out.Result.(*StartLiveTailOutput)
if out.Result != nil && !ok {
return out, metadata, fmt.Errorf("unexpected output result type: %T", out.Result)
} else if out.Result == nil {
output = &StartLiveTailOutput{}
out.Result = output
}
eventReader := newStartLiveTailResponseStreamReader(
deserializeOutput.Body,
eventstream.NewDecoder(func(options *eventstream.DecoderOptions) {
options.Logger = logger
options.LogMessages = m.LogEventStreamReads
}),
awsAwsjson11_deserializeEventMessageResponseStartLiveTailOutput,
)
defer func() {
if err == nil {
return
}
_ = eventReader.Close()
}()
ir := <-eventReader.initialResponse
irv, ok := ir.(*StartLiveTailOutput)
if !ok {
return out, metadata, fmt.Errorf("unexpected output result type: %T", ir)
}
*output = *irv
output.eventStream = NewStartLiveTailEventStream(func(stream *StartLiveTailEventStream) {
stream.Reader = eventReader
})
go output.eventStream.waitStreamClose()
return out, metadata, nil
}
func (*awsAwsjson11_deserializeOpEventStreamStartLiveTail) closeResponseBody(out middleware.DeserializeOutput) {
if resp, ok := out.RawResponse.(*smithyhttp.Response); ok && resp != nil && resp.Body != nil {
_, _ = io.Copy(ioutil.Discard, resp.Body)
_ = resp.Body.Close()
}
}
func addEventStreamStartLiveTailMiddleware(stack *middleware.Stack, options Options) error {
if err := stack.Deserialize.Insert(&awsAwsjson11_deserializeOpEventStreamStartLiveTail{
LogEventStreamWrites: options.ClientLogMode.IsRequestEventMessage(),
LogEventStreamReads: options.ClientLogMode.IsResponseEventMessage(),
}, "OperationDeserializer", middleware.Before); err != nil {
return err
}
return nil
}
// UnknownEventMessageError provides an error when a message is received from the stream,
// but the reader is unable to determine what kind of message it is.
type UnknownEventMessageError struct {
Type string
Message *eventstream.Message
}
// Error retruns the error message string.
func (e *UnknownEventMessageError) Error() string {
return "unknown event stream message type, " + e.Type
}
func setSafeEventStreamClientLogMode(o *Options, operation string) {
switch operation {
case "StartLiveTail":
toggleEventStreamClientLogMode(o, false, true)
return
default:
return
}
}
func toggleEventStreamClientLogMode(o *Options, request, response bool) {
mode := o.ClientLogMode
if request && mode.IsRequestWithBody() {
mode.ClearRequestWithBody()
mode |= aws.LogRequest
}
if response && mode.IsResponseWithBody() {
mode.ClearResponseWithBody()
mode |= aws.LogResponse
}
o.ClientLogMode = mode
}

View file

@ -1,19 +1,30 @@
{
"dependencies": {
"github.com/aws/aws-sdk-go-v2": "v1.4.0",
"github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream": "v0.0.0-00010101000000-000000000000",
"github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000",
"github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000",
"github.com/aws/smithy-go": "v1.4.0"
"github.com/aws/smithy-go": "v1.4.0",
"github.com/google/go-cmp": "v0.5.4"
},
"files": [
"api_client.go",
"api_client_test.go",
"api_op_AssociateKmsKey.go",
"api_op_CancelExportTask.go",
"api_op_CreateDelivery.go",
"api_op_CreateExportTask.go",
"api_op_CreateLogAnomalyDetector.go",
"api_op_CreateLogGroup.go",
"api_op_CreateLogStream.go",
"api_op_DeleteAccountPolicy.go",
"api_op_DeleteDataProtectionPolicy.go",
"api_op_DeleteDelivery.go",
"api_op_DeleteDeliveryDestination.go",
"api_op_DeleteDeliveryDestinationPolicy.go",
"api_op_DeleteDeliverySource.go",
"api_op_DeleteDestination.go",
"api_op_DeleteLogAnomalyDetector.go",
"api_op_DeleteLogGroup.go",
"api_op_DeleteLogStream.go",
"api_op_DeleteMetricFilter.go",
@ -21,6 +32,10 @@
"api_op_DeleteResourcePolicy.go",
"api_op_DeleteRetentionPolicy.go",
"api_op_DeleteSubscriptionFilter.go",
"api_op_DescribeAccountPolicies.go",
"api_op_DescribeDeliveries.go",
"api_op_DescribeDeliveryDestinations.go",
"api_op_DescribeDeliverySources.go",
"api_op_DescribeDestinations.go",
"api_op_DescribeExportTasks.go",
"api_op_DescribeLogGroups.go",
@ -32,11 +47,25 @@
"api_op_DescribeSubscriptionFilters.go",
"api_op_DisassociateKmsKey.go",
"api_op_FilterLogEvents.go",
"api_op_GetDataProtectionPolicy.go",
"api_op_GetDelivery.go",
"api_op_GetDeliveryDestination.go",
"api_op_GetDeliveryDestinationPolicy.go",
"api_op_GetDeliverySource.go",
"api_op_GetLogAnomalyDetector.go",
"api_op_GetLogEvents.go",
"api_op_GetLogGroupFields.go",
"api_op_GetLogRecord.go",
"api_op_GetQueryResults.go",
"api_op_ListAnomalies.go",
"api_op_ListLogAnomalyDetectors.go",
"api_op_ListTagsForResource.go",
"api_op_ListTagsLogGroup.go",
"api_op_PutAccountPolicy.go",
"api_op_PutDataProtectionPolicy.go",
"api_op_PutDeliveryDestination.go",
"api_op_PutDeliveryDestinationPolicy.go",
"api_op_PutDeliverySource.go",
"api_op_PutDestination.go",
"api_op_PutDestinationPolicy.go",
"api_op_PutLogEvents.go",
@ -45,22 +74,33 @@
"api_op_PutResourcePolicy.go",
"api_op_PutRetentionPolicy.go",
"api_op_PutSubscriptionFilter.go",
"api_op_StartLiveTail.go",
"api_op_StartQuery.go",
"api_op_StopQuery.go",
"api_op_TagLogGroup.go",
"api_op_TagResource.go",
"api_op_TestMetricFilter.go",
"api_op_UntagLogGroup.go",
"api_op_UntagResource.go",
"api_op_UpdateAnomaly.go",
"api_op_UpdateLogAnomalyDetector.go",
"auth.go",
"deserializers.go",
"doc.go",
"endpoints.go",
"endpoints_config_test.go",
"endpoints_test.go",
"eventstream.go",
"generated.json",
"internal/endpoints/endpoints.go",
"internal/endpoints/endpoints_test.go",
"options.go",
"protocol_test.go",
"serializers.go",
"types/enums.go",
"types/errors.go",
"types/types.go",
"types/types_exported_test.go",
"validators.go"
],
"go": "1.15",

View file

@ -3,4 +3,4 @@
package cloudwatchlogs
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.15.17"
const goModuleVersion = "1.32.0"

View file

@ -89,13 +89,17 @@ var partitionRegexp = struct {
AwsCn *regexp.Regexp
AwsIso *regexp.Regexp
AwsIsoB *regexp.Regexp
AwsIsoE *regexp.Regexp
AwsIsoF *regexp.Regexp
AwsUsGov *regexp.Regexp
}{
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"),
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$"),
AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
}
@ -153,6 +157,9 @@ var defaultPartitions = endpoints.Partitions{
endpoints.EndpointKey{
Region: "ap-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-south-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-1",
}: endpoints.Endpoint{},
@ -162,18 +169,30 @@ var defaultPartitions = endpoints.Partitions{
endpoints.EndpointKey{
Region: "ap-southeast-3",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-4",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-1",
}: endpoints.Endpoint{},
@ -219,6 +238,9 @@ var defaultPartitions = endpoints.Partitions{
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "il-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "me-central-1",
}: endpoints.Endpoint{},
@ -364,6 +386,48 @@ var defaultPartitions = endpoints.Partitions{
}: endpoints.Endpoint{},
},
},
{
ID: "aws-iso-e",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "logs-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "logs.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoE,
IsRegionalized: true,
},
{
ID: "aws-iso-f",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "logs-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "logs.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoF,
IsRegionalized: true,
},
{
ID: "aws-us-gov",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{

Some files were not shown because too many files have changed in this diff Show more