| 514 | |
| 515 | |
| 516 | class OperationModel: |
| 517 | def __init__(self, operation_model, service_model, name=None): |
| 518 | """ |
| 519 | |
| 520 | :type operation_model: dict |
| 521 | :param operation_model: The operation model. This comes from the |
| 522 | service model, and is the value associated with the operation |
| 523 | name in the service model (i.e ``model['operations'][op_name]``). |
| 524 | |
| 525 | :type service_model: botocore.model.ServiceModel |
| 526 | :param service_model: The service model associated with the operation. |
| 527 | |
| 528 | :type name: string |
| 529 | :param name: The operation name. This is the operation name exposed to |
| 530 | the users of this model. This can potentially be different from |
| 531 | the "wire_name", which is the operation name that *must* by |
| 532 | provided over the wire. For example, given:: |
| 533 | |
| 534 | "CreateCloudFrontOriginAccessIdentity":{ |
| 535 | "name":"CreateCloudFrontOriginAccessIdentity2014_11_06", |
| 536 | ... |
| 537 | } |
| 538 | |
| 539 | The ``name`` would be ``CreateCloudFrontOriginAccessIdentity``, |
| 540 | but the ``self.wire_name`` would be |
| 541 | ``CreateCloudFrontOriginAccessIdentity2014_11_06``, which is the |
| 542 | value we must send in the corresponding HTTP request. |
| 543 | |
| 544 | """ |
| 545 | self._operation_model = operation_model |
| 546 | self._service_model = service_model |
| 547 | self._api_name = name |
| 548 | # Clients can access '.name' to get the operation name |
| 549 | # and '.metadata' to get the top level metdata of the service. |
| 550 | self._wire_name = operation_model.get('name') |
| 551 | self.metadata = service_model.metadata |
| 552 | self.http = operation_model.get('http', {}) |
| 553 | |
| 554 | @CachedProperty |
| 555 | def name(self): |
| 556 | if self._api_name is not None: |
| 557 | return self._api_name |
| 558 | else: |
| 559 | return self.wire_name |
| 560 | |
| 561 | @property |
| 562 | def wire_name(self): |
| 563 | """The wire name of the operation. |
| 564 | |
| 565 | In many situations this is the same value as the |
| 566 | ``name``, value, but in some services, the operation name |
| 567 | exposed to the user is different from the operaiton name |
| 568 | we send across the wire (e.g cloudfront). |
| 569 | |
| 570 | Any serialization code should use ``wire_name``. |
| 571 | |
| 572 | """ |
| 573 | return self._operation_model.get('name') |
no outgoing calls