create method
Creates an API proxy.
The API proxy created will not be accessible at runtime until it is
deployed to an environment. Create a new API proxy by setting the name
query parameter to the name of the API proxy. Import an API proxy
configuration bundle stored in zip format on your local machine to your
organization by doing the following: * Set the name
query parameter to
the name of the API proxy. * Set the action
query parameter to import
.
- Set the
Content-Type
header tomultipart/form-data
. * Pass as a file the name of API proxy configuration bundle stored in zip format on your local machine using thefile
form field. Note: To validate the API proxy configuration bundle only without importing it, set theaction
query parameter tovalidate
. When importing an API proxy configuration bundle, if the API proxy does not exist, it will be created. If the API proxy exists, then a new revision is created. Invalid API proxy configurations are rejected, and a list of validation errors is returned to the client.
request
- The metadata request object.
Request parameters:
parent
- Required. Name of the organization in the following format:
organizations/{org}
Value must have pattern ^organizations/\[^/\]+$
.
action
- Action to perform when importing an API proxy configuration
bundle. Set this parameter to one of the following values: * import
to
import the API proxy configuration bundle. * validate
to validate the
API proxy configuration bundle without importing it.
name
- Name of the API proxy. Restrict the characters used to:
A-Za-z0-9._-
validate
- Ignored. All uploads are validated regardless of the value of
this field. Maintained for compatibility with Apigee Edge API.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleCloudApigeeV1ApiProxyRevision.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleCloudApigeeV1ApiProxyRevision> create(
GoogleApiHttpBody request,
core.String parent, {
core.String? action,
core.String? name,
core.bool? validate,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (action != null) 'action': [action],
if (name != null) 'name': [name],
if (validate != null) 'validate': ['${validate}'],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/apis';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleCloudApigeeV1ApiProxyRevision.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}