blob: 6869f2c86ffb6e30e83538592a14adaf32d2a607 [file] [log] [blame]
Hansen, Tony (th1395)b936fb42018-03-29 14:28:59 +00001# -*- indent-tabs-mode: nil -*- # vi: set expandtab:
2#
3# ============LICENSE_START====================================================
4# org.onap.dcae
5# =============================================================================
6# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7# =============================================================================
8# Licensed under the Apache License, Version 2.0 (the "License");
9# you may not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS,
16# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19# ============LICENSE_END======================================================
20
21tosca_definitions_version: cloudify_dsl_1_3
22
23description: |-
24 This blueprint is an example of how an application can access the needed information about
25 a persistent database created as part of a PGaaS cluster.
26
27 For a given database "dbname" on a given PGaaS cluster "PGCLUSTERNAME",
28 there are three roles created:
29 admin role: has complete administrative control over that database
30 user role: has complete read and write access on that database
31 viewer role: only has read access on that database
32 The various attributes will return the appropriate information
33 that can be used with that role: host fqdn, role name and password.
34
35 This blueprint is part of a suite of three blueprints:
36 k8s-pgaas-initdb takes control of the postgres server instance.
37 k8s-pgaas-database creates a database, roles and credentials associated with the database.
38 k8s-pgaas-getdbinfo shows how an application can access a database (including its roles and credentials) that was already created with k8s-pgaas-database.
39
40imports:
41 - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
42 - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/pgaas/1.1.0/pgaas_types.yaml"
43
44inputs:
45 k8s_pgaas_instance_fqdn:
46 type: string
47 database_name:
48 type: string
49
50node_templates:
51 pgclustername_dbname:
52 type: dcae.nodes.pgaas.database
53 properties:
54 writerfqdn: { get_input: k8s_pgaas_instance_fqdn }
55 name: { get_input: database_name }
56 use_existing: true
57
58outputs:
59 # admin role has control over table/index/view creation/dropping
60 pgclustername_dbname_admin_host:
61 description: Hostname for PGCLUSTERNAME dbname database
62 value: { get_attribute: [ pgclustername_dbname, admin, host ] }
63 pgclustername_dbname_admin_port:
64 description: Portname for PGCLUSTERNAME dbname database
65 value: { get_attribute: [ pgclustername_dbname, admin, port ] }
66 pgclustername_dbname_admin_user:
67 description: Admin Username for PGCLUSTERNAME dbname database
68 value: { get_attribute: [ pgclustername_dbname, admin, user ] }
69 pgclustername_dbname_admin_password:
70 description: Admin Password for PGCLUSTERNAME dbname database
71 value: { get_attribute: [ pgclustername_dbname, admin, password ] }
72
73 # user role can read and write the tables
74 pgclustername_dbname_user_host:
75 description: Hostname for PGCLUSTERNAME dbname database
76 value: { get_attribute: [ pgclustername_dbname, user, host ] }
77 pgclustername_dbname_user_port:
78 description: Portname for PGCLUSTERNAME dbname database
79 value: { get_attribute: [ pgclustername_dbname, user, port ] }
80 pgclustername_dbname_user_user:
81 description: User Username for PGCLUSTERNAME dbname database
82 value: { get_attribute: [ pgclustername_dbname, user, user ] }
83 pgclustername_dbname_user_password:
84 description: User Password for PGCLUSTERNAME dbname database
85 value: { get_attribute: [ pgclustername_dbname, user, password ] }
86
87 # viewer role can only read from the tables
88 pgclustername_dbname_viewer_host:
89 description: Hostname for PGCLUSTERNAME dbname database
90 value: { get_attribute: [ pgclustername_dbname, viewer, host ] }
91 pgclustername_dbname_viewer_port:
92 description: Portname for PGCLUSTERNAME dbname database
93 value: { get_attribute: [ pgclustername_dbname, viewer, port ] }
94 pgclustername_dbname_viewer_user:
95 description: Viewer Username for PGCLUSTERNAME dbname database
96 value: { get_attribute: [ pgclustername_dbname, viewer, user ] }
97 pgclustername_dbname_viewer_password:
98 description: Viewer Password for PGCLUSTERNAME dbname database
99 value: { get_attribute: [ pgclustername_dbname, viewer, password ] }