

# CreateNetworkScope

Creates a network scope for AWS Ops Agent for networking. A network scope defines the AWS accounts and Regions that AWS Ops Agent for networking analyzes.

The network scope starts in the `PENDING` state and moves to `AVAILABLE` when it's ready, or to `FAILED` if a prerequisite is missing. To associate accounts with it, call `AssociateNetworkScopePrincipal`.

## Request Syntax
<a name="API_CreateNetworkScope_RequestSyntax"></a>

```
POST /network-scopes HTTP/1.1
Content-type: application/json

{
   "AccessMode": "{{string}}",
   "ClientToken": "{{string}}",
   "Name": "{{string}}",
   "NetworkScopeRegions": [ "{{string}}" ],
   "Tags": [ 
      { 
         "Key": "{{string}}",
         "Value": "{{string}}"
      }
   ]
}
```

## URI Request Parameters
<a name="API_CreateNetworkScope_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_CreateNetworkScope_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [AccessMode](#API_CreateNetworkScope_RequestSyntax) **   <a name="networkmanager-CreateNetworkScope-request-AccessMode"></a>
How the network scope admits principals. Each principal must be the ID of an AWS account that has the AWS Network Manager service-linked role. With `ACCOUNTS`, the account can be any AWS account. With `ORGANIZATIONS`, the account that owns the network scope must be the management account or a delegated administrator for AWS Network Manager in its organization, and each principal must be an active member account of that organization. A delegated administrator can't add the management account. You choose the access mode when you create the network scope, and you can't change it.  
Type: String  
Valid Values: `ACCOUNTS | ORGANIZATIONS`   
Required: Yes

 ** [ClientToken](#API_CreateNetworkScope_RequestSyntax) **   <a name="networkmanager-CreateNetworkScope-request-ClientToken"></a>
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry within 8 hours with the same client token and the same parameters, the operation returns the network scope that the first request created. If that network scope no longer exists, the operation returns `ConflictException`, and you need a new client token. If you reuse a client token with different parameters, the operation returns `ValidationException`. If you don't specify a client token, the AWS SDK generates one.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 256.  
Pattern: `[\s\S]*`   
Required: No

 ** [Name](#API_CreateNetworkScope_RequestSyntax) **   <a name="networkmanager-CreateNetworkScope-request-Name"></a>
The name of the network scope. The name can be up to 128 characters long and can contain letters, numbers, and spaces, as well as the following characters: . \_ : / \+ = @ -  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[\s\S]*`   
Required: Yes

 ** [NetworkScopeRegions](#API_CreateNetworkScope_RequestSyntax) **   <a name="networkmanager-CreateNetworkScope-request-NetworkScopeRegions"></a>
The AWS Regions that the network scope covers. Each Region must be one where AWS Ops Agent for networking is available and can appear only once.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 50 items.  
Length Constraints: Minimum length of 1. Maximum length of 63.  
Pattern: `[\s\S]*`   
Required: Yes

 ** [Tags](#API_CreateNetworkScope_RequestSyntax) **   <a name="networkmanager-CreateNetworkScope-request-Tags"></a>
The tags to apply to the resource during creation.  
Type: Array of [Tag](API_Tag.md) objects  
Required: No

## Response Syntax
<a name="API_CreateNetworkScope_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "NetworkScope": { 
      "AccessMode": "string",
      "CreatedAt": number,
      "Name": "string",
      "NetworkScopeArn": "string",
      "NetworkScopeId": "string",
      "NetworkScopeRegions": [ "string" ],
      "State": "string",
      "StateReason": { 
         "Code": "string",
         "Message": "string"
      }
   }
}
```

## Response Elements
<a name="API_CreateNetworkScope_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [NetworkScope](#API_CreateNetworkScope_ResponseSyntax) **   <a name="networkmanager-CreateNetworkScope-response-NetworkScope"></a>
Information about the network scope.  
Type: [NetworkScope](API_NetworkScope.md) object

## Errors
<a name="API_CreateNetworkScope_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You do not have sufficient access to perform this action.    
 ** ReasonCode **   
A prerequisite that you must complete before you retry the request. Only the network scope operations return this value. Branch on this value rather than on `Message`. These are the same codes that a network scope and a network scope principal carry in `StateReason`, so a prerequisite that is missing when you make the request and one that is found to be missing later are reported the same way.
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict processing the request. Updating or deleting the resource can cause an inconsistent state.    
 ** ResourceId **   
The ID of the resource.  
 ** ResourceType **   
The resource type.
HTTP Status Code: 409

 ** InternalServerException **   
The request has failed due to an internal error.    
 ** RetryAfterSeconds **   
Indicates when to retry the request.
HTTP Status Code: 500

 ** ServiceQuotaExceededException **   
A service limit was exceeded.    
 ** LimitCode **   
The limit code.  
 ** Message **   
The error message.  
 ** ResourceId **   
The ID of the resource.  
 ** ResourceType **   
The resource type.  
 ** ServiceCode **   
The service code.
HTTP Status Code: 402

 ** ThrottlingException **   
The request was denied due to request throttling.    
 ** RetryAfterSeconds **   
Indicates when to retry the request.
HTTP Status Code: 429

 ** ValidationException **   
The input fails to satisfy the constraints.    
 ** Fields **   
The fields that caused the error, if applicable.  
 ** Reason **   
The reason for the error.  
 ** ReasonCode **   
A prerequisite that you must complete before you retry the request. Only the network scope operations return this value. Branch on this value rather than on `Message`. These are the same codes that a network scope and a network scope principal carry in `StateReason`, so a prerequisite that is missing when you make the request and one that is found to be missing later are reported the same way.
HTTP Status Code: 400

## See Also
<a name="API_CreateNetworkScope_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/networkmanager-2019-07-05/CreateNetworkScope) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/networkmanager-2019-07-05/CreateNetworkScope) 