diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 55c84f95a3..088043b2d8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,9 +1,17 @@ Change Log -~~~~~~~~~~ +~~~~~~~~~~ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +==================== +2.1.6 - 2019-01-31 +==================== + +Added +----- +* Support for the Announcements service + ==================== 2.1.5 - 2019-01-24 ==================== @@ -16,6 +24,7 @@ Added Fixed ----- * KmsCryptoClient and KmsManagementClient updated to make service_endpoint required +* Explicitly imported path to idna. Addresses `GitHub issue 101 `__ ==================== 2.1.4 - 2019-01-10 diff --git a/docs/api/announcements_service.rst b/docs/api/announcements_service.rst new file mode 100644 index 0000000000..4c3cad1f31 --- /dev/null +++ b/docs/api/announcements_service.rst @@ -0,0 +1,27 @@ +Announcements Service +===================== + +.. autosummary:: + :toctree: announcements_service/client + :nosignatures: + :template: autosummary/service_client.rst + + oci.announcements_service.AnnouncementClient + oci.announcements_service.AnnouncementClientCompositeOperations + +-------- + Models +-------- + +.. autosummary:: + :toctree: announcements_service/models + :nosignatures: + :template: autosummary/model_class.rst + + oci.announcements_service.models.AffectedResource + oci.announcements_service.models.Announcement + oci.announcements_service.models.AnnouncementSummary + oci.announcements_service.models.AnnouncementUserStatusDetails + oci.announcements_service.models.AnnouncementsCollection + oci.announcements_service.models.BaseAnnouncement + oci.announcements_service.models.NotificationFollowupDetails diff --git a/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClient.rst b/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClient.rst new file mode 100644 index 0000000000..6ed64df58a --- /dev/null +++ b/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClient.rst @@ -0,0 +1,8 @@ +AnnouncementClient +================== + +.. currentmodule:: oci.announcements_service + +.. autoclass:: AnnouncementClient + :special-members: __init__ + :members: \ No newline at end of file diff --git a/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClientCompositeOperations.rst b/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClientCompositeOperations.rst new file mode 100644 index 0000000000..3b80eeae6d --- /dev/null +++ b/docs/api/announcements_service/client/oci.announcements_service.AnnouncementClientCompositeOperations.rst @@ -0,0 +1,8 @@ +AnnouncementClientCompositeOperations +===================================== + +.. currentmodule:: oci.announcements_service + +.. autoclass:: AnnouncementClientCompositeOperations + :special-members: __init__ + :members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.AffectedResource.rst b/docs/api/announcements_service/models/oci.announcements_service.models.AffectedResource.rst new file mode 100644 index 0000000000..cf41a6bd47 --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.AffectedResource.rst @@ -0,0 +1,11 @@ +AffectedResource +================ + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: AffectedResource + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.Announcement.rst b/docs/api/announcements_service/models/oci.announcements_service.models.Announcement.rst new file mode 100644 index 0000000000..d04da4edef --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.Announcement.rst @@ -0,0 +1,11 @@ +Announcement +============ + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: Announcement + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementSummary.rst b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementSummary.rst new file mode 100644 index 0000000000..897c500ab6 --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementSummary.rst @@ -0,0 +1,11 @@ +AnnouncementSummary +=================== + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: AnnouncementSummary + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementUserStatusDetails.rst b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementUserStatusDetails.rst new file mode 100644 index 0000000000..ce5e511d19 --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementUserStatusDetails.rst @@ -0,0 +1,11 @@ +AnnouncementUserStatusDetails +============================= + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: AnnouncementUserStatusDetails + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementsCollection.rst b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementsCollection.rst new file mode 100644 index 0000000000..2401fce798 --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.AnnouncementsCollection.rst @@ -0,0 +1,11 @@ +AnnouncementsCollection +======================= + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: AnnouncementsCollection + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.BaseAnnouncement.rst b/docs/api/announcements_service/models/oci.announcements_service.models.BaseAnnouncement.rst new file mode 100644 index 0000000000..c72a13dd1a --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.BaseAnnouncement.rst @@ -0,0 +1,11 @@ +BaseAnnouncement +================ + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: BaseAnnouncement + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/announcements_service/models/oci.announcements_service.models.NotificationFollowupDetails.rst b/docs/api/announcements_service/models/oci.announcements_service.models.NotificationFollowupDetails.rst new file mode 100644 index 0000000000..299c8d7b98 --- /dev/null +++ b/docs/api/announcements_service/models/oci.announcements_service.models.NotificationFollowupDetails.rst @@ -0,0 +1,11 @@ +NotificationFollowupDetails +=========================== + +.. currentmodule:: oci.announcements_service.models + +.. autoclass:: NotificationFollowupDetails + :show-inheritance: + :special-members: __init__ + :members: + :undoc-members: + :inherited-members: \ No newline at end of file diff --git a/docs/api/index.rst b/docs/api/index.rst index 4102526087..147cf22edf 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -13,6 +13,31 @@ Single Page Reference ~~~~~~~~~~~~~~~~~~~~~~ +===================== +Announcements Service +===================== + +-------- + Client +-------- + +.. autoclass:: oci.announcements_service.announcement_client.AnnouncementClient + :members: + :noindex: + +-------- + Models +-------- + +.. automodule:: oci.announcements_service.models + :special-members: __init__ + :members: + :undoc-members: + :imported-members: + :inherited-members: + :noindex: + + ===== Audit ===== diff --git a/docs/api/landing.rst b/docs/api/landing.rst index a5edc42b07..724ff8904b 100644 --- a/docs/api/landing.rst +++ b/docs/api/landing.rst @@ -3,6 +3,7 @@ API Reference .. rubric:: Service Clients +* :doc:`Announcement ` * :doc:`Audit ` * :doc:`Container Engine ` * :doc:`Block Storage ` @@ -41,6 +42,7 @@ API Reference :hidden: :maxdepth: 5 + announcements_service audit container_engine core diff --git a/src/oci/__init__.py b/src/oci/__init__.py index 8f26cc3bf2..9cf4828b05 100644 --- a/src/oci/__init__.py +++ b/src/oci/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. -from . import audit, container_engine, core, database, dns, email, file_storage, identity, key_management, load_balancer, object_storage, resource_search +from . import announcements_service, audit, container_engine, core, database, dns, email, file_storage, identity, key_management, load_balancer, object_storage, resource_search from . import auth, config, constants, decorators, exceptions, regions, pagination, retry, fips from .base_client import BaseClient from .request import Request @@ -14,5 +14,5 @@ __all__ = [ "BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", "auth", "retry", "fips", - "audit", "container_engine", "core", "database", "dns", "email", "file_storage", "identity", "key_management", "load_balancer", "object_storage", "resource_search" + "announcements_service", "audit", "container_engine", "core", "database", "dns", "email", "file_storage", "identity", "key_management", "load_balancer", "object_storage", "resource_search" ] diff --git a/src/oci/announcements_service/__init__.py b/src/oci/announcements_service/__init__.py new file mode 100644 index 0000000000..d7b45b119f --- /dev/null +++ b/src/oci/announcements_service/__init__.py @@ -0,0 +1,11 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + + +from .announcement_client import AnnouncementClient +from .announcement_client_composite_operations import AnnouncementClientCompositeOperations +from . import models + +__all__ = ["AnnouncementClient", "AnnouncementClientCompositeOperations", "models"] diff --git a/src/oci/announcements_service/announcement_client.py b/src/oci/announcements_service/announcement_client.py new file mode 100644 index 0000000000..41abdf786b --- /dev/null +++ b/src/oci/announcements_service/announcement_client.py @@ -0,0 +1,451 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + +from oci._vendor import requests # noqa: F401 +from oci._vendor import six + +from oci import retry # noqa: F401 +from oci.base_client import BaseClient +from oci.config import get_config_value_or_default, validate_config +from oci.signer import Signer +from oci.util import Sentinel +from .models import announcements_service_type_mapping +missing = Sentinel("Missing") + + +class AnnouncementClient(object): + """ + A description of the AnnouncementsService API + """ + + def __init__(self, config, **kwargs): + """ + Creates a new service client + + :param dict config: + Configuration keys and values as per `SDK and Tool Configuration `__. + The :py:meth:`~oci.config.from_file` method can be used to load configuration from a file. Alternatively, a ``dict`` can be passed. You can validate_config + the dict using :py:meth:`~oci.config.validate_config` + + :param str service_endpoint: (optional) + The endpoint of the service to call using this client. For example ``https://iaas.us-ashburn-1.oraclecloud.com``. If this keyword argument is + not provided then it will be derived using the region in the config parameter. You should only provide this keyword argument if you have an explicit + need to specify a service endpoint. + + :param timeout: (optional) + The connection and read timeouts for the client. The default is that the client never times out. This keyword argument can be provided + as a single float, in which case the value provided is used for both the read and connection timeouts, or as a tuple of two floats. If + a tuple is provided then the first value is used as the connection timeout and the second value as the read timeout. + :type timeout: float or tuple(float, float) + + :param signer: (optional) + The signer to use when signing requests made by the service client. The default is to use a :py:class:`~oci.signer.Signer` based on the values + provided in the config parameter. + + One use case for this parameter is for `Instance Principals authentication `__ + by passing an instance of :py:class:`~oci.auth.signers.InstancePrincipalsSecurityTokenSigner` as the value for this keyword argument + :type signer: :py:class:`~oci.signer.AbstractBaseSigner` + + :param obj retry_strategy: (optional) + A retry strategy to apply to all calls made by this service client (i.e. at the client level). There is no retry strategy applied by default. + Retry strategies can also be applied at the operation level by passing a ``retry_strategy`` keyword argument as part of calling the operation. + Any value provided at the operation level will override whatever is specified at the client level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + """ + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) + + base_client_init_kwargs = { + 'regional_client': True, + 'service_endpoint': kwargs.get('service_endpoint'), + 'timeout': kwargs.get('timeout'), + 'base_path': '/20180904', + 'skip_deserialization': kwargs.get('skip_deserialization', False) + } + self.base_client = BaseClient("announcement", config, signer, announcements_service_type_mapping, **base_client_init_kwargs) + self.retry_strategy = kwargs.get('retry_strategy') + + def get_announcement(self, announcement_id, **kwargs): + """ + GetAnnouncement + Gets details about single `Announcement` object + + + :param str announcement_id: (required) + The OCID of the announcement + + :param str opc_request_id: (optional) + Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + a particular request, please provide the request ID. + + :param obj retry_strategy: (optional) + A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + + To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.announcements_service.models.Announcement` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/announcements/{announcementId}" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_announcement got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "announcementId": announcement_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-request-id": kwargs.get("opc_request_id", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None} + + retry_strategy = self.retry_strategy + if kwargs.get('retry_strategy'): + retry_strategy = kwargs.get('retry_strategy') + + if retry_strategy: + return retry_strategy.make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Announcement") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Announcement") + + def get_announcement_user_status(self, announcement_id, **kwargs): + """ + GetAnnouncementUserStatus + Get user status of specified announcement + + + :param str announcement_id: (required) + The OCID of the announcement + + :param str opc_request_id: (optional) + Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + a particular request, please provide the request ID. + + :param obj retry_strategy: (optional) + A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + + To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.announcements_service.models.AnnouncementUserStatusDetails` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/announcements/{announcementId}/userStatus" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_announcement_user_status got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "announcementId": announcement_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-request-id": kwargs.get("opc_request_id", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None} + + retry_strategy = self.retry_strategy + if kwargs.get('retry_strategy'): + retry_strategy = kwargs.get('retry_strategy') + + if retry_strategy: + return retry_strategy.make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="AnnouncementUserStatusDetails") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="AnnouncementUserStatusDetails") + + def list_announcements(self, compartment_id, **kwargs): + """ + ListAnnouncements + Gets a list of `Announcement` objects for the current tenancy + + + :param str compartment_id: (required) + OCID of the compartment where search is performed. Announcements are specific to tenancy, so this should an ID of the root compartment + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str announcement_type: (optional) + Type of the announcements to show + + :param str lifecycle_state: (optional) + Filters returned announcements basing on whether they are active now + + Allowed values are: "ACTIVE", "INACTIVE" + + :param bool is_banner: (optional) + Filters returned announcements basing on whether they should be shown as a banner + + :param str sort_by: (optional) + announcements sort order + + Allowed values are: "timeOneValue", "timeTwoValue", "timeCreated", "referenceTicketNumber", "summary", "announcementType" + + :param str sort_order: (optional) + sort order + + Allowed values are: "ASC", "DESC" + + :param datetime time_one_earliest_time: (optional) + The earliest timeOneValue to include + + :param datetime time_one_latest_time: (optional) + The latest timeOneValue to include + + :param str opc_request_id: (optional) + Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + a particular request, please provide the request ID. + + :param obj retry_strategy: (optional) + A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + + To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.announcements_service.models.AnnouncementsCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/announcements" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "announcement_type", + "lifecycle_state", + "is_banner", + "sort_by", + "sort_order", + "time_one_earliest_time", + "time_one_latest_time", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_announcements got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["ACTIVE", "INACTIVE"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["timeOneValue", "timeTwoValue", "timeCreated", "referenceTicketNumber", "summary", "announcementType"] + if kwargs['sort_by'] not in sort_by_allowed_values: + raise ValueError( + "Invalid value for `sort_by`, must be one of {0}".format(sort_by_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "compartmentId": compartment_id, + "announcementType": kwargs.get("announcement_type", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "isBanner": kwargs.get("is_banner", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing), + "timeOneEarliestTime": kwargs.get("time_one_earliest_time", missing), + "timeOneLatestTime": kwargs.get("time_one_latest_time", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing and v is not None} + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-request-id": kwargs.get("opc_request_id", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None} + + retry_strategy = self.retry_strategy + if kwargs.get('retry_strategy'): + retry_strategy = kwargs.get('retry_strategy') + + if retry_strategy: + return retry_strategy.make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="AnnouncementsCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="AnnouncementsCollection") + + def update_announcement_user_status(self, announcement_id, status_details, **kwargs): + """ + UpdateAnnouncementUserStatus + Update `Announcement` status with whether user has seen or supressed the announcement + + + :param str announcement_id: (required) + The OCID of the announcement + + :param AnnouncementUserStatusDetails status_details: (required) + Object for updating a user's status of announcement. + + :param str if_match: (optional) + Optimistic locking version + + :param str opc_request_id: (optional) + Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + a particular request, please provide the request ID. + + :param obj retry_strategy: (optional) + A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level. + + This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` + is also available. The specifics of the default retry strategy are described `here `__. + + To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/announcements/{announcementId}/userStatus" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_announcement_user_status got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "announcementId": announcement_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing), + "opc-request-id": kwargs.get("opc_request_id", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing and v is not None} + + retry_strategy = self.retry_strategy + if kwargs.get('retry_strategy'): + retry_strategy = kwargs.get('retry_strategy') + + if retry_strategy: + return retry_strategy.make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=status_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=status_details) diff --git a/src/oci/announcements_service/announcement_client_composite_operations.py b/src/oci/announcements_service/announcement_client_composite_operations.py new file mode 100644 index 0000000000..ae7d2ee1d7 --- /dev/null +++ b/src/oci/announcements_service/announcement_client_composite_operations.py @@ -0,0 +1,22 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +import oci # noqa: F401 + + +class AnnouncementClientCompositeOperations(object): + """ + This class provides a wrapper around :py:class:`~oci.announcements_service.AnnouncementClient` and offers convenience methods + for operations that would otherwise need to be chained together. For example, instead of performing an action + on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource + to enter a given state, you can call a single method in this class to accomplish the same functionality + """ + + def __init__(self, client, **kwargs): + """ + Creates a new AnnouncementClientCompositeOperations object + + :param AnnouncementClient client: + The service client which will be wrapped by this object + """ + self.client = client diff --git a/src/oci/announcements_service/models/__init__.py b/src/oci/announcements_service/models/__init__.py new file mode 100644 index 0000000000..d25d42d8dc --- /dev/null +++ b/src/oci/announcements_service/models/__init__.py @@ -0,0 +1,23 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + +from .affected_resource import AffectedResource +from .announcement import Announcement +from .announcement_summary import AnnouncementSummary +from .announcement_user_status_details import AnnouncementUserStatusDetails +from .announcements_collection import AnnouncementsCollection +from .base_announcement import BaseAnnouncement +from .notification_followup_details import NotificationFollowupDetails + +# Maps type names to classes for announcements_service services. +announcements_service_type_mapping = { + "AffectedResource": AffectedResource, + "Announcement": Announcement, + "AnnouncementSummary": AnnouncementSummary, + "AnnouncementUserStatusDetails": AnnouncementUserStatusDetails, + "AnnouncementsCollection": AnnouncementsCollection, + "BaseAnnouncement": BaseAnnouncement, + "NotificationFollowupDetails": NotificationFollowupDetails +} diff --git a/src/oci/announcements_service/models/affected_resource.py b/src/oci/announcements_service/models/affected_resource.py new file mode 100644 index 0000000000..25fbd0cacd --- /dev/null +++ b/src/oci/announcements_service/models/affected_resource.py @@ -0,0 +1,131 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class AffectedResource(object): + """ + Descrption of a resource affected by the announcement + """ + + def __init__(self, **kwargs): + """ + Initializes a new AffectedResource object with values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param resource_id: + The value to assign to the resource_id property of this AffectedResource. + :type resource_id: str + + :param resource_name: + The value to assign to the resource_name property of this AffectedResource. + :type resource_name: str + + :param region: + The value to assign to the region property of this AffectedResource. + :type region: str + + """ + self.swagger_types = { + 'resource_id': 'str', + 'resource_name': 'str', + 'region': 'str' + } + + self.attribute_map = { + 'resource_id': 'resourceId', + 'resource_name': 'resourceName', + 'region': 'region' + } + + self._resource_id = None + self._resource_name = None + self._region = None + + @property + def resource_id(self): + """ + **[Required]** Gets the resource_id of this AffectedResource. + The OCID of the resource + + + :return: The resource_id of this AffectedResource. + :rtype: str + """ + return self._resource_id + + @resource_id.setter + def resource_id(self, resource_id): + """ + Sets the resource_id of this AffectedResource. + The OCID of the resource + + + :param resource_id: The resource_id of this AffectedResource. + :type: str + """ + self._resource_id = resource_id + + @property + def resource_name(self): + """ + **[Required]** Gets the resource_name of this AffectedResource. + User-friendly name of the resource + + + :return: The resource_name of this AffectedResource. + :rtype: str + """ + return self._resource_name + + @resource_name.setter + def resource_name(self, resource_name): + """ + Sets the resource_name of this AffectedResource. + User-friendly name of the resource + + + :param resource_name: The resource_name of this AffectedResource. + :type: str + """ + self._resource_name = resource_name + + @property + def region(self): + """ + **[Required]** Gets the region of this AffectedResource. + Region where this resource belongs to + + + :return: The region of this AffectedResource. + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """ + Sets the region of this AffectedResource. + Region where this resource belongs to + + + :param region: The region of this AffectedResource. + :type: str + """ + self._region = region + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/announcement.py b/src/oci/announcements_service/models/announcement.py new file mode 100644 index 0000000000..364e7441b6 --- /dev/null +++ b/src/oci/announcements_service/models/announcement.py @@ -0,0 +1,269 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +from .base_announcement import BaseAnnouncement +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class Announcement(BaseAnnouncement): + """ + An announcement object which represents a message targetted to a specific tenant + """ + + def __init__(self, **kwargs): + """ + Initializes a new Announcement object with values from keyword arguments. The default value of the :py:attr:`~oci.announcements_service.models.Announcement.type` attribute + of this class is ``Announcement`` and it should not be changed. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param id: + The value to assign to the id property of this Announcement. + :type id: str + + :param type: + The value to assign to the type property of this Announcement. + :type type: str + + :param reference_ticket_number: + The value to assign to the reference_ticket_number property of this Announcement. + :type reference_ticket_number: str + + :param summary: + The value to assign to the summary property of this Announcement. + :type summary: str + + :param time_one_title: + The value to assign to the time_one_title property of this Announcement. + :type time_one_title: str + + :param time_one_value: + The value to assign to the time_one_value property of this Announcement. + :type time_one_value: datetime + + :param time_two_title: + The value to assign to the time_two_title property of this Announcement. + :type time_two_title: str + + :param time_two_value: + The value to assign to the time_two_value property of this Announcement. + :type time_two_value: datetime + + :param services: + The value to assign to the services property of this Announcement. + :type services: list[str] + + :param affected_regions: + The value to assign to the affected_regions property of this Announcement. + :type affected_regions: list[str] + + :param announcement_type: + The value to assign to the announcement_type property of this Announcement. + Allowed values for this property are: "ACTION_RECOMMENDED", "ACTION_REQUIRED", "EMERGENCY_CHANGE", "EMERGENCY_MAINTENANCE", "EMERGENCY_MAINTENANCE_COMPLETE", "EMERGENCY_MAINTENANCE_EXTENDED", "EMERGENCY_MAINTENANCE_RESCHEDULED", "INFORMATION", "PLANNED_CHANGE", "PLANNED_CHANGE_COMPLETE", "PLANNED_CHANGE_EXTENDED", "PLANNED_CHANGE_RESCHEDULED", "PRODUCTION_EVENT_NOTIFICATION", "SCHEDULED_MAINTENANCE", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type announcement_type: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this Announcement. + Allowed values for this property are: "ACTIVE", "INACTIVE", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param is_banner: + The value to assign to the is_banner property of this Announcement. + :type is_banner: bool + + :param time_created: + The value to assign to the time_created property of this Announcement. + :type time_created: datetime + + :param time_updated: + The value to assign to the time_updated property of this Announcement. + :type time_updated: datetime + + :param description: + The value to assign to the description property of this Announcement. + :type description: str + + :param additional_information: + The value to assign to the additional_information property of this Announcement. + :type additional_information: str + + :param followups: + The value to assign to the followups property of this Announcement. + :type followups: list[NotificationFollowupDetails] + + :param affected_resources: + The value to assign to the affected_resources property of this Announcement. + :type affected_resources: list[AffectedResource] + + """ + self.swagger_types = { + 'id': 'str', + 'type': 'str', + 'reference_ticket_number': 'str', + 'summary': 'str', + 'time_one_title': 'str', + 'time_one_value': 'datetime', + 'time_two_title': 'str', + 'time_two_value': 'datetime', + 'services': 'list[str]', + 'affected_regions': 'list[str]', + 'announcement_type': 'str', + 'lifecycle_state': 'str', + 'is_banner': 'bool', + 'time_created': 'datetime', + 'time_updated': 'datetime', + 'description': 'str', + 'additional_information': 'str', + 'followups': 'list[NotificationFollowupDetails]', + 'affected_resources': 'list[AffectedResource]' + } + + self.attribute_map = { + 'id': 'id', + 'type': 'type', + 'reference_ticket_number': 'referenceTicketNumber', + 'summary': 'summary', + 'time_one_title': 'timeOneTitle', + 'time_one_value': 'timeOneValue', + 'time_two_title': 'timeTwoTitle', + 'time_two_value': 'timeTwoValue', + 'services': 'services', + 'affected_regions': 'affectedRegions', + 'announcement_type': 'announcementType', + 'lifecycle_state': 'lifecycleState', + 'is_banner': 'isBanner', + 'time_created': 'timeCreated', + 'time_updated': 'timeUpdated', + 'description': 'description', + 'additional_information': 'additionalInformation', + 'followups': 'followups', + 'affected_resources': 'affectedResources' + } + + self._id = None + self._type = None + self._reference_ticket_number = None + self._summary = None + self._time_one_title = None + self._time_one_value = None + self._time_two_title = None + self._time_two_value = None + self._services = None + self._affected_regions = None + self._announcement_type = None + self._lifecycle_state = None + self._is_banner = None + self._time_created = None + self._time_updated = None + self._description = None + self._additional_information = None + self._followups = None + self._affected_resources = None + self._type = 'Announcement' + + @property + def description(self): + """ + Gets the description of this Announcement. + A more detailed explanation of the notification. A markdown format input + + + :return: The description of this Announcement. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """ + Sets the description of this Announcement. + A more detailed explanation of the notification. A markdown format input + + + :param description: The description of this Announcement. + :type: str + """ + self._description = description + + @property + def additional_information(self): + """ + Gets the additional_information of this Announcement. + A markdown format input that forms e.g. the FAQ section of a notification + + + :return: The additional_information of this Announcement. + :rtype: str + """ + return self._additional_information + + @additional_information.setter + def additional_information(self, additional_information): + """ + Sets the additional_information of this Announcement. + A markdown format input that forms e.g. the FAQ section of a notification + + + :param additional_information: The additional_information of this Announcement. + :type: str + """ + self._additional_information = additional_information + + @property + def followups(self): + """ + Gets the followups of this Announcement. + + :return: The followups of this Announcement. + :rtype: list[NotificationFollowupDetails] + """ + return self._followups + + @followups.setter + def followups(self, followups): + """ + Sets the followups of this Announcement. + + :param followups: The followups of this Announcement. + :type: list[NotificationFollowupDetails] + """ + self._followups = followups + + @property + def affected_resources(self): + """ + Gets the affected_resources of this Announcement. + List of resources (possibly empty) affected by this announcement + + + :return: The affected_resources of this Announcement. + :rtype: list[AffectedResource] + """ + return self._affected_resources + + @affected_resources.setter + def affected_resources(self, affected_resources): + """ + Sets the affected_resources of this Announcement. + List of resources (possibly empty) affected by this announcement + + + :param affected_resources: The affected_resources of this Announcement. + :type: list[AffectedResource] + """ + self._affected_resources = affected_resources + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/announcement_summary.py b/src/oci/announcements_service/models/announcement_summary.py new file mode 100644 index 0000000000..86add826a0 --- /dev/null +++ b/src/oci/announcements_service/models/announcement_summary.py @@ -0,0 +1,149 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + +from .base_announcement import BaseAnnouncement +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class AnnouncementSummary(BaseAnnouncement): + """ + An announcement summary object which is returned by List API + """ + + def __init__(self, **kwargs): + """ + Initializes a new AnnouncementSummary object with values from keyword arguments. The default value of the :py:attr:`~oci.announcements_service.models.AnnouncementSummary.type` attribute + of this class is ``AnnouncementSummary`` and it should not be changed. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param id: + The value to assign to the id property of this AnnouncementSummary. + :type id: str + + :param type: + The value to assign to the type property of this AnnouncementSummary. + :type type: str + + :param reference_ticket_number: + The value to assign to the reference_ticket_number property of this AnnouncementSummary. + :type reference_ticket_number: str + + :param summary: + The value to assign to the summary property of this AnnouncementSummary. + :type summary: str + + :param time_one_title: + The value to assign to the time_one_title property of this AnnouncementSummary. + :type time_one_title: str + + :param time_one_value: + The value to assign to the time_one_value property of this AnnouncementSummary. + :type time_one_value: datetime + + :param time_two_title: + The value to assign to the time_two_title property of this AnnouncementSummary. + :type time_two_title: str + + :param time_two_value: + The value to assign to the time_two_value property of this AnnouncementSummary. + :type time_two_value: datetime + + :param services: + The value to assign to the services property of this AnnouncementSummary. + :type services: list[str] + + :param affected_regions: + The value to assign to the affected_regions property of this AnnouncementSummary. + :type affected_regions: list[str] + + :param announcement_type: + The value to assign to the announcement_type property of this AnnouncementSummary. + Allowed values for this property are: "ACTION_RECOMMENDED", "ACTION_REQUIRED", "EMERGENCY_CHANGE", "EMERGENCY_MAINTENANCE", "EMERGENCY_MAINTENANCE_COMPLETE", "EMERGENCY_MAINTENANCE_EXTENDED", "EMERGENCY_MAINTENANCE_RESCHEDULED", "INFORMATION", "PLANNED_CHANGE", "PLANNED_CHANGE_COMPLETE", "PLANNED_CHANGE_EXTENDED", "PLANNED_CHANGE_RESCHEDULED", "PRODUCTION_EVENT_NOTIFICATION", "SCHEDULED_MAINTENANCE", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type announcement_type: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this AnnouncementSummary. + Allowed values for this property are: "ACTIVE", "INACTIVE", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param is_banner: + The value to assign to the is_banner property of this AnnouncementSummary. + :type is_banner: bool + + :param time_created: + The value to assign to the time_created property of this AnnouncementSummary. + :type time_created: datetime + + :param time_updated: + The value to assign to the time_updated property of this AnnouncementSummary. + :type time_updated: datetime + + """ + self.swagger_types = { + 'id': 'str', + 'type': 'str', + 'reference_ticket_number': 'str', + 'summary': 'str', + 'time_one_title': 'str', + 'time_one_value': 'datetime', + 'time_two_title': 'str', + 'time_two_value': 'datetime', + 'services': 'list[str]', + 'affected_regions': 'list[str]', + 'announcement_type': 'str', + 'lifecycle_state': 'str', + 'is_banner': 'bool', + 'time_created': 'datetime', + 'time_updated': 'datetime' + } + + self.attribute_map = { + 'id': 'id', + 'type': 'type', + 'reference_ticket_number': 'referenceTicketNumber', + 'summary': 'summary', + 'time_one_title': 'timeOneTitle', + 'time_one_value': 'timeOneValue', + 'time_two_title': 'timeTwoTitle', + 'time_two_value': 'timeTwoValue', + 'services': 'services', + 'affected_regions': 'affectedRegions', + 'announcement_type': 'announcementType', + 'lifecycle_state': 'lifecycleState', + 'is_banner': 'isBanner', + 'time_created': 'timeCreated', + 'time_updated': 'timeUpdated' + } + + self._id = None + self._type = None + self._reference_ticket_number = None + self._summary = None + self._time_one_title = None + self._time_one_value = None + self._time_two_title = None + self._time_two_value = None + self._services = None + self._affected_regions = None + self._announcement_type = None + self._lifecycle_state = None + self._is_banner = None + self._time_created = None + self._time_updated = None + self._type = 'AnnouncementSummary' + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/announcement_user_status_details.py b/src/oci/announcements_service/models/announcement_user_status_details.py new file mode 100644 index 0000000000..ffebfd7b13 --- /dev/null +++ b/src/oci/announcements_service/models/announcement_user_status_details.py @@ -0,0 +1,133 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class AnnouncementUserStatusDetails(object): + """ + An announcement status + """ + + def __init__(self, **kwargs): + """ + Initializes a new AnnouncementUserStatusDetails object with values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param user_status_announcement_id: + The value to assign to the user_status_announcement_id property of this AnnouncementUserStatusDetails. + :type user_status_announcement_id: str + + :param user_id: + The value to assign to the user_id property of this AnnouncementUserStatusDetails. + :type user_id: str + + :param time_acknowledged: + The value to assign to the time_acknowledged property of this AnnouncementUserStatusDetails. + :type time_acknowledged: datetime + + """ + self.swagger_types = { + 'user_status_announcement_id': 'str', + 'user_id': 'str', + 'time_acknowledged': 'datetime' + } + + self.attribute_map = { + 'user_status_announcement_id': 'userStatusAnnouncementId', + 'user_id': 'userId', + 'time_acknowledged': 'timeAcknowledged' + } + + self._user_status_announcement_id = None + self._user_id = None + self._time_acknowledged = None + + @property + def user_status_announcement_id(self): + """ + **[Required]** Gets the user_status_announcement_id of this AnnouncementUserStatusDetails. + The OCID of the announcement this status belongs to + + + :return: The user_status_announcement_id of this AnnouncementUserStatusDetails. + :rtype: str + """ + return self._user_status_announcement_id + + @user_status_announcement_id.setter + def user_status_announcement_id(self, user_status_announcement_id): + """ + Sets the user_status_announcement_id of this AnnouncementUserStatusDetails. + The OCID of the announcement this status belongs to + + + :param user_status_announcement_id: The user_status_announcement_id of this AnnouncementUserStatusDetails. + :type: str + """ + self._user_status_announcement_id = user_status_announcement_id + + @property + def user_id(self): + """ + **[Required]** Gets the user_id of this AnnouncementUserStatusDetails. + The OCID of the user this status belongs to + + + :return: The user_id of this AnnouncementUserStatusDetails. + :rtype: str + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """ + Sets the user_id of this AnnouncementUserStatusDetails. + The OCID of the user this status belongs to + + + :param user_id: The user_id of this AnnouncementUserStatusDetails. + :type: str + """ + self._user_id = user_id + + @property + def time_acknowledged(self): + """ + Gets the time_acknowledged of this AnnouncementUserStatusDetails. + The date and time the announcement was acknowledged, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :return: The time_acknowledged of this AnnouncementUserStatusDetails. + :rtype: datetime + """ + return self._time_acknowledged + + @time_acknowledged.setter + def time_acknowledged(self, time_acknowledged): + """ + Sets the time_acknowledged of this AnnouncementUserStatusDetails. + The date and time the announcement was acknowledged, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :param time_acknowledged: The time_acknowledged of this AnnouncementUserStatusDetails. + :type: datetime + """ + self._time_acknowledged = time_acknowledged + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/announcements_collection.py b/src/oci/announcements_service/models/announcements_collection.py new file mode 100644 index 0000000000..cab3ea3795 --- /dev/null +++ b/src/oci/announcements_service/models/announcements_collection.py @@ -0,0 +1,100 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class AnnouncementsCollection(object): + """ + Results of annoucements search. Contains both announcements, and user specific status of the announcments + """ + + def __init__(self, **kwargs): + """ + Initializes a new AnnouncementsCollection object with values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this AnnouncementsCollection. + :type items: list[AnnouncementSummary] + + :param user_statuses: + The value to assign to the user_statuses property of this AnnouncementsCollection. + :type user_statuses: list[AnnouncementUserStatusDetails] + + """ + self.swagger_types = { + 'items': 'list[AnnouncementSummary]', + 'user_statuses': 'list[AnnouncementUserStatusDetails]' + } + + self.attribute_map = { + 'items': 'items', + 'user_statuses': 'userStatuses' + } + + self._items = None + self._user_statuses = None + + @property + def items(self): + """ + Gets the items of this AnnouncementsCollection. + collection of announcements + + + :return: The items of this AnnouncementsCollection. + :rtype: list[AnnouncementSummary] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this AnnouncementsCollection. + collection of announcements + + + :param items: The items of this AnnouncementsCollection. + :type: list[AnnouncementSummary] + """ + self._items = items + + @property + def user_statuses(self): + """ + Gets the user_statuses of this AnnouncementsCollection. + user specific status of found announcements + + + :return: The user_statuses of this AnnouncementsCollection. + :rtype: list[AnnouncementUserStatusDetails] + """ + return self._user_statuses + + @user_statuses.setter + def user_statuses(self, user_statuses): + """ + Sets the user_statuses of this AnnouncementsCollection. + user specific status of found announcements + + + :param user_statuses: The user_statuses of this AnnouncementsCollection. + :type: list[AnnouncementUserStatusDetails] + """ + self._user_statuses = user_statuses + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/base_announcement.py b/src/oci/announcements_service/models/base_announcement.py new file mode 100644 index 0000000000..6b8c053cd7 --- /dev/null +++ b/src/oci/announcements_service/models/base_announcement.py @@ -0,0 +1,610 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class BaseAnnouncement(object): + """ + Base for announcements and incidents + """ + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "ACTION_RECOMMENDED" + ANNOUNCEMENT_TYPE_ACTION_RECOMMENDED = "ACTION_RECOMMENDED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "ACTION_REQUIRED" + ANNOUNCEMENT_TYPE_ACTION_REQUIRED = "ACTION_REQUIRED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "EMERGENCY_CHANGE" + ANNOUNCEMENT_TYPE_EMERGENCY_CHANGE = "EMERGENCY_CHANGE" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "EMERGENCY_MAINTENANCE" + ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE = "EMERGENCY_MAINTENANCE" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "EMERGENCY_MAINTENANCE_COMPLETE" + ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_COMPLETE = "EMERGENCY_MAINTENANCE_COMPLETE" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "EMERGENCY_MAINTENANCE_EXTENDED" + ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_EXTENDED = "EMERGENCY_MAINTENANCE_EXTENDED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "EMERGENCY_MAINTENANCE_RESCHEDULED" + ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_RESCHEDULED = "EMERGENCY_MAINTENANCE_RESCHEDULED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "INFORMATION" + ANNOUNCEMENT_TYPE_INFORMATION = "INFORMATION" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "PLANNED_CHANGE" + ANNOUNCEMENT_TYPE_PLANNED_CHANGE = "PLANNED_CHANGE" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "PLANNED_CHANGE_COMPLETE" + ANNOUNCEMENT_TYPE_PLANNED_CHANGE_COMPLETE = "PLANNED_CHANGE_COMPLETE" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "PLANNED_CHANGE_EXTENDED" + ANNOUNCEMENT_TYPE_PLANNED_CHANGE_EXTENDED = "PLANNED_CHANGE_EXTENDED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "PLANNED_CHANGE_RESCHEDULED" + ANNOUNCEMENT_TYPE_PLANNED_CHANGE_RESCHEDULED = "PLANNED_CHANGE_RESCHEDULED" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "PRODUCTION_EVENT_NOTIFICATION" + ANNOUNCEMENT_TYPE_PRODUCTION_EVENT_NOTIFICATION = "PRODUCTION_EVENT_NOTIFICATION" + + #: A constant which can be used with the announcement_type property of a BaseAnnouncement. + #: This constant has a value of "SCHEDULED_MAINTENANCE" + ANNOUNCEMENT_TYPE_SCHEDULED_MAINTENANCE = "SCHEDULED_MAINTENANCE" + + #: A constant which can be used with the lifecycle_state property of a BaseAnnouncement. + #: This constant has a value of "ACTIVE" + LIFECYCLE_STATE_ACTIVE = "ACTIVE" + + #: A constant which can be used with the lifecycle_state property of a BaseAnnouncement. + #: This constant has a value of "INACTIVE" + LIFECYCLE_STATE_INACTIVE = "INACTIVE" + + def __init__(self, **kwargs): + """ + Initializes a new BaseAnnouncement object with values from keyword arguments. This class has the following subclasses and if you are using this class as input + to a service operations then you should favor using a subclass over the base class: + + * :class:`~oci.announcements_service.models.AnnouncementSummary` + * :class:`~oci.announcements_service.models.Announcement` + + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param id: + The value to assign to the id property of this BaseAnnouncement. + :type id: str + + :param type: + The value to assign to the type property of this BaseAnnouncement. + :type type: str + + :param reference_ticket_number: + The value to assign to the reference_ticket_number property of this BaseAnnouncement. + :type reference_ticket_number: str + + :param summary: + The value to assign to the summary property of this BaseAnnouncement. + :type summary: str + + :param time_one_title: + The value to assign to the time_one_title property of this BaseAnnouncement. + :type time_one_title: str + + :param time_one_value: + The value to assign to the time_one_value property of this BaseAnnouncement. + :type time_one_value: datetime + + :param time_two_title: + The value to assign to the time_two_title property of this BaseAnnouncement. + :type time_two_title: str + + :param time_two_value: + The value to assign to the time_two_value property of this BaseAnnouncement. + :type time_two_value: datetime + + :param services: + The value to assign to the services property of this BaseAnnouncement. + :type services: list[str] + + :param affected_regions: + The value to assign to the affected_regions property of this BaseAnnouncement. + :type affected_regions: list[str] + + :param announcement_type: + The value to assign to the announcement_type property of this BaseAnnouncement. + Allowed values for this property are: "ACTION_RECOMMENDED", "ACTION_REQUIRED", "EMERGENCY_CHANGE", "EMERGENCY_MAINTENANCE", "EMERGENCY_MAINTENANCE_COMPLETE", "EMERGENCY_MAINTENANCE_EXTENDED", "EMERGENCY_MAINTENANCE_RESCHEDULED", "INFORMATION", "PLANNED_CHANGE", "PLANNED_CHANGE_COMPLETE", "PLANNED_CHANGE_EXTENDED", "PLANNED_CHANGE_RESCHEDULED", "PRODUCTION_EVENT_NOTIFICATION", "SCHEDULED_MAINTENANCE" + :type announcement_type: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this BaseAnnouncement. + Allowed values for this property are: "ACTIVE", "INACTIVE" + :type lifecycle_state: str + + :param is_banner: + The value to assign to the is_banner property of this BaseAnnouncement. + :type is_banner: bool + + :param time_created: + The value to assign to the time_created property of this BaseAnnouncement. + :type time_created: datetime + + :param time_updated: + The value to assign to the time_updated property of this BaseAnnouncement. + :type time_updated: datetime + + """ + self.swagger_types = { + 'id': 'str', + 'type': 'str', + 'reference_ticket_number': 'str', + 'summary': 'str', + 'time_one_title': 'str', + 'time_one_value': 'datetime', + 'time_two_title': 'str', + 'time_two_value': 'datetime', + 'services': 'list[str]', + 'affected_regions': 'list[str]', + 'announcement_type': 'str', + 'lifecycle_state': 'str', + 'is_banner': 'bool', + 'time_created': 'datetime', + 'time_updated': 'datetime' + } + + self.attribute_map = { + 'id': 'id', + 'type': 'type', + 'reference_ticket_number': 'referenceTicketNumber', + 'summary': 'summary', + 'time_one_title': 'timeOneTitle', + 'time_one_value': 'timeOneValue', + 'time_two_title': 'timeTwoTitle', + 'time_two_value': 'timeTwoValue', + 'services': 'services', + 'affected_regions': 'affectedRegions', + 'announcement_type': 'announcementType', + 'lifecycle_state': 'lifecycleState', + 'is_banner': 'isBanner', + 'time_created': 'timeCreated', + 'time_updated': 'timeUpdated' + } + + self._id = None + self._type = None + self._reference_ticket_number = None + self._summary = None + self._time_one_title = None + self._time_one_value = None + self._time_two_title = None + self._time_two_value = None + self._services = None + self._affected_regions = None + self._announcement_type = None + self._lifecycle_state = None + self._is_banner = None + self._time_created = None + self._time_updated = None + + @staticmethod + def get_subtype(object_dictionary): + """ + Given the hash representation of a subtype of this class, + use the info in the hash to return the class of the subtype. + """ + type = object_dictionary['type'] + + if type == 'AnnouncementSummary': + return 'AnnouncementSummary' + + if type == 'Announcement': + return 'Announcement' + else: + return 'BaseAnnouncement' + + @property + def id(self): + """ + **[Required]** Gets the id of this BaseAnnouncement. + The OCID of the announcement + + + :return: The id of this BaseAnnouncement. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this BaseAnnouncement. + The OCID of the announcement + + + :param id: The id of this BaseAnnouncement. + :type: str + """ + self._id = id + + @property + def type(self): + """ + **[Required]** Gets the type of this BaseAnnouncement. + Entity type + + + :return: The type of this BaseAnnouncement. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """ + Sets the type of this BaseAnnouncement. + Entity type + + + :param type: The type of this BaseAnnouncement. + :type: str + """ + self._type = type + + @property + def reference_ticket_number(self): + """ + **[Required]** Gets the reference_ticket_number of this BaseAnnouncement. + The reference JIRA ticket number + + + :return: The reference_ticket_number of this BaseAnnouncement. + :rtype: str + """ + return self._reference_ticket_number + + @reference_ticket_number.setter + def reference_ticket_number(self, reference_ticket_number): + """ + Sets the reference_ticket_number of this BaseAnnouncement. + The reference JIRA ticket number + + + :param reference_ticket_number: The reference_ticket_number of this BaseAnnouncement. + :type: str + """ + self._reference_ticket_number = reference_ticket_number + + @property + def summary(self): + """ + **[Required]** Gets the summary of this BaseAnnouncement. + Forms part of the email subject and/or the console representation (a banner or alike) + + + :return: The summary of this BaseAnnouncement. + :rtype: str + """ + return self._summary + + @summary.setter + def summary(self, summary): + """ + Sets the summary of this BaseAnnouncement. + Forms part of the email subject and/or the console representation (a banner or alike) + + + :param summary: The summary of this BaseAnnouncement. + :type: str + """ + self._summary = summary + + @property + def time_one_title(self): + """ + Gets the time_one_title of this BaseAnnouncement. + The title of the first time value, e.g. Time Started + + + :return: The time_one_title of this BaseAnnouncement. + :rtype: str + """ + return self._time_one_title + + @time_one_title.setter + def time_one_title(self, time_one_title): + """ + Sets the time_one_title of this BaseAnnouncement. + The title of the first time value, e.g. Time Started + + + :param time_one_title: The time_one_title of this BaseAnnouncement. + :type: str + """ + self._time_one_title = time_one_title + + @property + def time_one_value(self): + """ + Gets the time_one_value of this BaseAnnouncement. + The first time value, actual meaning depending on notification type + + + :return: The time_one_value of this BaseAnnouncement. + :rtype: datetime + """ + return self._time_one_value + + @time_one_value.setter + def time_one_value(self, time_one_value): + """ + Sets the time_one_value of this BaseAnnouncement. + The first time value, actual meaning depending on notification type + + + :param time_one_value: The time_one_value of this BaseAnnouncement. + :type: datetime + """ + self._time_one_value = time_one_value + + @property + def time_two_title(self): + """ + Gets the time_two_title of this BaseAnnouncement. + The title of the second time value, e.g. Time Ended + + + :return: The time_two_title of this BaseAnnouncement. + :rtype: str + """ + return self._time_two_title + + @time_two_title.setter + def time_two_title(self, time_two_title): + """ + Sets the time_two_title of this BaseAnnouncement. + The title of the second time value, e.g. Time Ended + + + :param time_two_title: The time_two_title of this BaseAnnouncement. + :type: str + """ + self._time_two_title = time_two_title + + @property + def time_two_value(self): + """ + Gets the time_two_value of this BaseAnnouncement. + The second time value, actual meaning depending on notification type + + + :return: The time_two_value of this BaseAnnouncement. + :rtype: datetime + """ + return self._time_two_value + + @time_two_value.setter + def time_two_value(self, time_two_value): + """ + Sets the time_two_value of this BaseAnnouncement. + The second time value, actual meaning depending on notification type + + + :param time_two_value: The time_two_value of this BaseAnnouncement. + :type: datetime + """ + self._time_two_value = time_two_value + + @property + def services(self): + """ + Gets the services of this BaseAnnouncement. + Impacted services + + + :return: The services of this BaseAnnouncement. + :rtype: list[str] + """ + return self._services + + @services.setter + def services(self, services): + """ + Sets the services of this BaseAnnouncement. + Impacted services + + + :param services: The services of this BaseAnnouncement. + :type: list[str] + """ + self._services = services + + @property + def affected_regions(self): + """ + Gets the affected_regions of this BaseAnnouncement. + Impacted regions + + + :return: The affected_regions of this BaseAnnouncement. + :rtype: list[str] + """ + return self._affected_regions + + @affected_regions.setter + def affected_regions(self, affected_regions): + """ + Sets the affected_regions of this BaseAnnouncement. + Impacted regions + + + :param affected_regions: The affected_regions of this BaseAnnouncement. + :type: list[str] + """ + self._affected_regions = affected_regions + + @property + def announcement_type(self): + """ + **[Required]** Gets the announcement_type of this BaseAnnouncement. + The detailed description of an announcement + + Allowed values for this property are: "ACTION_RECOMMENDED", "ACTION_REQUIRED", "EMERGENCY_CHANGE", "EMERGENCY_MAINTENANCE", "EMERGENCY_MAINTENANCE_COMPLETE", "EMERGENCY_MAINTENANCE_EXTENDED", "EMERGENCY_MAINTENANCE_RESCHEDULED", "INFORMATION", "PLANNED_CHANGE", "PLANNED_CHANGE_COMPLETE", "PLANNED_CHANGE_EXTENDED", "PLANNED_CHANGE_RESCHEDULED", "PRODUCTION_EVENT_NOTIFICATION", "SCHEDULED_MAINTENANCE" + + + :return: The announcement_type of this BaseAnnouncement. + :rtype: str + """ + return self._announcement_type + + @announcement_type.setter + def announcement_type(self, announcement_type): + """ + Sets the announcement_type of this BaseAnnouncement. + The detailed description of an announcement + + + :param announcement_type: The announcement_type of this BaseAnnouncement. + :type: str + """ + allowed_values = ["ACTION_RECOMMENDED", "ACTION_REQUIRED", "EMERGENCY_CHANGE", "EMERGENCY_MAINTENANCE", "EMERGENCY_MAINTENANCE_COMPLETE", "EMERGENCY_MAINTENANCE_EXTENDED", "EMERGENCY_MAINTENANCE_RESCHEDULED", "INFORMATION", "PLANNED_CHANGE", "PLANNED_CHANGE_COMPLETE", "PLANNED_CHANGE_EXTENDED", "PLANNED_CHANGE_RESCHEDULED", "PRODUCTION_EVENT_NOTIFICATION", "SCHEDULED_MAINTENANCE"] + if not value_allowed_none_or_none_sentinel(announcement_type, allowed_values): + raise ValueError( + "Invalid value for `announcement_type`, must be None or one of {0}" + .format(allowed_values) + ) + self._announcement_type = announcement_type + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this BaseAnnouncement. + Lifecycle states of announcement + + Allowed values for this property are: "ACTIVE", "INACTIVE" + + + :return: The lifecycle_state of this BaseAnnouncement. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this BaseAnnouncement. + Lifecycle states of announcement + + + :param lifecycle_state: The lifecycle_state of this BaseAnnouncement. + :type: str + """ + allowed_values = ["ACTIVE", "INACTIVE"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + raise ValueError( + "Invalid value for `lifecycle_state`, must be None or one of {0}" + .format(allowed_values) + ) + self._lifecycle_state = lifecycle_state + + @property + def is_banner(self): + """ + **[Required]** Gets the is_banner of this BaseAnnouncement. + Show announcement as a banner + + + :return: The is_banner of this BaseAnnouncement. + :rtype: bool + """ + return self._is_banner + + @is_banner.setter + def is_banner(self, is_banner): + """ + Sets the is_banner of this BaseAnnouncement. + Show announcement as a banner + + + :param is_banner: The is_banner of this BaseAnnouncement. + :type: bool + """ + self._is_banner = is_banner + + @property + def time_created(self): + """ + Gets the time_created of this BaseAnnouncement. + The date and time the announcement was created, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :return: The time_created of this BaseAnnouncement. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this BaseAnnouncement. + The date and time the announcement was created, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :param time_created: The time_created of this BaseAnnouncement. + :type: datetime + """ + self._time_created = time_created + + @property + def time_updated(self): + """ + Gets the time_updated of this BaseAnnouncement. + The date and time the announcement was last updated, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :return: The time_updated of this BaseAnnouncement. + :rtype: datetime + """ + return self._time_updated + + @time_updated.setter + def time_updated(self, time_updated): + """ + Sets the time_updated of this BaseAnnouncement. + The date and time the announcement was last updated, in the format defined by RFC3339 + Example: `2016-07-22T17:43:01.389+0000` + + + :param time_updated: The time_updated of this BaseAnnouncement. + :type: datetime + """ + self._time_updated = time_updated + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/announcements_service/models/notification_followup_details.py b/src/oci/announcements_service/models/notification_followup_details.py new file mode 100644 index 0000000000..61e2dc3f66 --- /dev/null +++ b/src/oci/announcements_service/models/notification_followup_details.py @@ -0,0 +1,100 @@ +# coding: utf-8 +# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + + +from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from oci.decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class NotificationFollowupDetails(object): + """ + Information represents a notification follow-up + """ + + def __init__(self, **kwargs): + """ + Initializes a new NotificationFollowupDetails object with values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param message: + The value to assign to the message property of this NotificationFollowupDetails. + :type message: str + + :param time_created: + The value to assign to the time_created property of this NotificationFollowupDetails. + :type time_created: datetime + + """ + self.swagger_types = { + 'message': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'message': 'message', + 'time_created': 'timeCreated' + } + + self._message = None + self._time_created = None + + @property + def message(self): + """ + Gets the message of this NotificationFollowupDetails. + The follow-up message, a markdown format input + + + :return: The message of this NotificationFollowupDetails. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """ + Sets the message of this NotificationFollowupDetails. + The follow-up message, a markdown format input + + + :param message: The message of this NotificationFollowupDetails. + :type: str + """ + self._message = message + + @property + def time_created(self): + """ + Gets the time_created of this NotificationFollowupDetails. + When the update is made + + + :return: The time_created of this NotificationFollowupDetails. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this NotificationFollowupDetails. + When the update is made + + + :param time_created: The time_created of this NotificationFollowupDetails. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/service_endpoints.py b/src/oci/service_endpoints.py index da8fc0f226..6886491b9d 100644 --- a/src/oci/service_endpoints.py +++ b/src/oci/service_endpoints.py @@ -2,6 +2,7 @@ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. SERVICE_ENDPOINTS = { + "announcement": "https://announcements.{domain}", "audit": "https://audit.{domain}", "blockstorage": "https://iaas.{domain}", "compute": "https://iaas.{domain}", diff --git a/src/oci/version.py b/src/oci/version.py index 1aefcbd6d1..479ae9d3b3 100644 --- a/src/oci/version.py +++ b/src/oci/version.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. -__version__ = "2.1.5" +__version__ = "2.1.6"