AWS Studio create new mutation - amazon-web-services

I am kind of new to aws amplify and I don't understand where I can create a new mutation of type "create".
I would like to do the following:
I have one house model (GraphQL) that has a name and can have multiple people assigned to it (one to many).
When I create the house, I want to automatically assign the user who is connected (cognito) to be the owner of the house. From the serverside so on the mutation because i don't want to assign this in the api call since it could be modified.
Any tips where I can create this mutation or a link to a tutorial on how to accomplish this?

Related

Can we restrict an account in Corda to accept only one specific state?

In My Corda project, I want to create a special account which can have only one specific type of state and do not accept if any other state is shared with it. While other accounts on the same node can accept other states too. Is that possible in Corda. If yes, then How?
you could do this a bunch of different ways.
Maybe the easiest way would be in the flow? You just want to create a rule that ensures only a certain account can run or have a flow run involving it.
Example:
// Create account by using sub flow (from inside a flow).
val accountInfo: StateAndRef<AccountInfo> = subFlow(CreateAccount("Roger's account"))
// Then look up the account by account ID and name.
accountService.accountInfo(accountInfo.state.data.name)
accountService.accountInfo(accountInfo.state.data.identifier.id)
Take a look at this link for the source docs. Good luck!
https://github.com/corda/accounts/blob/master/docs.md

Not able to delete multiple campaigns using Postman from Eloqua

I have been trying to delete multiple campaigns from Eloqua at a time using Postman. But I am not able to do. I don't see reference in the tool as well http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/index.html#Developers/RESTAPI/REST-API.htm%3FTocPath%3D%2520Application%2520API%7C_____0.
Please let me know if deleting the multiple campaigns is possible.
It is not possible.
The link you provided mentions it's outdated, and a redirection link was available: http://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAC/rest-endpoints.html
Have a look at all the DELETE methods over there, and you will see that there is no provision for sending more than one id at a time.
Edit: You say you are using Postman. It is possible to perform repetitive tasks (like deleting mulitple campaigns) with different parameters each time by using Collections.
Edit 2:
Create an environment,
Type your url with the id as a variable, e.g.: xyz.com/delete/{id}
And send all the id values as a JSON or CSV file. They have given a sample JSON, you would simply have to provide your ids inside an array, e.g.:
[
{"id":1},
{"id":2},
{"id":3}
]

What's the correct way via API to create an instance with a through relation in loopback.io?

I've two models, A and B which extends user buildt-in model. They both have a relation "has many" with each other using a through model A_B.
I want to add an instance of B related with an existing A instance.
I've try to post the new B instance with a field As ("As" is the relation name) setted with an array containing the A instance
var b = {"property1":"asdf","property2":"asdf","As":a};
$http.post(serverURL+"/api/bs",b);
The b instance is created, but there is no relation created.
I must to create the A_B instance by hand (or in "after save" hook)?
PD: I'm using angularjs and it's $http service to make API calls.
Check this out: HasManyThrough relation
The advantage of using this approach: new url endpoints are created along with common CRUD operation i.e. New rest endpoint has its own specific tasks and therefore, its usage is easy to understand and is more maintainable. These rest endpoints will create relations in the database as the CRUD operations happen.
You can get the generated url using loopback api on browser.

How to deal with deep level granularization with XACML in enterprise application

I am using IS WSO2 for authorization with XACML. I am am able to achieve authorization for static resource. But I am not sure with the design when it comes to granularization.
Example : if I have method like getCarDetails(Object User) where I should get only those cars which are assigned to this particular user, then how to deal this with XACMl?
Wso2 provides support for PIP where we can use custom classes which can fetch data from database. But I am not sure if we should either make copy of original database at PDP side or give the original database to PIP to get updated with live data.
Because Cars would be dynamic for the application eg. currently 10 cars assigned to user Alice. suddenly supervisor add 20 more car in his list which will be in application level database. Then how these other 20 cars will be automatically assigned in policy at PDP level until it also have this latest information.
I may making some mistake in understanding. But I am not sure how to deal with this as in whole application we can have lots of this kind of complex scenario where some times we will get data for one user from more than 4 or 5 tables then how to handle that scenario?
Your question is a great and the answer will highlight the key benefits of XACML and externalized authorization as a whole.
In XACML, you define generic, global rules, about what is allowed and what isn't using what I would call high-level attributes e.g. attributes of the vehicle (in your case) or the user (role, department, ...)
For instance a simple rule could be (using the ALFA syntax):
policy viewCars{
target clause actionId=="view" and resourceType=="car"
apply firstApplicable
rule allowSameRegion{
permit
condition user.region==car.region
}
}
Both the user's region and the car's region are maintained inside the application's database. The values are read using a PIP or Policy Information Point (details here).
In your example, you talk about direct assignment, i.e. a user has been directly assigned to a vehicle. In that case, the rule would become:
policy viewCars{
target clause actionId=="view" and resourceType=="car"
apply firstApplicable
rule allowAssignedVehicle{
permit
condition user.employeeId==car.assignedUser
}
}
This means that the assigned user information must be kept somewhere, in the application database, a CSV file, a web service, or another source of information. It means that from a management perspective, an administrator would add / remove vehicles from a user's assigned list (or perhaps the other way around: add / remove assigned users from a vehicle's assigned user list).
The XACML rule itself will not change. If the supervisor adds 20 more cars to the employee's list (maintained in the application-level database), then the PDP will be able to use that information via the PIP and access will be granted or denied accordingly.
The key benefit of XACML is that you could add a second rule that would state a supervisor can see the cars he/she is assigned to (the normal rule) as well as the cars assigned to his/her subordinates (a new proxy-delegate rule).
This diagram, taken from the Axiomatics blog, summarizes the XACML flow:
HTH, let me know if you have further questions. You can download ALFA here and you can watch tutorials here.

batch update link_urls in the creative

We are trying to attach some parameters to existing link_urls for creatives.
For example:
http://www.adchemy.com -> http://www.adchemy.com?param_ad_id=23423424242 for tracking
purposes, where is such id is an adgroup id for that creative.
We'll maintain one to one relation between creative and adgroup.
To update existing creative we have to create new and associate it with the ad.
We need to update around 5000 creatives.
Is there a way to update them in the batch rather than doing 10000 requests?
(5000 for new creatives and 5000 to update appropriate ads)?
There is a way in facebook API provides batch updates https://developers.facebook.com/docs/reference/api/batch/ not sure about the limit though it says 20.You can create Adgroups and insert creative element in the form of JSON or object and post information to adgroups url which is available at Open graph API
https://developers.facebook.com/docs/reference/ads-api/adgroup/