Is there a way to set the name when creating an AP...
# azure
w
Is there a way to set the name when creating an API in API management through the nextgen sdk with an openapi link? I want to have two instances based on the same openapi spec, but it seems like the name is taken from the openapi spec and I don't find any argument to override it. It is possible in the old sdk so I use that for now, but I didn't find a way to do it in nextgen.
t
Do you have the Azure NextGen snippet at hand?
w
sure:
Copy code
module Api =
        open Pulumi.AzureNextGen.ApiManagement.Latest
        let createDefaultArgs apiId path swaggerUrl serviceName resourceGroupName =
            let apiVersion = input "v1"
            let subscriptionRequired = input true

            ApiArgs(
                ApiId = apiId,
                Format = input "openapi-link",
                Path = path,
                ResourceGroupName = resourceGroupName,
                ServiceName = serviceName,
                Value = swaggerUrl,
                SubscriptionRequired = subscriptionRequired
            )
The
Pulumi.Azure.ApiManagement.Inputs.ApiArgs
has a
Name
property that isn't there for Azure NextGen.
t
Isn’t it the same as
apiId
?
w
ah... it most likely is. I was expecting it to be named something with "name", I think that is what it is called in the UI.
@tall-librarian-49374, on a second thought... I did think I changed that actually, but it didn't reflect a change in the name.
t
Well, that’s how Azure models there API, we don’t rename parameters. See e.g. https://github.com/Azure/azure-sdk-for-go/blob/master/services/apimanagement/mgmt/2019-12-01/apimanagement/api.go#L49
w
still unclear if apiid is supposed to be mapped to name. Working with APIM hasn't been as straightforward as my previous experience, but I guess that could be because of how things work on azure.
s
I suspect that
ApiId
is the name, certainly it appears to map that way for
OperationId
- playing with the Azure CLI the value that comes back in JSON is "name" but the parameters you supply that value to are
xxxId
w
I'll try some more. I do think the APIM bits is really shaky. For some reasons when I deploy I get an error from time to time where it complains about the name being a duplicate, which is strange. The name it refers to is the title in the openapi spec we have, but that should only be used if we don't provide a name I think.