package awso-async

  1. Overview
  2. Docs
AWS client for Async (400+ services, auto-generated from botocore)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

awso-0.9.0.tbz
sha256=47224890900b1f5d2bd717000a02fa8918f92eafa99f702f7d59a1b053ff8e95
sha512=e187288f7c8fccb221f5417671732c8c8de95cdbacba1514db592b5700df2293468bde07956539bd44f3d460f6c75d38bd66ca161d0eae68a8b1b4e081882367

doc/src/awso-async.resourcegroupstaggingapi/cli.ml.html

Source file cli.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
(* generated by: awso-codegen generate-all --botocore-data vendor/botocore/botocore/data -o aws --runtime-dir lib/runtime/awso --cli-dir awso-cli *)
open Core
open Async
let json_arg = Command.Arg_type.create Yojson.Safe.from_string
let call ?endpoint_url ?profile ?region f m result_to_json error_to_json =
  let region =
    match region with
    | Some region -> Some (Awso.Region.of_string region)
    | None -> None in
  (Awso_async.Cfg.get_exn ?profile ?region ()) >>=
    (fun cfg ->
       (f ?endpoint_url ?cfg:(Some cfg) m) >>=
         (fun result ->
            match result with
            | Error err ->
                (match error_to_json with
                 | None ->
                     failwithf
                       "endpoint error, but no error values defined in boto"
                       ()
                 | Some to_json ->
                     let s = (err |> to_json) |> Yojson.Safe.to_string in
                     failwithf "AWS error: %s" s ())
            | Ok result ->
                ((match result_to_json with
                  | None -> print_endline "ok response from endpoint"
                  | Some to_json ->
                      ((result |> to_json) |> Yojson.Safe.to_string) |>
                        print_endline);
                 return ())))
let describe_report_creation =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and () = return () in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.describe_report_creation
           (Values.DescribeReportCreationInput.make ())
           (Some Values.DescribeReportCreationOutput.to_json)
           (Some Values.DescribeReportCreationOutput.error_to_json)])
let get_compliance_summary =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and targetIdFilters =
         flag "target-id-filters" (optional json_arg)
           ~doc:"JSON TargetIdFilterList"
       and regionFilters =
         flag "region-filters" (optional json_arg)
           ~doc:"JSON RegionFilterList"
       and resourceTypeFilters =
         flag "resource-type-filters" (optional json_arg)
           ~doc:"JSON ResourceTypeFilterList"
       and tagKeyFilters =
         flag "tag-key-filters" (optional json_arg)
           ~doc:"JSON TagKeyFilterList"
       and groupBy = flag "group-by" (optional json_arg) ~doc:"JSON GroupBy"
       and maxResults =
         flag "max-results" (optional int)
           ~doc:"INT MaxResultsGetComplianceSummary"
       and paginationToken =
         flag "pagination-token" (optional string)
           ~doc:"STRING PaginationToken" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.get_compliance_summary
           (Values.GetComplianceSummaryInput.make
              ?targetIdFilters:(Option.map
                                  ~f:Values.TargetIdFilterList.of_json
                                  targetIdFilters)
              ?regionFilters:(Option.map ~f:Values.RegionFilterList.of_json
                                regionFilters)
              ?resourceTypeFilters:(Option.map
                                      ~f:Values.ResourceTypeFilterList.of_json
                                      resourceTypeFilters)
              ?tagKeyFilters:(Option.map ~f:Values.TagKeyFilterList.of_json
                                tagKeyFilters)
              ?groupBy:(Option.map ~f:Values.GroupBy.of_json groupBy)
              ?maxResults ?paginationToken ())
           (Some Values.GetComplianceSummaryOutput.to_json)
           (Some Values.GetComplianceSummaryOutput.error_to_json)])
let get_resources =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and paginationToken =
         flag "pagination-token" (optional string)
           ~doc:"STRING PaginationToken"
       and tagFilters =
         flag "tag-filters" (optional json_arg) ~doc:"JSON TagFilterList"
       and resourcesPerPage =
         flag "resources-per-page" (optional int) ~doc:"INT ResourcesPerPage"
       and tagsPerPage =
         flag "tags-per-page" (optional int) ~doc:"INT TagsPerPage"
       and resourceTypeFilters =
         flag "resource-type-filters" (optional json_arg)
           ~doc:"JSON ResourceTypeFilterList"
       and includeComplianceDetails =
         flag "include-compliance-details" (optional bool)
           ~doc:"BOOL IncludeComplianceDetails"
       and excludeCompliantResources =
         flag "exclude-compliant-resources" (optional bool)
           ~doc:"BOOL ExcludeCompliantResources"
       and resourceARNList =
         flag "resource-a-r-n-list" (optional json_arg)
           ~doc:"JSON ResourceARNListForGet" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.get_resources
           (Values.GetResourcesInput.make ?paginationToken
              ?tagFilters:(Option.map ~f:Values.TagFilterList.of_json
                             tagFilters) ?resourcesPerPage ?tagsPerPage
              ?resourceTypeFilters:(Option.map
                                      ~f:Values.ResourceTypeFilterList.of_json
                                      resourceTypeFilters)
              ?includeComplianceDetails ?excludeCompliantResources
              ?resourceARNList:(Option.map
                                  ~f:Values.ResourceARNListForGet.of_json
                                  resourceARNList) ())
           (Some Values.GetResourcesOutput.to_json)
           (Some Values.GetResourcesOutput.error_to_json)])
let get_tag_keys =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and paginationToken =
         flag "pagination-token" (optional string)
           ~doc:"STRING PaginationToken" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.get_tag_keys (Values.GetTagKeysInput.make ?paginationToken ())
           (Some Values.GetTagKeysOutput.to_json)
           (Some Values.GetTagKeysOutput.error_to_json)])
let get_tag_values =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and paginationToken =
         flag "pagination-token" (optional string)
           ~doc:"STRING PaginationToken"
       and key = flag "key" (required string) ~doc:"STRING TagKey" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.get_tag_values
           (Values.GetTagValuesInput.make ?paginationToken ~key ())
           (Some Values.GetTagValuesOutput.to_json)
           (Some Values.GetTagValuesOutput.error_to_json)])
let list_required_tags =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and nextToken =
         flag "next-token" (optional string) ~doc:"STRING PaginationToken"
       and maxResults =
         flag "max-results" (optional int)
           ~doc:"INT MaxResultsForListRequiredTags" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.list_required_tags
           (Values.ListRequiredTagsInput.make ?nextToken ?maxResults ())
           (Some Values.ListRequiredTagsOutput.to_json)
           (Some Values.ListRequiredTagsOutput.error_to_json)])
let start_report_creation =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and s3Bucket =
         flag "s3-bucket" (required string) ~doc:"STRING S3Bucket" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.start_report_creation
           (Values.StartReportCreationInput.make ~s3Bucket ())
           (Some Values.StartReportCreationOutput.to_json)
           (Some Values.StartReportCreationOutput.error_to_json)])
let tag_resources =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and resourceARNList =
         flag "resource-a-r-n-list" (required json_arg)
           ~doc:"JSON ResourceARNListForTagUntag"
       and tags = flag "tags" (required json_arg) ~doc:"JSON TagMap" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.tag_resources
           (Values.TagResourcesInput.make
              ~resourceARNList:(Values.ResourceARNListForTagUntag.of_json
                                  resourceARNList)
              ~tags:(Values.TagMap.of_json tags) ())
           (Some Values.TagResourcesOutput.to_json)
           (Some Values.TagResourcesOutput.error_to_json)])
let untag_resources =
  Command.async ~summary:""
    ([%map_open.Command
       let cli_profile =
         flag "-cli-profile" (optional string) ~doc:"NAME aws profile to use"
       and cli_region =
         flag "-cli-region" (optional string) ~doc:"REGION override region"
       and endpoint_url =
         flag "-endpoint-url" (optional string)
           ~doc:"URL override endpoint url"
       and resourceARNList =
         flag "resource-a-r-n-list" (required json_arg)
           ~doc:"JSON ResourceARNListForTagUntag"
       and tagKeys =
         flag "tag-keys" (required json_arg) ~doc:"JSON TagKeyListForUntag" in
       fun () ->
         call ?endpoint_url ?profile:cli_profile ?region:cli_region
           Io.untag_resources
           (Values.UntagResourcesInput.make
              ~resourceARNList:(Values.ResourceARNListForTagUntag.of_json
                                  resourceARNList)
              ~tagKeys:(Values.TagKeyListForUntag.of_json tagKeys) ())
           (Some Values.UntagResourcesOutput.to_json)
           (Some Values.UntagResourcesOutput.error_to_json)])
let main =
  Command.group
    ~summary:((Awso.Service.to_string Values.service) ^ " commands")
    [("describe-report-creation", describe_report_creation);
    ("get-compliance-summary", get_compliance_summary);
    ("get-resources", get_resources);
    ("get-tag-keys", get_tag_keys);
    ("get-tag-values", get_tag_values);
    ("list-required-tags", list_required_tags);
    ("start-report-creation", start_report_creation);
    ("tag-resources", tag_resources);
    ("untag-resources", untag_resources)]