
from keystoneclient import base


class Endpoint(base.Resource):
    """Represents a Keystone endpoint."""
    def __repr__(self):
        return "<Endpoint %s>" % self._info


class EndpointManager(base.ManagerWithFind):
    """Manager class for manipulating Keystone endpoints."""

    resource_class = Endpoint

    def list(self):
        """List all available endpoints."""
        return self._list('/endpoints', 'endpoints')

    def create(self, region, service_id, publicurl, adminurl, internalurl):
        """Create a new endpoint."""
        body = {'endpoint': {'region': region,
                             'service_id': service_id,
                             'publicurl': publicurl,
                             'adminurl': adminurl,
                             'internalurl': internalurl}}
        return self._create('/endpoints', body, 'endpoint')

    def delete(self, id):
        """Delete an endpoint."""
        return self._delete('/endpoints/%s' % id)


from keystoneclient import base


class Endpoint(base.Resource):
    """Represents a Keystone endpoint."""
    def __repr__(self):
        return "<Endpoint %s>" % self._info


class EndpointManager(base.ManagerWithFind):
    """Manager class for manipulating Keystone endpoints."""

    resource_class = Endpoint

    def list(self):
        """List all available endpoints."""
        return self._list('/endpoints', 'endpoints')

    def create(self, region, service_id, publicurl, adminurl=None,
               internalurl=None):
        """Create a new endpoint."""
        body = {'endpoint': {'region': region,
                             'service_id': service_id,
                             'publicurl': publicurl,
                             'adminurl': adminurl,
                             'internalurl': internalurl}}
        return self._create('/endpoints', body, 'endpoint')

    def delete(self, id):
        """Delete an endpoint."""
        return self._delete('/endpoints/%s' % id)

Make parameters in EndpointManager optional
Make parameters in EndpointManager optional

Change adminurl and internalurl parameters in EndpointManager create()
to optional parameters.

Change-Id: I490e35b89f7ae7c6cdbced6ba8d3b82d5132c19d
Closes-Bug: #1318436

  
  from keystoneclient import base
  
  
  class Endpoint(base.Resource):
      """Represents a Keystone endpoint."""
      def __repr__(self):
          return "<Endpoint %s>" % self._info
  
  
  class EndpointManager(base.ManagerWithFind):
      """Manager class for manipulating Keystone endpoints."""
  
      resource_class = Endpoint
  
      def list(self):
          """List all available endpoints."""
          return self._list('/endpoints', 'endpoints')
  
-     def create(self, region, service_id, publicurl, adminurl, internalurl):
+     def create(self, region, service_id, publicurl, adminurl=None,
+                internalurl=None):
          """Create a new endpoint."""
          body = {'endpoint': {'region': region,
                               'service_id': service_id,
                               'publicurl': publicurl,
                               'adminurl': adminurl,
                               'internalurl': internalurl}}
          return self._create('/endpoints', body, 'endpoint')
  
      def delete(self, id):
          """Delete an endpoint."""
          return self._delete('/endpoints/%s' % id)
  
Make parameters in EndpointManager optional
## Code Before:

from keystoneclient import base


class Endpoint(base.Resource):
    """Represents a Keystone endpoint."""
    def __repr__(self):
        return "<Endpoint %s>" % self._info


class EndpointManager(base.ManagerWithFind):
    """Manager class for manipulating Keystone endpoints."""

    resource_class = Endpoint

    def list(self):
        """List all available endpoints."""
        return self._list('/endpoints', 'endpoints')

    def create(self, region, service_id, publicurl, adminurl, internalurl):
        """Create a new endpoint."""
        body = {'endpoint': {'region': region,
                             'service_id': service_id,
                             'publicurl': publicurl,
                             'adminurl': adminurl,
                             'internalurl': internalurl}}
        return self._create('/endpoints', body, 'endpoint')

    def delete(self, id):
        """Delete an endpoint."""
        return self._delete('/endpoints/%s' % id)

## Instruction:
Make parameters in EndpointManager optional
## Code After:

from keystoneclient import base


class Endpoint(base.Resource):
    """Represents a Keystone endpoint."""
    def __repr__(self):
        return "<Endpoint %s>" % self._info


class EndpointManager(base.ManagerWithFind):
    """Manager class for manipulating Keystone endpoints."""

    resource_class = Endpoint

    def list(self):
        """List all available endpoints."""
        return self._list('/endpoints', 'endpoints')

    def create(self, region, service_id, publicurl, adminurl=None,
               internalurl=None):
        """Create a new endpoint."""
        body = {'endpoint': {'region': region,
                             'service_id': service_id,
                             'publicurl': publicurl,
                             'adminurl': adminurl,
                             'internalurl': internalurl}}
        return self._create('/endpoints', body, 'endpoint')

    def delete(self, id):
        """Delete an endpoint."""
        return self._delete('/endpoints/%s' % id)
