Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module: azure_rm_notificationhub #496

Merged
merged 40 commits into from
Jun 24, 2021

Conversation

praveenghuge
Copy link
Contributor

@praveenghuge praveenghuge commented Apr 18, 2021

SUMMARY
This module introduces a wide variety of configurations for creating a Notification Hub Namespace and Notification Hub on Azure.
Create Notification Hub Namespace on Azure.
Create Notification Hub on Azure.
Update Notification Hub Namespace on Azure.
Update Notification Hub on Azure.
Delete Notification Hub Namespace on Azure.
Delete Notification Hub on Azure.
Get Notification Hub Namespace on Azure.
Get Notification Hub on Azure.

ISSUE TYPE
New Module Pull Request
COMPONENT NAME
azure_rm_notificationhub

ADDITIONAL INFORMATION
This module allows users to create/update or delete the Notification Hub Namespace and Notification Hub on Azure.
It also provides all the parameters given by:
https://docs.microsoft.com/en-us/azure/templates/microsoft.notificationhubs/namespaces?tabs=json
https://docs.microsoft.com/en-us/azure/templates/microsoft.notificationhubs/namespaces/notificationhubs?tabs=json

More information

  azure_rm_notificationhub:
    resource_group: testgroupans
    location: eastus
    namespace_name: myNamespace
    tags:
       - a: b
    sku: free

@praveenghuge praveenghuge changed the title Notification hub New Module [Notification hub] Apr 18, 2021
@Fred-sun
Copy link
Collaborator

@praveenghuge Thanks for your contribution! I'm working in!

@Fred-sun Fred-sun added medium_priority Medium priority new_module_pr Add new modules work in In trying to solve, or in working with contributors labels Apr 19, 2021
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praveenhuge There is no content in aliase.

cloud/azure
shippable/azure/group10
destructive

plugins/module_utils/azure_rm_common.py Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Show resolved Hide resolved
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praveenghuge You can also check for sanity problems in PR via links(https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html)! Thank you very much!

plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praveenghuge Please increase update and get block to your playbook --tests/integration/targets/azure_rm_notificationhub/tasks/main.yml . Anyway, please share the result of you execute "tests/integration/targets/azure_rm_notificationhub/tasks/main.yml". Thank you very much!

plugins/modules/azure_rm_notificationhub.py Show resolved Hide resolved
@praveenghuge
Copy link
Contributor Author

praveenghuge commented Apr 19, 2021

i was not able to run integration test on local adding the output the test we performed while creating the resources on azure portal

create namespace

playbook:

   connection: local
   tasks:

    - name: Create Namespace (check mode yes)
      azure.azcollection.azure_rm_notificationhub:

        subscription_id: XXXXX
        tenant: XXXXX
        client_id: XXXX
        secret: XXXX
        location: XXX
        namespace_name: testnaedd3d22d3w
        resource_group: test
        tags:
                a: b
                b: c
        sku: free
      check_mode: yes

output

changed: [localhost] => {
    "changed": true,
    "check_mode": true,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "location": "eastus2",
            "name": null,
            "namespace_name": "testnaedd3d22d3w",
            "password": null,
            "profile": null,
            "resource_group": "test",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "sku": "free",
            "state": "present",
            "subscription_id": "xxxx",
            "tags": {
                "a": "b",
                "b": "c"
            },
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "state": {}
}
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@praveenghuge
Copy link
Contributor Author

praveenghuge commented Apr 19, 2021

playbook

   connection: local
   tasks:

    - name: Create Namespace 
      azure.azcollection.azure_rm_notificationhub:

        subscription_id: XXXXX
        tenant: XXXXX
        client_id: XXXX
        secret: XXXX
        location: XXX
        namespace_name: testnaedd3d22d3w
        resource_group: test
        tags:
                a: b
                b: c
        sku: free

output

