# Google Cloud Service Directory V1 Client - Class CreateNamespaceRequest (2.2.0)

2.2.0 (latest) 2.1.2 2.0.6 1.3.6 1.2.1 1.1.2 1.0.5 Reference documentation and code samples for the Google Cloud Service Directory V1 Client class CreateNamespaceRequest.

The request message for
[RegistrationService.CreateNamespace](https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.Client.RegistrationServiceClient#_Google_Cloud_ServiceDirectory_V1_Client_RegistrationServiceClient__createNamespace__).

Generated from protobuf message `google.cloud.servicedirectory.v1.CreateNamespaceRequest`

## Namespace

Google \\ Cloud \\ ServiceDirectory \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The resource name of the project and location the namespace will be created in. |
| `↳ namespace_id` | `string` Required. The Resource ID must be 1-63 characters long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Specifically, the name must be 1-63 characters long and match the regular expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| `↳ namespace` | `https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.PBNamespace` Required. A namespace with initial fields set. |

### getParent

Required. The resource name of the project and location the namespace
will be created in.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setParent

Required. The resource name of the project and location the namespace
will be created in.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNamespaceId

Required. The Resource ID must be 1-63 characters long, and comply with
[RFC1035](https://www.ietf.org/rfc/rfc1035.txt).

Specifically, the name must be 1-63 characters long and match the regular
expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
character must be a lowercase letter, and all following characters must
be a dash, lowercase letter, or digit, except the last character, which
cannot be a dash.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setNamespaceId

Required. The Resource ID must be 1-63 characters long, and comply with
[RFC1035](https://www.ietf.org/rfc/rfc1035.txt).

Specifically, the name must be 1-63 characters long and match the regular
expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first
character must be a lowercase letter, and all following characters must
be a dash, lowercase letter, or digit, except the last character, which
cannot be a dash.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNamespace

Required. A namespace with initial fields set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.PBNamespace|null` |   |

### hasNamespace

### clearNamespace

### setNamespace

Required. A namespace with initial fields set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.PBNamespace` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Required. The resource name of the project and location the namespace will be created in. Please see RegistrationServiceClient::locationName() for help formatting this field. |
| `namespace` | `https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.PBNamespace` Required. A namespace with initial fields set. |
| `namespaceId` | `string` Required. The Resource ID must be 1-63 characters long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Specifically, the name must be 1-63 characters long and match the regular expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-service-directory/latest/V1.CreateNamespaceRequest` |   |