Skip to content

Conversation

patst
Copy link

@patst patst commented Nov 22, 2023

As far as i understood the dataplane APIs are not (yet) part of https://github.com/hashicorp/go-azure-sdk .

I want to create datasources, indices and indexer for the Azure Search Service via terraform. See this old issue hashicorp/terraform-provider-azurerm#11699

I tried to use the Azure/go-azure-sdk directly but it does only contain the arm endpoints as well (https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/search/armsearch ).

Creating the above mentioned resources is done using the dataplane APIs.

See:

I tried to run the generation locally, but nothing changed inside the ./sdk folder. There was no error visible and exit code was 0.

Maybe I misconfigured something. Any ideas?

@tombuildsstuff
Copy link
Owner

@patst

Taking a quick look into this one, whilst the Swagger Tag exists for this API Version, there isn't an associated directive for the Go SDK generator for this Swagger Tag, which I believe is why the autorest generator is outputting nothing here.

Since those files need updating - I'd suggest that it's worth taking a similar approach to IoTCentral - where we have an updated copy of the autorest.md and autorest.go.md files in this directory with the additional directive and that also updates the Swagger file paths relative to the submodule.

I believe that should fix that, unfortunately the autorest tooling isn't particularly descriptive when there's nothing to do - but let me know if that doesn't work and we can take another look 👍

@patst
Copy link
Author

patst commented Nov 23, 2023

@tombuildsstuff thanks for the response and great explanation, that helped a lot.

I followed your recommendations and added the required files.

(I added some error logging as well, because the error messages where swallowed. I had not installed autorest locally).

The API generation is now running, but fails with:

2023/11/23 09:28:48 [DEBUG] Generating Data Plane Service "search" / API Version "2023-11-01" / Swagger Tag "package-2023-11-01" / Readme "../../config/search/readme.md"
2023/11/23 09:28:48 [DEBUG] Generating Service "search" / Tag "package-2023-11-01" into "../../sdk/search/2023-11-01/search"..
2023/11/23 09:28:48 [DEBUG] Launching `autorest [email protected]/[email protected] --tag=package-2023-11-01 --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix --namespace=search --openapi-type=data-plane --output-folder=../../sdk/search/2023-11-01/search ../../config/search/readme.md`
AutoRest code generation utility [cli version: 3.7.0; node: v21.2.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    | AutoRest core version selected from configuration: 2.0.4421.
   Loading AutoRest core      '/Users/patst/.autorest/@[email protected]/nodemodules/@microsoft.azure/autorest-core/dist' (2.0.4421)
   Including configuration file 'file:///Users/patst/git/github/tombuildsstuff/kermit/config/search/readme.go.md'
   Loading AutoRest extension '@microsoft.azure/autorest.go' (2.1.188->2.1.188)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38->2.3.38)
FATAL: swagger-document/compose - FAILED
FATAL: Error: '$["x-ms-parameterized-host"].hostTemplate' has incompatible values (---
'{endpoint}'
, ---
'{endpoint}/indexes(''{indexName}'')'
).
Process() cancelled due to exception : '$["x-ms-parameterized-host"].hostTemplate' has incompatible values (---
'{endpoint}'
, ---
'{endpoint}/indexes(''{indexName}'')'
).
  Error: '$["x-ms-parameterized-host"].hostTemplate' has incompatible values (---
'{endpoint}'
, ---
'{endpoint}/indexes(''{indexName}'')'
).
2023/11/23 09:28:56 Error running generator: running generator (Command: autorest "1") had exit code "[email protected]/[email protected] --tag=package-2023-11-01 --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix --namespace=search --openapi-type=data-plane --output-folder=../../sdk/search/2023-11-01/search ../../config/search/readme.md": exit status 1

Not sure if my local autorest version is the problem:

autorest -v                                                                                                                            (aks-dev-gwc-1/grafana-tempo)
#AutoRest code generation utility [cli version: 3.7.0; node: v21.2.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    |    Loading AutoRest core      '/Users/patst/.autorest/@[email protected]/nodemodules/@autorest/core/dist' (3.6.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants