Skip to content

Commit

Permalink
Merge pull request #4 from T-Systems-MMS/loop
Browse files Browse the repository at this point in the history
change all variables to camel case
  • Loading branch information
schurzi authored Aug 14, 2020
2 parents 8d78558 + da740ad commit 89e399c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
10 changes: 5 additions & 5 deletions plugins/module_utils/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ class AtlasAPIObject:
module = None

def __init__(
self, module, object_name, groupid, path, data, data_is_array=False
self, module, object_name, groupId, path, data, data_is_array=False
):
self.module = module
self.path = path
self.data = data
self.groupid = groupid
self.groupId = groupId
self.object_name = object_name
self.data_is_array = data_is_array

self.module.params["url_username"] = self.module.params["api_username"]
self.module.params["url_password"] = self.module.params["api_password"]
self.module.params["url_username"] = self.module.params["apiUsername"]
self.module.params["url_password"] = self.module.params["apiPassword"]

def call_url(self, path, data="", method="GET"):
headers = {
Expand All @@ -45,7 +45,7 @@ def call_url(self, path, data="", method="GET"):

url = (
"https://cloud.mongodb.com/api/atlas/v1.0/groups/"
+ self.groupid
+ self.groupId
+ path
)
rsp, info = fetch_url(
Expand Down
20 changes: 10 additions & 10 deletions plugins/modules/atlas_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
- L(API Documentation,https://docs.atlas.mongodb.com/reference/api/clusters/)
author: "Martin Schurz (@schurzi)"
options:
api_username:
apiUsername:
description:
- The username for use in authentication with the Atlas API.
- Can use API users and tokens (public key is username)
type: str
required: True
api_password:
apiPassword:
description:
- The password for use in authentication with the Atlas API.
- Can use API users and tokens (private key is password)
Expand All @@ -55,7 +55,7 @@
choices: [ "present", "absent" ]
default: present
type: str
groupid:
groupId:
description:
- Unique identifier for the Atlas project.
type: str
Expand Down Expand Up @@ -132,9 +132,9 @@
EXAMPLES = """
- name: test cluster
atlas_cluster:
api_username: "API_user"
api_password: "API_passwort_or_token"
groupid: "GROUP_ID"
apiUsername: "API_user"
apiPassword: "API_passwort_or_token"
groupId: "GROUP_ID"
name: "testcluster"
mongoDBMajorVersion: "4.0"
clusterType: "REPLICASET"
Expand All @@ -158,9 +158,9 @@ def main():
# add our own arguments
argument_spec = dict(
state=dict(default="present", choices=["absent", "present"]),
api_username=dict(required=True),
api_password=dict(required=True, no_log=True),
groupid=dict(required=True),
apiUsername=dict(required=True),
apiPassword=dict(required=True, no_log=True),
groupId=dict(required=True),
name=dict(required=True),
mongoDBMajorVersion=dict(choices=["3.6", "4.0", "4.2", "4.4"]),
clusterType=dict(
Expand Down Expand Up @@ -214,7 +214,7 @@ def main():
module=module,
path="/clusters",
object_name="name",
groupid=module.params["groupid"],
groupId=module.params["groupId"],
data=data,
)
except Exception as e:
Expand Down
20 changes: 10 additions & 10 deletions plugins/modules/atlas_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
- L(API Documentation,https://docs.atlas.mongodb.com/reference/api/database-users/)
author: "Martin Schurz (@schurzi)"
options:
api_username:
apiUsername:
description:
- The username for use in authentication with the Atlas API.
- Can use API users and tokens (public key is username)
type: str
required: True
api_password:
apiPassword:
description:
- The password for use in authentication with the Atlas API.
- Can use API users and tokens (private key is password)
Expand All @@ -58,7 +58,7 @@
choices: [ "present", "absent" ]
default: present
type: str
groupid:
groupId:
description:
- Unique identifier for the Atlas project.
type: str
Expand Down Expand Up @@ -100,9 +100,9 @@
EXAMPLES = """
- name: test user
atlas_user:
api_username: "API_user"
api_password: "API_passwort_or_token"
groupid: "GROUP_ID"
apiUsername: "API_user"
apiPassword: "API_passwort_or_token"
groupId: "GROUP_ID"
username: my_app_user
password: SuperSecret!
roles:
Expand All @@ -125,9 +125,9 @@ def main():
# add our own arguments
argument_spec = dict(
state=dict(default="present", choices=["absent", "present"]),
api_username=dict(required=True),
api_password=dict(required=True, no_log=True),
groupid=dict(required=True),
apiUsername=dict(required=True),
apiPassword=dict(required=True, no_log=True),
groupId=dict(required=True),
databaseName=dict(default="admin", choices=["admin", "$external"]),
username=dict(required=True),
password=dict(required=True, no_log=True),
Expand Down Expand Up @@ -157,7 +157,7 @@ def main():
module=module,
path="/databaseUsers",
object_name="username",
groupid=module.params["groupid"],
groupId=module.params["groupId"],
data=data,
)
except Exception as e:
Expand Down
20 changes: 10 additions & 10 deletions plugins/modules/atlas_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
- L(API Documentation,https://docs.atlas.mongodb.com/reference/api/whitelist/)
author: "Martin Schurz (@schurzi)"
options:
api_username:
apiUsername:
description:
- The username for use in authentication with the Atlas API.
- Can use API users and tokens (public key is username)
type: str
required: True
api_password:
apiPassword:
description:
- The password for use in authentication with the Atlas API.
- Can use API users and tokens (private key is password)
Expand All @@ -54,7 +54,7 @@
choices: [ "present", "absent" ]
default: present
type: str
groupid:
groupId:
description:
- Unique identifier for the Atlas project.
type: str
Expand All @@ -74,9 +74,9 @@
EXAMPLES = """
- name: test whitelist
atlas_whitelist:
api_username: "API_user"
api_password: "API_passwort_or_token"
groupid: "GROUP_ID"
apiUsername: "API_user"
apiPassword: "API_passwort_or_token"
groupId: "GROUP_ID"
cidrBlock: "192.168.0.0/24"
comment: "test"
"""
Expand All @@ -94,9 +94,9 @@ def main():
# add our own arguments
argument_spec = dict(
state=dict(default="present", choices=["absent", "present"]),
api_username=dict(required=True),
api_password=dict(required=True, no_log=True),
groupid=dict(required=True),
apiUsername=dict(required=True),
apiPassword=dict(required=True, no_log=True),
groupId=dict(required=True),
cidrBlock=dict(required=True),
comment=dict(default="created by Ansible"),
)
Expand All @@ -116,7 +116,7 @@ def main():
module=module,
path="/whitelist",
object_name="cidrBlock",
groupid=module.params["groupid"],
groupId=module.params["groupId"],
data=data,
data_is_array=True,
)
Expand Down

0 comments on commit 89e399c

Please sign in to comment.