def create_apim_api(client, resource_group_name, service_name, api_id, description=None, subscription_key_header_name=None, subscription_key_query_param_name=None, open_id_provider_id=None, bearer_token_sending_methods=None, authorization_server_id=None, authorization_scope=None, display_name=None, service_url=None, protocols=None, path=None, subscription_key_required=None, api_type=None, subscription_required=False, no_wait=False): """Creates a new API. """ if authorization_server_id is not None and authorization_scope is not None: o_auth2 = OAuth2AuthenticationSettingsContract( authorization_server_id=authorization_server_id, scope=authorization_scope) authentication_settings = AuthenticationSettingsContract( o_auth2=o_auth2, subscription_key_required=subscription_key_required) elif open_id_provider_id is not None and bearer_token_sending_methods is not None: openid = OpenIdAuthenticationSettingsContract( openid_provider_id=open_id_provider_id, bearer_token_sending_methods=bearer_token_sending_methods) authentication_settings = AuthenticationSettingsContract( openid=openid, subscription_key_required=subscription_key_required) else: authentication_settings = None resource = ApiContract( api_id=api_id, description=description, authentication_settings=authentication_settings, subscription_key_parameter_names=get_subscription_key_parameter_names( subscription_key_query_param_name, subscription_key_header_name), display_name=display_name, service_url=service_url, protocols=protocols if protocols is not None else [Protocol.https.value], path=path, api_type=api_type if api_type is not None else ApiType.http.value, subscription_required=subscription_required) return sdk_no_wait(no_wait, client.api.create_or_update, resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, parameters=resource)
def create_apim_api(client, resource_group_name, service_name, api_id, description=None, subscription_key_parameter_names=None, api_revision=None, api_version=None, is_current=True, display_name=None, service_url=None, protocols=Protocol.https.value, path=None, api_type=ApiType.http.value, subscription_required=False, tags=None, no_wait=False): """Creates a new API. """ resource = ApiContract( api_id=api_id, description=description, subscription_key_parameter_names=subscription_key_parameter_names, api_revision=api_revision, api_version=api_version, is_current=is_current, display_name=display_name, service_url=service_url, protocols=protocols.split(','), path=path, api_type=api_type, subscription_required=subscription_required, tags=tags) cms = client.api return sdk_no_wait(no_wait, cms.create_or_update, resource_group_name=resource_group_name, service_name=service_name, api_id=api_id, parameters=resource)