@zio.dev/zio-aws 5.17.29-5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/examples.md ADDED
@@ -0,0 +1,118 @@
1
+ ---
2
+ id: examples
3
+ title: Examples
4
+ ---
5
+
6
+ # Examples
7
+
8
+ The following example uses the ElasticBeanstalk and EC2 APIs to print some info.
9
+
10
+
11
+ ```scala
12
+ object Main extends ZIOAppDefault {
13
+ val program: ZIO[Ec2 & ElasticBeanstalk, AwsError, Unit] =
14
+ for {
15
+ appsResult <- ElasticBeanstalk.describeApplications(
16
+ DescribeApplicationsRequest(applicationNames = Some(List(ApplicationName("my-service"))))
17
+ )
18
+ app <- appsResult.getApplications.map(_.headOption)
19
+ _ <- app match {
20
+ case Some(appDescription) =>
21
+ for {
22
+ applicationName <- appDescription.getApplicationName
23
+ _ <- Console
24
+ .printLine(
25
+ s"Got application description for $applicationName"
26
+ )
27
+ .ignore
28
+
29
+ envStream = ElasticBeanstalk.describeEnvironments(
30
+ DescribeEnvironmentsRequest(applicationName =
31
+ Some(applicationName)
32
+ )
33
+ )
34
+
35
+ _ <- envStream.run(ZSink.foreach { env =>
36
+ env.getEnvironmentName.flatMap { environmentName =>
37
+ (for {
38
+ environmentId <- env.getEnvironmentId
39
+ _ <- Console
40
+ .printLine(
41
+ s"Getting the EB resources of $environmentName"
42
+ )
43
+ .ignore
44
+
45
+ resourcesResult <-
46
+ ElasticBeanstalk.describeEnvironmentResources(
47
+ DescribeEnvironmentResourcesRequest(environmentId =
48
+ Some(environmentId)
49
+ )
50
+ )
51
+ resources <- resourcesResult.getEnvironmentResources
52
+ _ <- Console
53
+ .printLine(
54
+ s"Getting the EC2 instances in $environmentName"
55
+ )
56
+ .ignore
57
+ instances <- resources.getInstances
58
+ instanceIds <- ZIO.foreach(instances)(_.getId)
59
+ _ <- Console
60
+ .printLine(
61
+ s"Instance IDs are ${instanceIds.mkString(", ")}"
62
+ )
63
+ .ignore
64
+
65
+ reservationsStream = Ec2.describeInstances(
66
+ DescribeInstancesRequest(instanceIds = Some(instanceIds.map(id => zio.aws.ec2.model.primitives.InstanceId(ResourceId.unwrap(id)))))
67
+ )
68
+ _ <- reservationsStream.run(ZSink.foreach { reservation =>
69
+ reservation.getInstances
70
+ .flatMap { instances =>
71
+ ZIO.foreach(instances) { instance =>
72
+ for {
73
+ id <- instance.getInstanceId
74
+ typ <- instance.getInstanceType
75
+ launchTime <- instance.getLaunchTime
76
+ _ <- Console.printLine(s" instance $id:").ignore
77
+ _ <- Console.printLine(s" type: $typ").ignore
78
+ _ <- Console
79
+ .printLine(
80
+ s" launched at: $launchTime"
81
+ )
82
+ .ignore
83
+ } yield ()
84
+ }
85
+ }
86
+ })
87
+ } yield ()).catchAll { error =>
88
+ Console
89
+ .printLineError(
90
+ s"Failed to get info for $environmentName: $error"
91
+ )
92
+ .ignore
93
+ }
94
+ }
95
+ })
96
+ } yield ()
97
+ case None =>
98
+ ZIO.unit
99
+ }
100
+ } yield ()
101
+
102
+ override def run: URIO[ZIOAppArgs with zio.Scope, ExitCode] = {
103
+ val httpClient = NettyHttpClient.default
104
+ val awsConfig = httpClient >>> AwsConfig.default
105
+ val aws = awsConfig >>> (Ec2.live ++ ElasticBeanstalk.live)
106
+
107
+ program
108
+ .provideLayer(aws)
109
+ .either
110
+ .flatMap {
111
+ case Left(error) =>
112
+ Console.printLineError(s"AWS error: $error").ignore.as(ExitCode.failure)
113
+ case Right(_) =>
114
+ ZIO.unit.as(ExitCode.success)
115
+ }
116
+ }
117
+ }
118
+ ```
@@ -0,0 +1,44 @@
1
+ ---
2
+ id: getting-started
3
+ title: "Summary"
4
+ ---
5
+
6
+ # Getting started
7
+
8
+ Low-level AWS wrapper for [ZIO](https://zio.dev) for _all_ AWS services using the AWS Java SDK v2.
9
+
10
+ The library's goal is to have access to all AWS functionality for cases when only a simple, direct access is
11
+ needed from a ZIO application, and to be used as a building block for higher level wrappers around specific services.
12
+
13
+ Check the [list of available artifacts](overview_artifacts) to get started.
14
+
15
+ The [wrapper page](overview_wrappers) shows in details how the library wraps the underlying _Java SDK_. On the [configuration page](overview_config) you
16
+ can learn more about how set the common properties of the AWS clients in addition to setting up one of the [HTTP implementations](overview_http).
17
+
18
+ ### Features
19
+ - Common [configuration](overview_config) layer
20
+ - ZIO layer per AWS service
21
+ - [Wrapper](overview_wrappers) for all operations on all services
22
+ - [Http service implementations](overview_http) for functional Scala http libraries, injected through ZIO's module system
23
+ - ZStream wrapper around paginated and streaming operations
24
+ - Service-specific extra configuration
25
+ - More idiomatic Scala request and response types wrapping the Java classes
26
+ - [Aspects](overview_aspects) to take care of additional concerns like logging, metrics, circuit breaking, etc.
27
+
28
+ ### Design
29
+ The library consists of a core module and one generated library for _each_ AWS service, based on the official JSON
30
+ schema from the AWS Java SDK's repository. By only providing a wrapper on top of the Java SDK the code
31
+ generator does not have to know all the implementation details and features of the schema.
32
+
33
+ ### Higher level AWS libraries
34
+ The following libraries are built on top of `zio-aws` providing higher level interfaces for specific AWS services:
35
+
36
+ - [ZIO DynamoDB](https://github.com/zio/zio-dynamodb)
37
+ - [ZIO Kinesis](https://github.com/svroonland/zio-kinesis)
38
+ - [ZIO SQS](https://github.com/zio/zio-sqs)
39
+
40
+ ### Additional resources
41
+
42
+ - There is a [blog post](https://vigoo.github.io/posts/2020-09-23-zioaws-code-generation.html) explaining how the code generator is implemented.
43
+ - [This post](https://vigoo.github.io/posts/2020-11-01-zioaws-zioquery.html) shows an example of using `zio-aws` together with [ZIO Query](https://zio.github.io/zio-query/)
44
+ - [Talk about generating libraries](https://www.youtube.com/watch?v=HCPTmytex3U) from Functional Scala 2021
package/http.md ADDED
@@ -0,0 +1,152 @@
1
+ ---
2
+ id: http
3
+ title: HTTP
4
+ ---
5
+
6
+ # HTTP implementations
7
+
8
+ By default the AWS Java SDK uses _netty_ under the hood to make the HTTP client calls. `zio-aws` defines the http client
9
+ as a _layer_ (`HttpClient`) that has to be provided to the _AWS configuration layer_.
10
+
11
+ Currently the following implementations can be used:
12
+ - `zio-aws-netty` contains the default netty implementation packed as a layer
13
+ - `zio-aws-akka-http` is based on Matthias Lüneberg's [aws-spi-akka-http library](https://github.com/matsluni/aws-spi-akka-http)
14
+ - `zio-aws-http4s` is an implementation on top of _http4s_
15
+
16
+ ## Netty
17
+ The default HTTP implementation in the AWS Java SDK is _Netty_. To use it with the default settings, use the `netty.default`
18
+ layer to provide the `HttpClient` for the `AwsConfig` layer. It is also possible to customize the `NettyNioAsyncHttpClient`
19
+ directly by manipulation it's `Builder`, by using the `netty.customized(customization)` layer.
20
+
21
+ The recommended way for configuration is to use the zio-config support:
22
+
23
+ ```scala
24
+ def configured(
25
+ tlsKeyManagersProvider: Option[TlsKeyManagersProvider] = None,
26
+ tlsTrustManagersProvider: Option[TlsTrustManagersProvider] = None
27
+ ): ZLayer[ZConfig[NettyClientConfig], Throwable, HttpClient]
28
+ ```
29
+
30
+ Everything except the TLS key and trust managers are described by the zio-config provided `NettyClientConfig` data structure.
31
+ See the following table for all the options:
32
+
33
+
34
+ ## Configuration Details
35
+
36
+
37
+ |FieldName|Format |Description|Sources|
38
+ |--- |--- |--- |--- |
39
+ | |[all-of](fielddescriptions)| | |
40
+
41
+ ### Field Descriptions
42
+
43
+ |FieldName |Format |Description |Sources|
44
+ |--- |--- |--- |--- |
45
+ |maxConcurrency |primitive |value of type int, default value: 50, Maximum number of allowed concurrent requests | |
46
+ |maxPendingConnectionAcquires |primitive |value of type int, default value: 10000, The maximum number of pending acquires allowed | |
47
+ |readTimeout |primitive |value of type duration, default value: PT30S, The amount of time to wait for a read on a socket | |
48
+ |writeTimeout |primitive |value of type duration, default value: PT30S, The amount of time to wait for a write on a socket | |
49
+ |connectionTimeout |primitive |value of type duration, default value: PT2S, The amount of time to wait when initially establishing a connection before giving up | |
50
+ |connectionAcquisitionTimeout |primitive |value of type duration, default value: PT10S, The amount of time to wait when acquiring a connection from the pool before giving up | |
51
+ |connectionTimeToLive |primitive |value of type duration, default value: PT0S, The maximum amount of time that a connection should be allowed to remain open, regardless of usage frequency| |
52
+ |connectionMaxIdleTime |primitive |value of type duration, default value: PT5S, Maximum amount of time that a connection should be allowed to remain open while idle | |
53
+ |useIdleConnectionReaper |primitive |value of type boolean, default value: true, If true, the idle connections in the pool should be closed | |
54
+ |protocol |primitive |value of type string, default value: Dual, HTTP/1.1 or HTTP/2 or Dual | |
55
+ |[channelOptions](channeloptions)|[all-of](channeloptions)|default value: NettyChannelOptions(Vector()), Custom Netty channel options | |
56
+ |sslProvider |primitive |value of type string, optional value, The SSL provider to be used | |
57
+ |[proxy](proxy) |[all-of](proxy) |optional value, Proxy configuration | |
58
+ |[http2](http2) |[all-of](http2) |optional value, HTTP/2 specific options | |
59
+
60
+ ### channelOptions
61
+
62
+ |FieldName |Format |Description |Sources|
63
+ |--- |--- |--- |--- |
64
+ |SO_BROADCAST |primitive|value of type boolean, optional value, Allow transmission of broadcast datagrams | |
65
+ |SO_KEEPALIVE |primitive|value of type boolean, optional value, Keep connection alive | |
66
+ |SO_SNDBUF |primitive|value of type int, optional value, The size of the socket send buffer | |
67
+ |SO_RCVBUF |primitive|value of type int, optional value, The size of the socket receive buffer | |
68
+ |SO_REUSEADDR |primitive|value of type boolean, optional value, Re-use address | |
69
+ |SO_LINGER |primitive|value of type int, optional value, Linger on close if data is present | |
70
+ |IP_TOS |primitive|value of type int, optional value, The ToS octet in the IP header | |
71
+ |IP_MULTICAST_IF |primitive|value of type string, optional value, The network interface's name for IP multicast datagrams| |
72
+ |IP_MULTICAST_TTL |primitive|value of type int, optional value, The time-to-live for IP multicast datagrams | |
73
+ |IP_MULTICAST_LOOP |primitive|value of type boolean, optional value, Loopback for IP multicast datagrams | |
74
+ |TCP_NODELAY |primitive|value of type boolean, optional value, Disable the Nagle algorithm | |
75
+ |CONNECT_TIMEOUT_MILLIS |primitive|value of type duration, optional value, Connect timeout | |
76
+ |WRITE_SPIN_COUNT |primitive|value of type int, optional value, Write spin count | |
77
+ |ALLOW_HALF_CLOSURE |primitive|value of type boolean, optional value, Allow half closure | |
78
+ |AUTO_READ |primitive|value of type boolean, optional value, Auto read | |
79
+ |AUTO_CLOSE |primitive|value of type boolean, optional value, Auto close | |
80
+ |SINGLE_EVENTEXECUTOR_PER_GROUP|primitive|value of type boolean, optional value, Single event executor per group | |
81
+
82
+ ### proxy
83
+
84
+ |FieldName |Format |Description |Sources|
85
+ |--- |--- |--- |--- |
86
+ |scheme |primitive|value of type string, default value: Http, The proxy scheme | |
87
+ |host |primitive|value of type string, Hostname of the proxy | |
88
+ |port |primitive|value of type int, Port of the proxy | |
89
+ |nonProxyHosts|list |value of type string, default value: Set(), Hosts that should not be proxied| |
90
+
91
+ ### http2
92
+
93
+ |FieldName |Format |Description |Sources|
94
+ |--- |--- |--- |--- |
95
+ |maxStreams |primitive|value of type long, Max number of concurrent streams per connection | |
96
+ |initialWindowSize |primitive|value of type int, Initial window size of a stream | |
97
+ |healthCheckPingPeriod|primitive|value of type duration, default value: PT5S, The period that the Netty client will send PING frames to the remote endpoint| |
98
+
99
+
100
+ ## Akka HTTP
101
+ The _Akka HTTP implementation_ can be chosen by using the `akkahttp.client()` layer for providing `HttpClient` to `AwsConfig`.
102
+ This implementation uses the [standard akka-http settings](https://doc.akka.io/docs/akka-http/current/configuration.html) from the application's _Lightbend config_,
103
+ it is not described with zio-config descriptors.
104
+
105
+ ## http4s
106
+ Another alternative is the _http4s client_. To use the default settings, provide the `http4s.default` layer to `AwsConfig`. Customization by manipulating the builder
107
+ is also possible by `http4s.customized(customization)`. And similarly to the _Netty_ client, configuration is also possible via zio-config:
108
+
109
+
110
+ ## Configuration Details
111
+
112
+
113
+ |FieldName|Format |Description|Sources|
114
+ |--- |--- |--- |--- |
115
+ | |[all-of](fielddescriptions)| | |
116
+
117
+ ### Field Descriptions
118
+
119
+ |FieldName |Format |Description |Sources|
120
+ |--- |--- |--- |--- |
121
+ |responseHeaderTimeout |primitive |value of type duration, default value: Duration.Inf, Timeout for receiving the header part of the response | |
122
+ |idleTimeout |primitive |value of type duration, default value: 1 minute, Timeout for client connection staying idle | |
123
+ |requestTimeout |primitive |value of type duration, default value: 45 seconds, Timeout for the whole request | |
124
+ |connectTimeout |primitive |value of type duration, default value: 10 seconds, Timeout for connecting to the server | |
125
+ |userAgent |primitive |value of type string, default value: User-Agent(http4s-blaze/3.0.2,List()), User-Agent header sent by the client| |
126
+ |maxTotalConnections |primitive |value of type int, default value: 10, Maximum number of parallel connections | |
127
+ |maxWaitQueueLimit |primitive |value of type int, default value: 256, Maximum number of requests in queue | |
128
+ |checkEndpointIdentification |primitive |value of type boolean, default value: true, Check https identity | |
129
+ |maxResponseLineSize |primitive |value of type int, default value: 4096, Maximum line length of headers in response | |
130
+ |maxHeaderLength |primitive |value of type int, default value: 40960, Maximum total length of the response headers | |
131
+ |maxChunkSize |primitive |value of type int, default value: 2147483647, Maximum chunk size | |
132
+ |chunkBufferMaxSize |primitive |value of type int, default value: 1048576, Maximum size of the chunk buffer | |
133
+ |parserMode |primitive |value of type string, default value: Strict, Parser mode, strict or lenient | |
134
+ |bufferSize |primitive |value of type int, default value: 8192, Buffer size | |
135
+ |[channelOptions](channeloptions)|[all-of](channeloptions)|default value: ChannelOptions(Vector(OptionValue(TCP_NODELAY,true))), Collection of socket options | |
136
+
137
+ ### channelOptions
138
+
139
+ |FieldName |Format |Description |Sources|
140
+ |--- |--- |--- |--- |
141
+ |SO_BROADCAST |primitive|value of type boolean, optional value, Allow transmission of broadcast datagrams | |
142
+ |SO_KEEPALIVE |primitive|value of type boolean, optional value, Keep connection alive | |
143
+ |SO_SNDBUF |primitive|value of type int, optional value, The size of the socket send buffer | |
144
+ |SO_RCVBUF |primitive|value of type int, optional value, The size of the socket receive buffer | |
145
+ |SO_REUSEADDR |primitive|value of type boolean, optional value, Re-use address | |
146
+ |SO_LINGER |primitive|value of type int, optional value, Linger on close if data is present | |
147
+ |IP_TOS |primitive|value of type int, optional value, The ToS octet in the IP header | |
148
+ |IP_MULTICAST_IF |primitive|value of type string, optional value, The network interface's name for IP multicast datagrams| |
149
+ |IP_MULTICAST_TTL |primitive|value of type int, optional value, The time-to-live for IP multicast datagrams | |
150
+ |IP_MULTICAST_LOOP|primitive|value of type boolean, optional value, Loopback for IP multicast datagrams | |
151
+ |TCP_NODELAY |primitive|value of type boolean, optional value, Disable the Nagle algorithm | |
152
+
package/index.md ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ id: index
3
+ title: "Overview"
4
+ ---
5
+
6
+ Low-level AWS wrapper for [ZIO](https://zio.dev) for _all_ AWS services using the AWS Java SDK v2.
7
+
8
+ The goal is to have access to all AWS functionality for cases when only a simple, direct access is
9
+ needed from a ZIO application, or to be used as a building block for higher level wrappers around specific services.
@@ -0,0 +1,223 @@
1
+ ---
2
+ id: migration-guide
3
+ title: Migration guide
4
+ ---
5
+
6
+ # Migration from v3.x.x.x
7
+
8
+ There are some major changes compared to the ZIO 1 version (v3.x.x.x and v4.x.x.x). This section contains detailed information about what changed and how to modify existing code.
9
+
10
+ ## New package names
11
+ Previously the zio-aws packages had the root package `io.github.vigoo.zioaws`. By moving to the ZIO organisation this changed to be simply `zio.aws`.
12
+
13
+ So imports for something using the EC2 and ElasticBeanstalk APIs would change from:
14
+
15
+ ```scala
16
+ import io.github.vigoo.zioaws.core._
17
+ import io.github.vigoo.zioaws.ec2.Ec2
18
+ import io.github.vigoo.zioaws.ec2.model._
19
+ import io.github.vigoo.zioaws.elasticbeanstalk.ElasticBeanstalk
20
+ import io.github.vigoo.zioaws.elasticbeanstalk.model._
21
+ ```
22
+
23
+ to
24
+
25
+ ```scala
26
+ import zio.aws.core._
27
+ import zio.aws.ec2.Ec2
28
+ import zio.aws.ec2.model._
29
+ import zio.aws.ec2.model.primitives._
30
+ import zio.aws.elasticbeanstalk.ElasticBeanstalk
31
+ import zio.aws.elasticbeanstalk.model._
32
+ import zio.aws.elasticbeanstalk.model.primitives._
33
+ ```
34
+
35
+ Some other changes to the imports may be necessary because of switching to the new service pattern of ZIO, described below.
36
+
37
+ ## New getter names
38
+
39
+ In previous version of zio-aws the generated models provided to ways to access fields:
40
+
41
+ - a ZIO effect that failed if the value is `None` with the name of the field (for example `.instanceId`)
42
+ - a simple value accessor returning an `Option` value with the `Value` suffix (for example `.instanceIdValue`)
43
+
44
+ This has been changed to match the convention used in `zio-k8s` to the following:
45
+
46
+ - the ZIO effect for requiring that a field has value now has the `get` prefix (for example `.getInstanceId`)
47
+ - the value with the field name is the simple accessor returning the optional value: (for example `.instanceId`)
48
+
49
+ So for example the following code that prints information about EC2 instances:
50
+
51
+ ```scala
52
+ for {
53
+ id <- instance.instanceId
54
+ typ <- instance.instanceType
55
+ launchTime <- instance.launchTime
56
+ _ <- console.putStrLn(s" instance $id:").ignore
57
+ _ <- console.putStrLn(s" type: $typ").ignore
58
+ _ <- console.putStrLn(s" launched at: $launchTime").ignore
59
+ } yield ()
60
+ ```
61
+
62
+ would have to be changed to:
63
+
64
+ ```scala
65
+ for {
66
+ id <- instance.getInstanceId
67
+ typ <- instance.getInstanceType
68
+ launchTime <- instance.getLaunchTime
69
+ _ <- Console.printLine(s" instance $id:").ignore
70
+ _ <- Console.printLine(s" type: $typ").ignore
71
+ _ <- Console.printLine(s" launched at: $launchTime").ignore
72
+ } yield ()
73
+ ```
74
+
75
+ ## New service pattern
76
+ Previous versions were following the _ZIO module pattern 1.0_, so all the generated AWS services consisted of a type alias using `Has`, a trait called `Service` and a package object with the service's name. With ZIO 2 we no longer have `Has` and the recommended way to structure services was changed to the simple new service pattern, where each service is just a `trait` and one or more implementation classes, constructed by layers.
77
+
78
+ In practice this means that:
79
+ - instead of the package object with lower-case name, the accessor functions are now in the service companion object (`ElasticBeanstalk.describeApplications` instead of `elasticbeanstalk.describeApplications`)
80
+ - same for the layers, for example `Ec2.live` instead of `ec2.live`
81
+ - the service trait has the name of the service (for example `Ec2`) instead of `Service`
82
+
83
+ The new service pattern is also applied to the core services like `AwsConfig` and the http implementations.
84
+
85
+ ## Optional parameters
86
+ A very large part of the fields of AWS models are optional. These previously had the type `Option`, and although for extracting data from them the library already had the generated getters, constructing these data types still required wrapping most of the parameters in `Some(...)`. To reduce this boilerplate zio-aws now uses the `Optional` type instead of `Option`, which was first used in [zio-k8s](https://coralogix.github.io/zio-k8s/docs/overview/overview_resources#model). Now the two libraries share the same type which was moved to [zio-prelude](https://zio.github.io/zio-prelude/).
87
+
88
+ The following example:
89
+
90
+ ```scala
91
+ kinesis.describeStreamConsumer(
92
+ DescribeStreamConsumerRequest(
93
+ consumerName = Some(consumerName),
94
+ streamARN = Some(streamDescription.streamDescriptionValue.streamARNValue)
95
+ )
96
+ )
97
+ ```
98
+
99
+ becomes
100
+
101
+ ```scala
102
+ Kinesis.describeStreamConsumer(
103
+ DescribeStreamConsumerRequest(
104
+ consumerName = consumerName,
105
+ streamARN = streamDescription.streamDescription.streamARN
106
+ )
107
+ )
108
+ ```
109
+
110
+ ## Newtypes
111
+ Previously zio-aws generated simple Scala type aliases for primitive types in the AWS SDKs. For example the `TableName` type in `zio-aws-dynamodb` was just a type alias for `String`:
112
+
113
+ ```scala
114
+ package io.github.vigoo.zioaws.dynamodb.model
115
+
116
+ package object primitives {
117
+ type TableName = String
118
+ }
119
+ ```
120
+
121
+ The new version uses [zio-prelude's newtype wrappers](https://zio.github.io/zio-prelude/docs/newtypes/) to provide better type safety:
122
+
123
+ ```scala
124
+ package zio.aws.dynamodb.model
125
+
126
+ package object primitives {
127
+ object TableName extends Subtype[String]
128
+ type TableName = TableName.Type
129
+ }
130
+ ```
131
+
132
+ In practice this means that we have to explicitly wrap these primitive values, for example instead of:
133
+
134
+ ```scala
135
+ elasticbeanstalk.describeApplications(
136
+ DescribeApplicationsRequest(applicationNames = Some(List("my-service")))
137
+ )
138
+ ```
139
+
140
+ now we have to write
141
+
142
+ ```scala
143
+ ElasticBeanstalk.describeApplications(
144
+ DescribeApplicationsRequest(applicationNames = List(ApplicationName("my-service")))
145
+ )
146
+ ```
147
+
148
+ and if we need to convert them to the underlying primitive type we need to call `unwrap`:
149
+
150
+ ```scala
151
+ ResourceId.unwrap(id)
152
+ ```
153
+
154
+ ## Aspects
155
+ zio-aws introduced `AwsCallAspect` soon after Adam Fraser's [talk](https://www.youtube.com/watch?v=gcqWdNwNEPg&t=2s) but it was a custom implementation, defined as:
156
+
157
+ ```scala
158
+ trait AwsCallAspect[-R] { self =>
159
+ def apply[R1 <: R, A](
160
+ f: ZIO[R1, AwsError, Described[A]]
161
+ ): ZIO[R1, AwsError, Described[A]]
162
+
163
+ // ...
164
+ }
165
+ ```
166
+
167
+ These aspects can be applied to whole zio-aws service layers to add logging, metrics, retries etc for every AWS Java SDK call.
168
+
169
+ The ZIO 2.0.0 version is now using ZIO's built-in aspect support as a base:
170
+
171
+ ```scala
172
+ type AwsCallAspect[-R] =
173
+ ZIOAspect[Nothing, R, AwsError, AwsError, Nothing, Described[_]]
174
+ ```
175
+
176
+ ### New built-in aspects
177
+ With ZIO 2 we have logging and metrics support built-in, so zio-aws now provides ready to use aspects for logging and monitoring AWS calls:
178
+
179
+ ```scala
180
+ val callLogging: AwsCallAspect[Any]
181
+ def callDuration(prefix: String, boundaries: MetricKeyType.Histogram.Boundaries): AwsCallAspect[Any]
182
+ ```
183
+
184
+ ### Changes in defining aspects
185
+ The following example aspect uses `rezilience` to add circuit breaking for an AWS service:
186
+
187
+ ```scala
188
+ def circuitBreaking(cb: CircuitBreaker[AwsError]): AwsCallAspect[Any] =
189
+ new AwsCallAspect[Any] {
190
+ override final def apply[R1 <: Any, A](
191
+ f: ZIO[R1, AwsError, Described[A]]
192
+ ): ZIO[R1, AwsError, Described[A]] =
193
+ cb(f).mapError(policyError =>
194
+ AwsError.fromThrowable(policyError.toException)
195
+ )
196
+ }
197
+ ```
198
+
199
+ because of the changed base type for `AwsCallAspect` with the new version the same aspect is defined like this:
200
+
201
+ ```scala
202
+ def circuitBreaking(cb: CircuitBreaker[AwsError]): AwsCallAspect[Any] =
203
+ new AwsCallAspect[Any] {
204
+ override final def apply[R, E >: AwsError <: AwsError, A <: Described[_]](
205
+ f: ZIO[R, E, A]
206
+ )(implicit trace: Trace): ZIO[R, E, A] =
207
+ cb(f).mapError(policyError =>
208
+ AwsError.fromThrowable(policyError.toException)
209
+ )
210
+ }
211
+ ```
212
+
213
+ The main differences:
214
+
215
+ - requiring the implicit `Trace`
216
+ - the constraints on the error and result types are now expressed as type bounds because the ZIO aspect is more generic
217
+
218
+ ## New config library
219
+
220
+ The 3.x series of zio-aws was using `zio-config 1.x`. The recently released 4.x series was using `zio-config 2.x` which is the ZIO 1 version of the config library's new API; The ZIO 2 version of zio-aws uses `zio-config 3.x` which is the same new config API but for ZIO 2.
221
+
222
+ This means that coming from zio-aws 3.x requires upgrading to the new config API. For more information about the changes in zio-config, [see it's release notes](https://github.com/zio/zio-config/releases/tag/v2.0.0-RC1).
223
+
package/package.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@zio.dev/zio-aws",
3
+ "description": "ZIO AWS Documentation",
4
+ "license": "Apache-2.0",
5
+ "version": "5.17.29-5.4"
6
+ }
package/sidebars.js ADDED
@@ -0,0 +1,15 @@
1
+ const sidebars = {
2
+ sidebar: [
3
+ "index",
4
+ "artifacts",
5
+ "wrappers",
6
+ "configuration",
7
+ "http",
8
+ "aspects",
9
+ "examples",
10
+ "changelog",
11
+ "migration-guide",
12
+ ]
13
+ };
14
+
15
+ module.exports = sidebars;