On Thu, Jul 27, 2017 at 9:23 AM, Andrew Lau <and...@andrewklau.com> wrote:

> On Thu, 27 Jul 2017 at 22:52 Ben Parees <bpar...@redhat.com> wrote:
>
>> On Thu, Jul 27, 2017 at 1:41 AM, Andrew Lau <and...@andrewklau.com>
>> wrote:
>>
>>> What is the purpose of the {name} URL parameter for the instantiate in
>>> BuildRequests? ie.
>>> POST /oapi/v1/namespaces/{namespace}/buildconfigs/{name}/instantiate
>>>
>>
>> the {name} parameter is the name of the buildconfig you are instantiating
>> a new build of, not the name of the build being created.
>>
>>
> I don't think that's the case.
>
> In my example I have the build config "test"
>
> So when I POST /oapi/v1/namespaces/{namespace}/buildconfigs/test/instantiate
> with the body:
>
> {
>     "triggeredBy" : {}
> }
>
> It will return the 403 error:
>
> "message": "buildconfigs "Unknown" is forbidden: resource name may not be
> empty"
>
> Then if I post something like:
>
> {
>       "metadata": {
>       "name": "test2"
>     },
>     "triggeredBy" : {}
> }
>
> I still get the error:
>
> "message": "buildconfigs "test2" is forbidden: buildconfigs "test2" not
> found",
>
> Only until metadata.name matches the buildconfig will I get the 201
> created code.
>
> Now the second confusing thing is I can POST  /oapi/v1/namespaces/{
> namespace}/buildconfigs/idontexist/instantiate
>
> {
>       "metadata": {
>       "name": "test"
>     },
>     "triggeredBy" : {}
> }
>
> Now this is accepted and creates the build for test, even though I posted
> to the buildconfig"idontexist" which also doesn't exist..
>

you're correct, the rest endpoint for instantiate does not actually care
what resource you invoked it with, all that matters is the name field of
the buidlrequest object, the name field provides the name of the
buildconfig you are instantiating.



>
>
>>
>>>
>>> https://docs.openshift.org/latest/rest_api/openshift_v1.
>>> html#create-instantiate-of-a-buildrequest
>>>
>>> The docs seem to suggest it's the name but I can set it to anything and
>>> the name ends up getting pulled from the JSON body ie.:
>>>
>>> {
>>>       "metadata": {
>>>       "name": "test"
>>>     },
>>>     "triggeredBy" : {}
>>> }
>>>
>>> If my JSON body does not include a name then it complains that there is
>>> no "name".
>>>
>>> _______________________________________________
>>> users mailing list
>>> users@lists.openshift.redhat.com
>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>>
>>>
>>
>>
>> --
>> Ben Parees | OpenShift
>>
>>


-- 
Ben Parees | OpenShift
_______________________________________________
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to