-
Notifications
You must be signed in to change notification settings - Fork 2k
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
mgmt-core, support systemData for Azure resource #18303
mgmt-core, support systemData for Azure resource #18303
Conversation
sdk/core/azure-core-management/src/main/java/com/azure/core/management/CreatedByType.java
Outdated
Show resolved
Hide resolved
public CreatedByType createdByType() { | ||
return this.createdByType; | ||
} | ||
|
||
/** | ||
* Get the timestamp of resource creation (UTC). | ||
* | ||
* @return the timestamp of resource creation (UTC). | ||
*/ | ||
public OffsetDateTime createdAt() { | ||
return this.createdAt; | ||
} | ||
|
||
/** | ||
* Get the identity that last modified the resource. | ||
* | ||
* @return the identity that last modified the resource. | ||
*/ | ||
public String lastModifiedBy() { | ||
return this.lastModifiedBy; | ||
} | ||
|
||
/** | ||
* Get the type of identity that last modified the resource. | ||
* | ||
* @return the type of identity that last modified the resource. | ||
*/ | ||
public CreatedByType lastModifiedByType() { | ||
return this.lastModifiedByType; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srnagar
Let me know if you have concern with the class name CreatedByType
. It is defined by swagger. But it might be not very appropriate (as it is returned by createdByType()
and lastModifiedByType()
, more like IdentityType
?).
However IdentityType
would cause quite some naming conflicts with other swagger types (though not too bad as they are under different namespace).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also appreciate suggestion on method names in SystemData
. They seems a bit off (but I do not have better idea).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdentityType sounds like a better name than CreatedByType as it is used for lastModifiedByType too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SystemData seems very generic. Is this name finalized? Can we change this to AzureResourceSystemData?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method names look fine but just want to check, do we prefix get
for getter methods in other arm model types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Got it. Another candidate could be
ResourceAuthorIdentityType
. - It is generic. The class is intended to be returned by every ARM resources (resource group, virtual network, disk, storage account, virtual machine, etc., well, all) in future. It is already in
com.azure.core.management
namespace. On the other hand from its name, it does seems belong to something of operating system (so far, I didn't find any existingSystemData
class that going to be confused with this). MaybeResourceSystemData
would be better. Let me check e.g. how python or .NET names it. - It is still used as POJO for ARM, so like
Resource
class, it does not haveget
prefix.
public CreatedByType createdByType() { | ||
return this.createdByType; | ||
} | ||
|
||
/** | ||
* Get the timestamp of resource creation (UTC). | ||
* | ||
* @return the timestamp of resource creation (UTC). | ||
*/ | ||
public OffsetDateTime createdAt() { | ||
return this.createdAt; | ||
} | ||
|
||
/** | ||
* Get the identity that last modified the resource. | ||
* | ||
* @return the identity that last modified the resource. | ||
*/ | ||
public String lastModifiedBy() { | ||
return this.lastModifiedBy; | ||
} | ||
|
||
/** | ||
* Get the type of identity that last modified the resource. | ||
* | ||
* @return the type of identity that last modified the resource. | ||
*/ | ||
public CreatedByType lastModifiedByType() { | ||
return this.lastModifiedByType; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdentityType sounds like a better name than CreatedByType as it is used for lastModifiedByType too.
public CreatedByType createdByType() { | ||
return this.createdByType; | ||
} | ||
|
||
/** | ||
* Get the timestamp of resource creation (UTC). | ||
* | ||
* @return the timestamp of resource creation (UTC). | ||
*/ | ||
public OffsetDateTime createdAt() { | ||
return this.createdAt; | ||
} | ||
|
||
/** | ||
* Get the identity that last modified the resource. | ||
* | ||
* @return the identity that last modified the resource. | ||
*/ | ||
public String lastModifiedBy() { | ||
return this.lastModifiedBy; | ||
} | ||
|
||
/** | ||
* Get the type of identity that last modified the resource. | ||
* | ||
* @return the type of identity that last modified the resource. | ||
*/ | ||
public CreatedByType lastModifiedByType() { | ||
return this.lastModifiedByType; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SystemData seems very generic. Is this name finalized? Can we change this to AzureResourceSystemData?
public CreatedByType createdByType() { | ||
return this.createdByType; | ||
} | ||
|
||
/** | ||
* Get the timestamp of resource creation (UTC). | ||
* | ||
* @return the timestamp of resource creation (UTC). | ||
*/ | ||
public OffsetDateTime createdAt() { | ||
return this.createdAt; | ||
} | ||
|
||
/** | ||
* Get the identity that last modified the resource. | ||
* | ||
* @return the identity that last modified the resource. | ||
*/ | ||
public String lastModifiedBy() { | ||
return this.lastModifiedBy; | ||
} | ||
|
||
/** | ||
* Get the type of identity that last modified the resource. | ||
* | ||
* @return the type of identity that last modified the resource. | ||
*/ | ||
public CreatedByType lastModifiedByType() { | ||
return this.lastModifiedByType; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method names look fine but just want to check, do we prefix get
for getter methods in other arm model types?
import java.time.OffsetDateTime; | ||
|
||
/** Metadata pertaining to creation and last modification of the resource. */ | ||
public final class SystemData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type missing a constructor? How are the property values set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class is initialized by Jackson (via reflection), hence no constructor (or just default constructor). All properties is read-only, hence no setter.
So far:
|
Updated the swagger files for fixing the casing issue (Azure#18303)
For new Azure resource in mgmt, by default they need to support
SystemData
.https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md
Specs here https://github.com/Azure/azure-rest-api-specs/blob/master/specification/common-types/resource-management/v2/types.json#L498-L550
Related PR on generator Azure/autorest.java#938