create method
Creates a new ServiceConnectionPolicy in a given project and location.
request
- The metadata request object.
Request parameters:
parent
- Required. The parent resource's name of the
ServiceConnectionPolicy. ex. projects/123/locations/us-east1
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
autoSubnetworkConfig_allocRangeSpace
- Optional. The space where we
search for a free range to create a subnetwork. It can be narrow down or
pick a different space. This is in standard CIDR format. If not specified,
“10.0.0.0/8” is used. Only eligible for IPV4_ONLY and IPV4_IPV6
subnetwork.
autoSubnetworkConfig_ipStack
- Optional. The requested IP stack for the
subnetwork. If not specified, IPv4 is used.
Possible string values are:
- "SUBNET_IP_STACK_UNSPECIFIED" : Default value. Will create an IPV4_ONLY subnetwork by default.
- "IPV4_ONLY" : Will create an IPV4_ONLY subnetwork.
- "IPV6_ONLY" : Will create an IPV6_ONLY subnetwork.
- "IPV4_IPV6" : Will use IPv4 and IPv6 (dual stack).
autoSubnetworkConfig_prefixLength
- Optional. The desired prefix length
for the subnet's IP address range. E.g., 24 for a /24. The actual range is
allocated from available space. If not specified, 24 is used. Only
eligible for IPV4_ONLY and IPV4_IPV6 subnetwork.
requestId
- Optional. An optional request ID to identify requests.
Specify a unique request ID so that if you must retry your request, the
server will know to ignore the request if it has already been completed.
The server will guarantee that for at least 60 minutes since the first
request. For example, consider a situation where you make an initial
request and the request times out. If you make the request again with the
same request ID, the server can check if original operation with the same
request ID was received, and if so, will ignore the second request. This
prevents clients from accidentally creating duplicate commitments. The
request ID must be a valid UUID with the exception that zero UUID is not
supported (00000000-0000-0000-0000-000000000000).
serviceConnectionPolicyId
- Optional. Resource ID (i.e. 'foo' in
'[...]/projects/p/locations/l/serviceConnectionPolicies/foo') See
https://google.aip.dev/122#resource-id-segments Unique per location.
subnetworkMode
- Optional. If this field is not set, USER_PROVIDED is
the inferred value to use.
Possible string values are:
- "SUBNETWORK_MODE_UNSPECIFIED" : The default value if the enum is unset. Note user is not allowed to set the subnetwork mode to this value.
- "USER_PROVIDED" : Subnetworks are provided from the user input.
- "AUTO_CREATED" : Subnetwork list is empty from the user input. A subnetwork will be created automatically.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleLongrunningOperation.
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<GoogleLongrunningOperation> create(
ServiceConnectionPolicy request,
core.String parent, {
core.String? autoSubnetworkConfig_allocRangeSpace,
core.String? autoSubnetworkConfig_ipStack,
core.int? autoSubnetworkConfig_prefixLength,
core.String? requestId,
core.String? serviceConnectionPolicyId,
core.String? subnetworkMode,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (autoSubnetworkConfig_allocRangeSpace != null)
'autoSubnetworkConfig.allocRangeSpace': [
autoSubnetworkConfig_allocRangeSpace,
],
if (autoSubnetworkConfig_ipStack != null)
'autoSubnetworkConfig.ipStack': [autoSubnetworkConfig_ipStack],
if (autoSubnetworkConfig_prefixLength != null)
'autoSubnetworkConfig.prefixLength': [
'${autoSubnetworkConfig_prefixLength}',
],
if (requestId != null) 'requestId': [requestId],
if (serviceConnectionPolicyId != null)
'serviceConnectionPolicyId': [serviceConnectionPolicyId],
if (subnetworkMode != null) 'subnetworkMode': [subnetworkMode],
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1/' + core.Uri.encodeFull('$parent') + '/serviceConnectionPolicies';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleLongrunningOperation.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}