Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from edisonxiang/addcomments
Browse files Browse the repository at this point in the history
add comments for dcs
  • Loading branch information
edisonxiang authored Jul 5, 2018
2 parents 1e1d4f3 + 63708cd commit 966fcb2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
9 changes: 1 addition & 8 deletions docs/usage/dcs-imdg.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ Update a previously provisioned instance.
| maintain_begin | string | N | Time at which the maintenance time window starts.
| maintain_end | string | N | Time at which the maintenance time window ends.
| security_group_id | string | N | Subnet ID.
| new_capacity | int | N | New cache capacity. Unit: GB. For a IMDG instance in single node, the cache capacity can be 2 GB, 4 GB, 8 GB. For a IMDG instance in cluster mode, the cache capacity can be 64 GB.
| old_password | string | N | The previous password of IMDG instance.
| new_password | string | N | The new password of IMDG instance.


## Deprovision

Expand Down Expand Up @@ -142,10 +138,7 @@ To update a service, use the `cf update-service` command.
```
cf update-service myimdg -c '{
"name": "IMDGSingleNode1",
"description": "IMDG Single Node Test1",
"new_capacity": 8,
"old_password": "Password1234!",
"new_password": "Password1234$"
"description": "IMDG Single Node Test1"
}'
```

Expand Down
3 changes: 1 addition & 2 deletions docs/usage/dcs-redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Update a previously provisioned instance.
| maintain_begin | string | N | Time at which the maintenance time window starts.
| maintain_end | string | N | Time at which the maintenance time window ends.
| security_group_id | string | N | Subnet ID.
| new_capacity | int | N | New cache capacity. Unit: GB. For a Redis instance in single node or master standby mode, the cache capacity can be 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, or 64 GB. For a Redis instance in cluster mode, the cache capacity can be 64, 128, 256, 512, or 1024 GB.
| new_capacity | int | N | New cache capacity. Unit: GB. For a Redis instance in single node or master standby mode, the cache capacity can be 2 GB, 4 GB, 8 GB, 16 GB, 32 GB, or 64 GB. **For a Redis instance in cluster mode, it does not support extend the cache capacity.**
| old_password | string | N | The previous password of Redis instance.
| new_password | string | N | The new password of Redis instance.

Expand Down Expand Up @@ -144,7 +144,6 @@ To update a service, use the `cf update-service` command.
cf update-service myredis -c '{
"name": "RedisSingleNode1",
"description": "Redis Single Node Test1",
"new_capacity": 8,
"old_password": "Password1234!",
"new_password": "Password1234$"
}'
Expand Down
3 changes: 2 additions & 1 deletion pkg/services/dcs/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ func (b *DCSBroker) Bind(instanceID, bindingID string, details brokerapi.BindDet
}

// Get specified parameters
username := addtionalparam[AddtionalParamUsername]
password := addtionalparam[AddtionalParamPassword]

// Build Binding Credential
credential, err := BuildBindingCredential(instance.IP, instance.Port, instance.AccessUser, password, instance.Name, service.Name)
credential, err := BuildBindingCredential(instance.IP, instance.Port, username, password, instance.Name, service.Name)
if err != nil {
return brokerapi.Binding{}, fmt.Errorf("build dcs instance binding credential failed. Error: %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/services/dcs/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ func (b *DCSBroker) Provision(instanceID string, details brokerapi.ProvisionDeta

// Constuct addtional info
addtionalparam := map[string]string{}
addtionalparam[AddtionalParamUsername] = provisionOpts.AccessUser
addtionalparam[AddtionalParamPassword] = provisionOpts.Password

// Marshal addtional info
Expand Down
2 changes: 2 additions & 0 deletions pkg/services/dcs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ type UpdateParameters struct {
}

const (
// AddtionalParamUsername for username
AddtionalParamUsername string = "username"
// AddtionalParamPassword for password
AddtionalParamPassword string = "password"
)
8 changes: 5 additions & 3 deletions pkg/services/dcs/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ func BuildBindingCredential(
name string,
servicetype string) (BindingCredential, error) {

if servicetype == models.DCSRedisServiceName ||
servicetype == models.DCSMemcachedServiceName ||
servicetype == models.DCSIMDGServiceName {
if servicetype == models.DCSRedisServiceName {
username = ""
} else if servicetype == models.DCSMemcachedServiceName {

} else if servicetype == models.DCSIMDGServiceName {
port = 0
} else {
return BindingCredential{}, fmt.Errorf("unknown service type: %s", servicetype)
}
Expand Down

0 comments on commit 966fcb2

Please sign in to comment.