> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Identifier Deploy/CDK 레퍼런스

GS2-Deploy의 스택을 생성할 때 사용하는 템플릿 포맷과, CDK를 이용한 각종 언어의 템플릿 출력 구현 예제




## 엔티티

Deploy 처리에서 조작 대상이 되는 리소스

### Identifier

크레덴셜<br>

GS2 API에 액세스하기 위해 사용되는 크레덴셜입니다.<br>
크레덴셜은 클라이언트 ID와 클라이언트 시크릿으로 구성되며, 크레덴셜을 사용한 액세스는 크레덴셜 소유자인 사용자의 권한에 따라 액세스가 제한됩니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| userName | string |  | ✓|  |  ~ 128자 | 사용자 이름<br>이 크레덴셜을 소유한 GS2-Identifier 사용자의 이름입니다. 크레덴셜은 이 사용자에게 연결된 보안 정책에 따라 권한을 상속받습니다. |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [Identifier](../sdk#identifier) | 작성한 크리덴셜
| ClientSecret | string | 클라이언트 시크릿

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Identifier::Identifier
Properties:
  UserName: user-0001

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/identifier"
)


SampleStack := core.NewStack()
identifier.NewIdentifier(
    &SampleStack,
    "user-0001",
    identifier.IdentifierOptions{},
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Identifier\Model\Identifier(
            stack: $this,
            userName: "user-0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.identifier.model.Identifier(
                this,
                "user-0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.Identifier(
            stack: this,
            userName: "user-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new identifier.model.Identifier(
            this,
            "user-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, identifier

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        identifier.Identifier(
            stack=self,
            user_name='user-0001',
        )

print(SampleStack().yaml())  # Generate Template

```


---

### Password

비밀번호<br>

사용자의 권한에 따라 매니지먼트 콘솔에 로그인하기 위한 비밀번호입니다.<br>
비밀번호를 설정하면 하나의 프로젝트에 서로 다른 계정으로 로그인할 수 있으며, 접근 가능한 정보에 제한을 둘 수 있습니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| userName | string |  | ✓|  |  ~ 128자 | 사용자 이름<br>이 비밀번호를 소유하는 GS2-Identifier 사용자의 이름입니다. 사용자는 이 사용자 이름과 대응하는 비밀번호로 매니지먼트 콘솔에 로그인하며, 사용자에게 할당된 보안 정책에 따라 접근이 제한됩니다. |
| password | string |  | ✓|  |  ~ 1024자 | 비밀번호<br>매니지먼트 콘솔 인증에 사용되는 해시화된 비밀번호입니다. 비밀번호 생성 시 설정되며, 로그인 시 사용자 입력과 대조됩니다. 내부적으로 저장되며, API를 통해 반환되지 않습니다. |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [Password](../sdk#password) | 작성한 패스워드

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Identifier::Password
Properties:
  UserName: user-0001
  Password: password-0001

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/identifier"
)


SampleStack := core.NewStack()
identifier.NewPassword(
    &SampleStack,
    "user-0001",
    "password-0001",
    identifier.PasswordOptions{},
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Identifier\Model\Password(
            stack: $this,
            userName: "user-0001",
            password: "password-0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.identifier.model.Password(
                this,
                "user-0001",
                "password-0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.Password(
            stack: this,
            userName: "user-0001",
            password: "password-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new identifier.model.Password(
            this,
            "user-0001",
            "password-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, identifier

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        identifier.Password(
            stack=self,
            user_name='user-0001',
            password='password-0001',
        )

print(SampleStack().yaml())  # Generate Template

```


---

### AttachSecurityPolicy

할당된 보안 정책<br>

GS2-Identifier 사용자와 보안 정책의 연결을 관리합니다. 각 사용자는 해당 사용자에게 적용되는 보안 정책 GRN 목록을 포함하는 하나의 할당 레코드를 가집니다. 사용자의 크리덴셜이 API 접근에 사용될 때, 할당된 모든 정책이 평가되어 요청된 작업이 허용되는지 거부되는지가 판정됩니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| userName | string |  | ✓|  |  ~ 128자 | GS2-Identifier 사용자 이름<br>GS2-Identifier 사용자 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| securityPolicyId | string |  | ✓|  |  ~ 1024자 | 할당할 보안 정책의 GRN |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Items | [SecurityPolicy[]](../sdk#securitypolicy) | 사용자에게 할당한 보안 정책 목록

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Identifier::AttachSecurityPolicy
Properties:
  UserName: user-0001
  SecurityPolicyId: securityPolicyId-0001

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/identifier"
)


SampleStack := core.NewStack()
identifier.NewAttachSecurityPolicy(
    &SampleStack,
    "user-0001",
    "securityPolicyId-0001",
    identifier.AttachSecurityPolicyOptions{},
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Identifier\Model\AttachSecurityPolicy(
            stack: $this,
            userName: "user-0001",
            securityPolicyId: "securityPolicyId-0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.identifier.model.AttachSecurityPolicy(
                this,
                "user-0001",
                "securityPolicyId-0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.AttachSecurityPolicy(
            stack: this,
            userName: "user-0001",
            securityPolicyId: "securityPolicyId-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new identifier.model.AttachSecurityPolicy(
            this,
            "user-0001",
            "securityPolicyId-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, identifier

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        identifier.AttachSecurityPolicy(
            stack=self,
            user_name='user-0001',
            security_policy_id='securityPolicyId-0001',
        )

print(SampleStack().yaml())  # Generate Template

```


---

### User

GS2-Identifier 사용자<br>

프로젝트에 접근 가능한 게임 개발자를 나타내는 엔티티입니다.<br>

사용자는 프로그램에서 접근하기 위한 크리덴셜과,<br>
사용자의 권한에 따라 매니지먼트 콘솔에 로그인하여 프로젝트를 관리할 수 있는 비밀번호를 등록할 수 있습니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | GS2-Identifier 사용자 이름<br>GS2-Identifier 사용자 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [User](../sdk#user) | 생성한 사용자

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Identifier::User
Properties:
  Name: user-0001
  Description: null

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/identifier"
)


SampleStack := core.NewStack()
identifier.NewUser(
    &SampleStack,
    "user-0001",
    identifier.UserOptions{},
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Identifier\Model\User(
            stack: $this,
            name: "user-0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.identifier.model.User(
                this,
                "user-0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.User(
            stack: this,
            name: "user-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new identifier.model.User(
            this,
            "user-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, identifier

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        identifier.User(
            stack=self,
            name='user-0001',
        )

print(SampleStack().yaml())  # Generate Template

```


---

### SecurityPolicy

보안 정책<br>

사용자가 사용할 수 있는 API의 종류와 접근 가능한 리소스의 제한을 정의합니다.<br>
접근 제한 규칙은 정책 문서라는 JSON 형식의 정의 데이터를 사용합니다.<br>
정책 문서의 사양에 대해서는 개발 문서 내 정책 문서에 대한 [설명 페이지](/ko/articles/tech/identifier/#보안-정책)를 참조하십시오.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | 보안 정책 이름<br>보안 정책 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |
| policy | string |  | ✓|  |  ~ 524288자 | 정책 문서<br>이 보안 정책의 접근 제어 규칙을 정의하는 JSON 문서입니다. 어떤 GS2 API 액션을 허용 또는 거부할지, 그리고 규칙이 적용되는 리소스(GRN 패턴으로 식별)를 지정합니다. 여러 스테이트먼트를 조합하여 세밀한 접근 제어를 만들 수 있습니다. 최대 512KB입니다. |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [SecurityPolicy](../sdk#securitypolicy) | 생성한 보안 정책

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Identifier::SecurityPolicy
Properties:
  Name: policy-0001
  Description: null
  Policy:
    Version: "2016-04-01"
    Statements:
      - Effect: Allow
        Actions:
          - "*"
        Resources:
          - "*"

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/identifier"
)


SampleStack := core.NewStack()
identifier.NewSecurityPolicy(
    &SampleStack,
    "policy-0001",
    identifier.NewPolicy(
        []identifier.Statement{
            identifier.NewAllowAllStatement(),
        },
    ),
    identifier.SecurityPolicyOptions{},
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Identifier\Model\SecurityPolicy(
            stack: $this,
            name: "policy-0001",
            policy: new \Gs2Cdk\Identifier\Model\Policy([
                \Gs2Cdk\Identifier\Model\Statement::allowAll()
            ])
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.identifier.model.SecurityPolicy(
                this,
                "policy-0001",
                new io.gs2.cdk.identifier.model.Policy(
                    Arrays.asList(
                        io.gs2.cdk.identifier.model.Statement.allowAll()
                    )
                )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.SecurityPolicy(
            stack: this,
            name: "policy-0001",
            policy: new Gs2Cdk.Gs2Identifier.Model.Policy(
                new [] {
                    Gs2Cdk.Gs2Identifier.Model.Statement.AllowAll()
                }
            )
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
import Policy from "@/gs2cdk/identifier/model/Policy";
import Statement from "@/gs2cdk/identifier/model/Statement";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new identifier.model.SecurityPolicy(
            this,
            "policy-0001",
            new Policy(
                [
                    Statement.allowAll()
                ]
            )
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, identifier

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        identifier.SecurityPolicy(
            stack=self,
            name='policy-0001',
            policy=identifier.Policy([
                identifier.Statement.allow_all(),
            ]),
        )

print(SampleStack().yaml())  # Generate Template

```


---