changed: [localhost] => {
    "changed": true,
    "check_mode": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "location": "eastus2",
            "name": null,
            "namespace_name": "testnaedd3d22d3w",
            "password": null,
            "profile": null,
            "resource_group": "test",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "sku": "free",
            "state": "present",
            "subscription_id": "XXXX",
            "tags": {
                "a": "b",
                "b": "c"
            },
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "state": {
        "additional_properties": {},
        "critical": null,
        "data_center": null,
        "enabled": false,
        "location": "eastus2",
        "metric_id": null,
        "name": "testnaedd3d22d3w",
        "namespace_type": "NotificationHub",
        "provisioning_state": "Unknown",
        "region": null,
        "scale_unit": null,
        "service_bus_endpoint": null,
        "sku": "free",
        "tags": {
            "a": "b",
            "b": "c"
        },
        "type": "Microsoft.NotificationHubs/namespaces"
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@praveenghuge
Copy link
Contributor Author

praveenghuge commented Apr 19, 2021

playbook

   connection: local
   tasks:

    - name: Update Namespace  free to basic
      azure.azcollection.azure_rm_notificationhub:

        subscription_id: XXXXX
        tenant: XXXXX
        client_id: XXXX
        secret: XXXX
        location: XXX
        namespace_name: testnaedd3d22d3w
        resource_group: test
        tags:
                a: b
                b: c
        sku: basic

output

changed: [localhost] => {
    "changed": true,
    "check_mode": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "location": "eastus2",
            "name": null,
            "namespace_name": "testnaedd3d22d3w",
            "password": null,
            "profile": null,
            "resource_group": "test",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "sku": "basic",
            "state": "present",
            "subscription_id": "XXXXX",
            "tags": {
                "a": "b",
                "b": "c"
            },
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "state": {
        "additional_properties": {},
        "critical": null,
        "data_center": null,
        "enabled": false,
        "location": "eastus2",
        "metric_id": null,
        "name": "testnaedd3d22d3w",
        "namespace_type": "NotificationHub",
        "provisioning_state": "Succeeded",
        "region": null,
        "scale_unit": null,
        "service_bus_endpoint": null,
        "sku": "basic",
        "tags": {
            "a": "b",
            "b": "c"
        },
        "type": "Microsoft.NotificationHubs/namespaces"
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@praveenghuge
Copy link
Contributor Author

praveenghuge commented Apr 19, 2021

playbook

   connection: local
   tasks:

    - name: create namespace (idempotent)
      azure.azcollection.azure_rm_notificationhub:

        subscription_id: XXXXX
        tenant: XXXXX
        client_id: XXXX
        secret: XXXX
        location: XXX
        namespace_name: testnaedd3d22d3w
        resource_group: test
        tags:
                a: b
                b: c
        sku: basic

output

ok: [localhost] => {
    "changed": false,
    "check_mode": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "location": "eastus2",
            "name": null,
            "namespace_name": "testnaedd3d22d3w",
            "password": null,
            "profile": null,
            "resource_group": "test",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "sku": "basic",
            "state": "present",
            "subscription_id": "Xxxx",
            "tags": {
                "a": "b",
                "b": "c"
            },
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "state": {
        "additional_properties": {},
        "critical": false,
        "data_center": null,
        "enabled": true,
        "location": "eastus2",
        "metric_id": null,
        "name": "testnaedd3d22d3w",
        "namespace_type": "NotificationHub",
        "provisioning_state": "Succeeded",
        "region": null,
        "scale_unit": null,
        "service_bus_endpoint": "https://testnaedd3d22d3w.servicebus.windows.net:443/",
        "sku": "Basic",
        "tags": {
            "a": "b",
            "b": "c"
        },
        "type": "Microsoft.NotificationHubs/namespaces"
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@praveenghuge
Copy link
Contributor Author

praveenghuge commented Apr 19, 2021

playbook

---
 - hosts: localhost
   connection: local
   tasks:

    - name: Delete Notification Hub Namespace
      azure.azcollection.azure_rm_notificationhub:
        subscription_id: XXXXX
        tenant: XXX
        client_id: XXXX
        secret: XXXXX
        resource_group: test
        namespace_name: testnaedd3d22d3w
        state: absent

output

changed: [localhost] => {
    "changed": true,
    "check_mode": false,
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "api_profile": "latest",
            "append_tags": true,
            "auth_source": "auto",
            "cert_validation_mode": null,
            "client_id": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "cloud_environment": "AzureCloud",
            "location": null,
            "name": null,
            "namespace_name": "testnaedd3d22d3w",
            "password": null,
            "profile": null,
            "resource_group": "test",
            "secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "sku": "free",
            "state": "absent",
            "subscription_id": "XXxx",
            "tags": null,
            "tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
        }
    },
    "state": {
        "additional_properties": {},
        "critical": false,
        "data_center": null,
        "enabled": true,
        "location": "eastus2",
        "metric_id": null,
        "name": "testnaedd3d22d3w",
        "namespace_type": "NotificationHub",
        "provisioning_state": "Succeeded",
        "region": null,
        "scale_unit": null,
        "service_bus_endpoint": "https://testnaedd3d22d3w.servicebus.windows.net:443/",
        "sku": "Basic",
        "status": "Deleted",
        "tags": {
            "a": "b",
            "b": "c"
        },
        "type": "Microsoft.NotificationHubs/namespaces"
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@praveenghuge
Copy link
Contributor Author

@Fred-sun addressed the changes requested.
Thanks for the review 👍

Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fred-sun addressed the changes requested.
Thanks for the review 👍

@praveenghuge I have been busy with upgrade Python versions recently. Sorry for not replying in time! Thank you very much!

plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_notificationhub.py Outdated Show resolved Hide resolved
@praveenghuge
Copy link
Contributor Author

Hi @Fred-sun can you please review the PR.
thank you so much

@Fred-sun
Copy link
Collaborator

@praveenghuge The test case needs to make minor changes. Thank you very much!

@Fred-sun
Copy link
Collaborator

@praveenghuge Please help to resolve the conflict file and make a minor changes for the playbook! Thank you very much!

@praveenghuge
Copy link
Contributor Author

Hi @Fred-sun can you please review the PR. addressed the changes
thank you so much 👍

@Fred-sun

This comment has been minimized.

@Fred-sun
Copy link
Collaborator

@praveenghuge Please delete azure_rm_expressrouter_info.py, This PR relate with azure_rm_notification* module! Thank you very much!

Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praveenghuge One last update requirement! please!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels May 31, 2021
@praveenghuge
Copy link
Contributor Author

@Fred-sun updated the latest version
Can you please review
Thank you so much 👍

@Fred-sun
Copy link
Collaborator

Fred-sun commented Jun 10, 2021

@praveenghuge Great! Waiting merged!

@praveenghuge
Copy link
Contributor Author

@Fred-sun can we merge this? if there is something to work on will pick up. Thanks

@Fred-sun
Copy link
Collaborator

@praveenghuge Recently, delayed the merger. I will push the merger as soon as possible! Thank you very much!

@xuzhang3
Copy link
Collaborator

LGTM

@xuzhang3 xuzhang3 merged commit f63d6e9 into ansible-collections:dev Jun 24, 2021
Fred-sun pushed a commit to Fred-sun/ansible_collections_azure that referenced this pull request Aug 11, 2021
* notification hub changes

* integration changes

* new changes

* remaining changes

* remaining changes

* address changes

* address changes

* minor change

* address comments

* fixing update account_enabled bug in azure_rm_aduser.py (ansible-collections#524)

* fixing ad related auth issue when using service pricinpal. (ansible-collections#525)

* change class name of azure_rm_aduser (ansible-collections#526)

* class are worngly named. fixed.

* fixing sanity errors.

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* address changes

* update version

Co-authored-by: Praveen Ghuge <pravin94ghuge@gmail.com>
Co-authored-by: haiyuan_zhang <haiyuan.zhang1982@gmail.com>
Co-authored-by: Praveen Ghuge <praghuge@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority new_module_pr Add new modules ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants