Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions autorest/codegen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def _get_credential_param(self, azure_arm, credential, credential_default_policy
"--credential-key-header-name."
)
if not credential_key_header_name:
raise ValueError(
"With default credential policy type AzureKeyCredentialPolicy, you must pass in the name "
"of the key header with the flag --credential-key-header-name"
credential_key_header_name = "api-key"
_LOGGER.warning(
"Defaulting the AzureKeyCredentialPolicy header's name to 'api-key'"
)
return credential_scopes, credential_key_header_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"credential_scopes": null,
"credential_default_policy_type": "AzureKeyCredentialPolicy",
"credential_default_policy_type_has_async_version": false,
"credential_key_header_name": "Authorization",
"credential_key_header_name": "api-key",
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"credential_scopes": null,
"credential_default_policy_type": "AzureKeyCredentialPolicy",
"credential_default_policy_type_has_async_version": false,
"credential_key_header_name": "Authorization",
"credential_key_header_name": "api-key",
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"credential_scopes": null,
"credential_default_policy_type": "AzureKeyCredentialPolicy",
"credential_default_policy_type_has_async_version": false,
"credential_key_header_name": "Authorization",
"credential_key_header_name": "api-key",
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}, \"azurecore\": {\"azure.core.credentials\": [\"AzureKeyCredential\"]}}}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'Authorization', **kwargs)
self.authentication_policy = policies.AzureKeyCredentialPolicy(self.credential, 'api-key', **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ license-header: MICROSOFT_MIT_NO_VERSION
azure-arm: true
add-credentials: true
credential-default-policy-type: AzureKeyCredentialPolicy
credential-key-header-name: Authorization
```

``` yaml $(multiapi)
Expand Down