AWS CLI Cognito User Pool Client Creation fails - amazon-cognito

I've got a Cognito user pool in AWS, and I'm trying to create a Bash script to add an app client to it using aws cli.
I'm running the following:
aws cognito-idp create-user-pool-client \
--user-pool-id $user_pool_id \
--client-name toy-client \
--callback-urls "https://example.com"
where user_pool_id is set to the id of my user pool.
When I do so, I get a long error, of which this is the first few characters:
An error occurred (InvalidParameterException) when calling the CreateUserPoolClient operation: 2 validation errors detected: Value '[<, !, d, o, c, t, y, p, e, , h, t, m, l, >,
, <, h, t, m, l, >,
, <, h, e, a, d, >,
, , , , , <, t, i, t, l, e, >, E, x, a, m, p, l, e, , D, o, m, a, i, n, <, /, t, i, t, l, e, >...
It looks very much like it's retrieved https://example.com, which it does to verify it's accessible, but then it seems to be using the contents in place of the URL.
If I set this URL as the callback_url when creating an app client in the AWS console, it works fine.
Any suggestions as to what I'm doing wrong, or is this a bug?

Looks like the CLI isn't configured to accept the callback URL as a string and is instead loading the URL and passing the response as the parameter.
Ensure you are running the latest version of the CLI (preferably version 2). If you can't use v2 for whatever reason you can fix this behavior by setting cli_follow_urlparam = false in your aws config file ~/.aws/config as specified here.

Related

Purpose of anonymous modules in Agda

Going at the root of Agda standard library, and issuing the following command:
grep -r "module _" . | wc -l
Yields the following result:
843
Whenever I encounter such anonymous modules (I assume that's what they are called), I quite cannot figure out what their purpose is, despite of their apparent ubiquity, nor how to use them because, by definition, I can't access their content using their name, although I assume this should be possible, otherwise their would be no point in even allowing them to be defined.
The wiki page:
https://agda.readthedocs.io/en/v2.6.1/language/module-system.html#anonymous-modules
has a section called "anonymous modules" which is in fact empty.
Could somebody explain what the purpose of anonymous modules is ?
If possible, any example to emphasize the relevance of the definition of such modules, as well as how to use their content would be very much appreciated.
Here are the possible ideas I've come up with, but none of them seems completely satisfying:
They are a way to regroup thematically identical definitions inside an Agda file.
Their name is somehow infered by Agda when using the functions they provide.
Their content is only meant to be visible / used inside their englobing module (a bit like a private block).
Anonymous modules can be used to simplify a group of definitions which share some arguments. Example:
open import Data.Empty
open import Data.Nat
<⇒¬≥ : ∀ {n m} → n < m → n ≥ m → ⊥
<⇒¬≥ = {!!}
<⇒> : ∀ {n m} → n < m → m > n
<⇒> = {!!}
module _ {n m} (p : n < m) where
<⇒¬≥′ : n ≥ m → ⊥
<⇒¬≥′ = {!!}
<⇒>′ : m > n
<⇒>′ = {!!}
Afaik this is the only use of anonymous modules. When the module _ scope is closed, you can't refer to the module anymore, but you can refer to its definitions as if they hadn't been defined in a module at all (but with extra arguments instead).

Nextflow : Is it possible to tranform a queue channel to a value channel?

I have a process A which outputs a file into a channel outA. I want to use that file as input for 3 downstream processes B, C and D. As the channel outA created is a queue channel by default, I cannot directly use the file more than once (unlike value channels).
Currently, I use the into operator to duplicate the channel outA as described here (see the code below).
I also know that you can create a value channel from a file by doing Channel.value(file('/path/to/file.txt')).
My code currently :
// Upstream process creating a queue channel with one file
process A {
output:
file outA
"echo 'Bonjour le monde !' > $outA"
}
// Queue channel triplication
outA.into {inB; inC; inD}
// Downstream processes all using the same file
process B {
input:
file inB
"script of process B $inB"
}
process C {
input:
file inC
"script of process C $inC"
}
process D {
input:
file inD
"script of process D $inD"
}
I works fine as it is, but I wonder if it is possible to transform the queue channel outA into a value channel, so that I can use the same channel as input for processes B, C and D.
You can use the first() operator to do that, e.g.:
inX = outA.first()
process B {
input:
file inX
"script of process B $inX"
}
etc
Also note that when a process has no input (like process A) its outputs are implicitly value channels.

Redefining operator precedence in a module for exported predicate

I would like to write a module that exports a predicate where the user should be able to access a predicate p/1 as a prefix operator. I have defined the following module:
:- module(lala, [p/1]).
:- op(500, fy, [p]).
p(comment).
p(ca).
p(va).
and load it now via:
?- use_module(lala).
true.
Unfortunately, a query fails:
?- p X.
ERROR: Syntax error: Operator expected
ERROR: p
ERROR: ** here **
ERROR: X .
After setting the operator precedence properly, everything works:
?- op(500, fy, [p]).
true.
?- p X.
X = comment ;
X = ca ;
X = va.
I used SWI Prolog for my output but the same problem occurs in YAP as well (GNU Prolog does not support modules). Is there a way the user does not need to set the precedence themselves?
You can export the operator with the module/2 directive.
For example:
:- module(lala, [p/1,
op(500, fy, p)]).
Since the operator is then also available in the module, you can write for example:
p comment.
p ça.
p va.
where p is used as a prefix operator.

How to enable hints and warnings in the online REPL

I figured that I can do it on the command line REPL like so:
java -jar frege-repl-1.0.3-SNAPSHOT.jar -hints -warnings
But how can I do the same in http://try.frege-lang.org
Hints and warnings are already enabled by default. For example,
frege> f x = f x
function f :: α -> β
3: application of f will diverge.
Perhaps we can make it better by explicitly saying it as warning or hint (instead of colors distinguishing them) something like:
[Warning] 3: application of f will diverge.
and providing an option to turn them on/off.
Update:
There was indeed an issue (Thanks Ingo for pointing that out!) with showing warnings that are generated in a later phase during the compilation. This issue has been fixed and the following examples now correctly display warnings in the REPL:
frege> h x = 0; h false = 42
function h :: Bool -> Int
4: equation or case alternative cannot be reached.
frege> f false = 6
function f :: Bool -> Int
5: function pattern is refutable, consider
adding a case for true

Why does the Io REPL and the interpreter give me two different values?

Consider this code:
OperatorTable addOperator(":", 2)
: := method(value,
list(self, value)
)
hash := "key": "value"
hash println
The return should be list(key, value), and when using this in the Io REPL that is exactly the return value. When using the interpreter (as in io somefile.io) the value returned is value. After some inspection the difference is here:
# In the REPL
OperatorTable addOperator(":", 2)
message("k" : "v") # => "k" :("v")
# Via the Interpreter
OperatorTable addOperator(":", 2)
message("k" : "v") # => "k" : "v"
Why is this happening?
File execution happens in these stages:
load file
replace operators based on the current operator table
execute contents
So operator to message conversion only happens when the file is initially loaded in stage 2.
When the operator registration code is executed in stage 3. this has already happened,
thus the operator has no effect.
You can set the order which files get loaded manually and put the operator definition in the first file loaded.
Having a file called operators.io for example which includes all operator definitions loaded before the files that use them.
After confirming with ticking I arrived at the following solution:
main.io:
doFile("ops.io")
doFile("script.io")
ops.io:
OperatorTable addOperator(":", 2)
: := method(value,
list(self, value))
script.io:
hash := "key": "value"
hash println
Like ticking explains, the whole file is loaded at once so you have to split it up so the loading order guarantees that the operators are available.