Debian Codegraph @

ansible_collections/lowlydba/sqlserver/plugins/modules/user.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # (c) 2022, John McCall (@lowlydba)
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = r'''
8 ---
9 module: user
10 short_description: Configures a user within a database
11 description:
12 - Creates, modifies, or removes a user in a database.
13 version_added: 1.1.0
14 options:
15 login:
16 description:
17 - Name of the login that the user is mapped to.
18 type: str
19 required: true
20 database:
21 description:
22 - Database for the user.
23 type: str
24 required: true
25 username:
26 description:
27 - Name of the user.
28 type: str
29 required: true
30 external_provider:
31 description:
32 - Specifies that the user is for Azure AD Authentication. Only used when creating a new user, this cannot be modified for an existing user.
33 type: bool
34 required: false
35 default_schema:
36 description:
37 - The default database schema for the user.
38 type: str
39 required: false
40 default: "dbo"
41 author: "John McCall (@lowlydba)"
42 requirements:
43 - L(dbatools,https://www.powershellgallery.com/packages/dbatools/) PowerShell module
44 extends_documentation_fragment:
45 - lowlydba.sqlserver.sql_credentials
46 - lowlydba.sqlserver.attributes.check_mode
47 - lowlydba.sqlserver.attributes.platform_all
48 - lowlydba.sqlserver.state
49 '''
50
51 EXAMPLES = r'''
52 - name: Create a user
53 lowlydba.sqlserver.user:
54 sql_instance: sql-01.myco.io
55 login: TheIntern
56 username: TheIntern
57 database: InternProject1
58
59 - name: Change user's schema
60 lowlydba.sqlserver.login:
61 sql_instance: sql-01.myco.io
62 login: TheIntern
63 username: TheIntern
64 database: InternProject1
65 default_schema: dev
66
67 - name: Remove a user
68 lowlydba.sqlserver.login:
69 sql_instance: sql-01.myco.io
70 login: TheIntern
71 username: TheIntern
72 database: InternProject1
73 state: absent
74 '''
75
76 RETURN = r'''
77 data:
78 description: Output from the C(New-DbaDbUser), C(Get-DbaDbUser), or C(Remove-DbaDbUser) function.
79 returned: success, but not in check_mode.
80 type: dict
81 '''